You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.8 KiB

  1. ---
  2. name: "tendermint-darwin"
  3. enable_cache: true
  4. distro: "ubuntu"
  5. suites:
  6. - "bionic"
  7. architectures:
  8. - "amd64"
  9. packages:
  10. - "bsdmainutils"
  11. - "build-essential"
  12. - "ca-certificates"
  13. - "curl"
  14. - "debhelper"
  15. - "dpkg-dev"
  16. - "devscripts"
  17. - "fakeroot"
  18. - "git"
  19. - "golang-any"
  20. - "xxd"
  21. - "quilt"
  22. remotes:
  23. - "url": "https://github.com/tendermint/tendermint.git"
  24. "dir": "tendermint"
  25. files:
  26. - "golang-debian-1.12.5-1.tar.gz"
  27. script: |
  28. set -e -o pipefail
  29. GO_SRC_RELEASE=golang-debian-1.12.5-1
  30. GO_SRC_TARBALL="${GO_SRC_RELEASE}.tar.gz"
  31. # Compile go and configure the environment
  32. export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
  33. export BUILD_DIR=`pwd`
  34. tar xf "${GO_SRC_TARBALL}"
  35. rm -f "${GO_SRC_TARBALL}"
  36. [ -d "${GO_SRC_RELEASE}/" ]
  37. mv "${GO_SRC_RELEASE}/" go/
  38. pushd go/
  39. QUILT_PATCHES=debian/patches quilt push -a
  40. fakeroot debian/rules build RUN_TESTS=false GOCACHE=/tmp/go-cache
  41. popd
  42. export GOOS=darwin
  43. export GOROOT=${BUILD_DIR}/go
  44. export GOPATH=${BUILD_DIR}/gopath
  45. mkdir -p ${GOPATH}/bin
  46. export PATH_orig=${PATH}
  47. export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  48. export ARCHS='386 amd64'
  49. export GO111MODULE=on
  50. # Make release tarball
  51. pushd tendermint
  52. VERSION=$(git describe --tags | sed 's/^v//')
  53. COMMIT=$(git rev-parse --short=8 HEAD)
  54. DISTNAME=tendermint-${VERSION}
  55. git archive --format tar.gz --prefix ${DISTNAME}/ -o ${DISTNAME}.tar.gz HEAD
  56. SOURCEDIST=`pwd`/`echo tendermint-*.tar.gz`
  57. popd
  58. # Correct tar file order
  59. mkdir -p temp
  60. pushd temp
  61. tar xf $SOURCEDIST
  62. rm $SOURCEDIST
  63. find tendermint-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > $SOURCEDIST
  64. popd
  65. # Prepare GOPATH and install deps
  66. distsrc=${GOPATH}/src/github.com/tendermint/tendermint
  67. mkdir -p ${distsrc}
  68. pushd ${distsrc}
  69. tar --strip-components=1 -xf $SOURCEDIST
  70. go mod download
  71. popd
  72. # Configure LDFLAGS for reproducible builds
  73. LDFLAGS="-extldflags=-static -buildid=${VERSION} -s -w \
  74. -X github.com/tendermint/tendermint/version.GitCommit=${COMMIT}"
  75. # Extract release tarball and build
  76. for arch in ${ARCHS}; do
  77. INSTALLPATH=`pwd`/installed/${DISTNAME}-${arch}
  78. mkdir -p ${INSTALLPATH}
  79. # Build tendermint binary
  80. pushd ${distsrc}
  81. GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \
  82. -gcflags=all=-trimpath=${GOPATH} \
  83. -asmflags=all=-trimpath=${GOPATH} \
  84. -mod=readonly -tags "tendermint" \
  85. -ldflags="${LDFLAGS}" \
  86. -o ${INSTALLPATH}/tendermint ./cmd/tendermint/
  87. popd # ${distsrc}
  88. pushd ${INSTALLPATH}
  89. find -type f | sort | tar \
  90. --no-recursion --mode='u+rw,go+r-w,a+X' \
  91. --numeric-owner --sort=name \
  92. --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-darwin-${arch}.tar.gz
  93. popd # installed
  94. done
  95. rm -rf ${distsrc}
  96. mkdir -p $OUTDIR/src
  97. mv $SOURCEDIST $OUTDIR/src