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.

110 lines
2.8 KiB

  1. ---
  2. name: "tendermint-linux"
  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 GOROOT=${BUILD_DIR}/go
  43. export GOPATH=${BUILD_DIR}/gopath
  44. mkdir -p ${GOPATH}/bin
  45. export PATH_orig=${PATH}
  46. export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  47. export ARCHS='386 amd64 arm arm64'
  48. export GO111MODULE=on
  49. # Make release tarball
  50. pushd tendermint
  51. VERSION=$(git describe --tags | sed 's/^v//')
  52. COMMIT=$(git rev-parse --short=8 HEAD)
  53. DISTNAME=tendermint-${VERSION}
  54. git archive --format tar.gz --prefix ${DISTNAME}/ -o ${DISTNAME}.tar.gz HEAD
  55. SOURCEDIST=`pwd`/`echo tendermint-*.tar.gz`
  56. popd
  57. # Correct tar file order
  58. mkdir -p temp
  59. pushd temp
  60. tar xf $SOURCEDIST
  61. rm $SOURCEDIST
  62. find tendermint-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > $SOURCEDIST
  63. popd
  64. # Prepare GOPATH and install deps
  65. distsrc=${GOPATH}/src/github.com/tendermint/tendermint
  66. mkdir -p ${distsrc}
  67. pushd ${distsrc}
  68. tar --strip-components=1 -xf $SOURCEDIST
  69. go mod download
  70. popd
  71. # Configure LDFLAGS for reproducible builds
  72. LDFLAGS="-extldflags=-static -buildid=${VERSION} -s -w \
  73. -X github.com/tendermint/tendermint/version.GitCommit=${COMMIT}"
  74. # Extract release tarball and build
  75. for arch in ${ARCHS}; do
  76. INSTALLPATH=`pwd`/installed/${DISTNAME}-${arch}
  77. mkdir -p ${INSTALLPATH}
  78. # Build tendermint binary
  79. pushd ${distsrc}
  80. GOARCH=${arch} GOROOT_FINAL=${GOROOT} go build -a \
  81. -gcflags=all=-trimpath=${GOPATH} \
  82. -asmflags=all=-trimpath=${GOPATH} \
  83. -mod=readonly -tags "tendermint" \
  84. -ldflags="${LDFLAGS}" \
  85. -o ${INSTALLPATH}/tendermint ./cmd/tendermint/
  86. popd # ${distsrc}
  87. pushd ${INSTALLPATH}
  88. find -type f | sort | tar \
  89. --no-recursion --mode='u+rw,go+r-w,a+X' \
  90. --numeric-owner --sort=name \
  91. --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-linux-${arch}.tar.gz
  92. popd # installed
  93. done
  94. rm -rf ${distsrc}
  95. mkdir -p $OUTDIR/src
  96. mv $SOURCEDIST $OUTDIR/src