@ -34,83 +34,81 @@ endif
binaries = tendermint basecoin ethermint
build-binaries = build-tendermint build-basecoin build-ethermint
package-binaries = package-tendermint package-basecoin package-ethermint
install-binaries = install-tendermint install-basecoin install-ethermint
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint
all : $( binaries )
build : $( build -binaries )
package : $( package -binaries )
install : $( install -binaries )
$(binaries) : %: build -% package -% install -% ;
package : $( package -rpm ) $( package -deb )
install : $( install -rpm ) $( install -deb )
$(binaries) : %: build -% package -rpm - % install -rpm -% package -deb -% install -deb -% ;
###
# Building the binaries is not in the spec file, because in the spec file you already need to know the version number
###
build-tendermint :
$( info Building tendermint)
@echo "*** Building tendermint"
go get -u github.com/tendermint/tendermint/cmd/tendermint
@echo "*** Built tendermint"
build-basecoin :
$( info Building basecoin)
@echo "*** Building basecoin"
go get -u github.com/tendermint/basecoin/cmd/basecoin
$( info Building basecli)
@echo "Building basecli"
$( MAKE) -C $( GOPATH) /src/github.com/tendermint/basecoin get_vendor_deps
go get -u github.com/tendermint/basecoin/cmd/basecli
@echo "*** Built basecoin"
build-ethermint :
$( info Building ethermint)
@echo "*** Building ethermint"
go get -d -u github.com/tendermint/ethermint/cmd/ethermint
$( MAKE) -C $( GOPATH) /src/github.com/tendermint/ethermint get_vendor_deps
$( MAKE) -C $( GOPATH) /src/github.com/tendermint/ethermint build
cp $( GOPATH) /src/github.com/tendermint/ethermint/build/ethermint $( GOPATH) /bin
@echo "*** Built ethermint"
prepare-spec-% : $( GOPATH ) /bin /%
$( info Preparing build for $* )
version-% : $( GOPATH ) /bin /%
if [ -z " $( BUILD_NUMBER) " ] ; then echo "BUILD_NUMBER not set" ; false ; fi
mkdir -p { SPECS,tmp}
$( eval $* _version = $( shell $< version | cut -d- -f1 ) )
prepare-spec-% : version -%
mkdir -p { SPECS,tmp}
echo " Version: $( $* _version) " > SPECS/$* .spec
echo " Release: $( BUILD_NUMBER) " >> SPECS/$* .spec
cat spectemplates/$* .spec >> SPECS/$* .spec
package-tendermint : prepare -spec -tendermint
$( info Packaging tendermint version $( tendermint_version) )
rpmbuild -bb SPECS/tendermint.spec
./sign RPMS/x86_64/tendermint-$( tendermint_version) -$$ BUILD_NUMBER.x86_64.rpm
rpm -Kv RPMS/x86_64/tendermint-$( tendermint_version) -$$ BUILD_NUMBER.x86_64.rpm
package-basecoin : prepare -spec -basecoin
$( info Packaging basecoin version $( basecoin_version) )
rpmbuild -bb SPECS/basecoin.spec
./sign RPMS/x86_64/basecoin-$( basecoin_version) -$$ BUILD_NUMBER.x86_64.rpm
rpm -Kv RPMS/x86_64/basecoin-$( basecoin_version) -$$ BUILD_NUMBER.x86_64.rpm
package-ethermint : prepare -spec -ethermint ;
$( info Packaging ethermint version $( ethermint_version) )
rpmbuild -bb SPECS/ethermint.spec
./sign RPMS/x86_64/ethermint-$( ethermint_version) -$$ BUILD_NUMBER.x86_64.rpm
rpm -Kv RPMS/x86_64/ethermint-$( ethermint_version) -$$ BUILD_NUMBER.x86_64.rpm
package-debian-tendermint : package -tendermint
$( info Packaging Debian tendermint version $( tendermint_version) -$( BUILD_NUMBER) )
rm -rf BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) tmp/_gpg tmp/_gpgbuilder tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz
cp -r BUILD/tendermint-$( tendermint_version) BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER)
cp -r extrafiles/DEBIAN BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /
sed -i " s/@TENDERMINT_VERSION@/ $( tendermint_version) - $( BUILD_NUMBER) / " BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i "s/@STABILITY@/stable/" BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i "s/@DATETIMESTAMP@/`date +%a,\ %d\ %b\ %Y\ %T\ %z`/" BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i " s/@TENDERMINT_VERSION@/ $( tendermint_version) - $( BUILD_NUMBER) / " BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/control
rm -rf BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /usr/share/licenses
mkdir -p BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /usr/share/doc/tendermint
cp BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/copyright BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /usr/share/doc/tendermint
gzip -c BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/changelog > BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /usr/share/doc/tendermint/changelog.Debian.gz
gzip -c BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/changelog > BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /usr/share/doc/tendermint/changelog.Debian.amd64.gz
sed -i " s/@INSTALLEDSIZE@/`du -ks BUILD/tendermint- $( tendermint_version) - $( BUILD_NUMBER) | cut -f 1`/ " BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN/control
cd BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) && tar --owner= root --group= root -cvJf ../../tmp/data.tar.xz --exclude DEBIAN *
cd BUILD/tendermint-$( tendermint_version) -$( BUILD_NUMBER) /DEBIAN && tar --owner= root --group= root -cvzf ../../../tmp/control.tar.gz *
package-rpm-% : prepare -spec -%
@echo " *** Packaging RPM $* version $( $* _version) "
rpmbuild -bb SPECS/$* .spec
./sign RPMS/x86_64/$* -$( $* _version) -$( BUILD_NUMBER) .x86_64.rpm
rpm -Kv RPMS/x86_64/$* -$( $* _version) -$( BUILD_NUMBER) .x86_64.rpm
@echo " *** Packaged RPM $* version $( $* _version) "
package-deb-% : version -%
@echo " *** Packaging DEB $* version $( $* _version) - $( BUILD_NUMBER) "
echo " BUILD/ $* - $( $* _version) folder is generated by package-rpm- $* "
test -d BUILD/$* -$( $* _version)
rm -rf BUILD/$* -$( $* _version) -$( BUILD_NUMBER) tmp/_gpg tmp/_gpgbuilder tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz
cp -r BUILD/$* -$( $* _version) BUILD/$* -$( $* _version) -$( BUILD_NUMBER)
cp -r extrafiles/DEBIAN-$* BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN
sed -i " s/@VERSION@/ $( $* _version) - $( BUILD_NUMBER) / " BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i "s/@STABILITY@/stable/" BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i "s/@DATETIMESTAMP@/`date +%a,\ %d\ %b\ %Y\ %T\ %z`/" BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/changelog
sed -i " s/@VERSION@/ $( $* _version) - $( BUILD_NUMBER) / " BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/control
rm -rf BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /usr/share/licenses
mkdir -p BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /usr/share/doc/$*
cp BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/copyright BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /usr/share/doc/$*
gzip -c BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/changelog > BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /usr/share/doc/$* /changelog.Debian.gz
gzip -c BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/changelog > BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /usr/share/doc/$* /changelog.Debian.amd64.gz
sed -i " s/@INSTALLEDSIZE@/`du -ks BUILD/ $* - $( $* _version) - $( BUILD_NUMBER) | cut -f 1`/ " BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/control
cd BUILD/$* -$( $* _version) -$( BUILD_NUMBER) && tar --owner= root --group= root -cvJf ../../tmp/data.tar.xz --exclude DEBIAN *
cd BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN && tar --owner= root --group= root -cvzf ../../../tmp/control.tar.gz *
echo "2.0" > tmp/debian-binary
cp extrafiles/_gpg tmp/
@ -126,46 +124,73 @@ package-debian-tendermint: package-tendermint
cd tmp && sed -i "s/@DATSIZE@/`stat -c %s data.tar.xz | cut -d\ -f1`/" _gpg
gpg --batch --passphrase " $( GPG_PASSPHRASE) " --clearsign tmp/_gpg
mv tmp/_gpg.asc tmp/_gpgbuilder
ar r tmp/tendermint-$( tendermint _version) -$( BUILD_NUMBER) _amd64.deb tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder
mv tmp/tendermint-$( tendermint _version) -$( BUILD_NUMBER) _amd64.deb RPMS/
ar r tmp/$* -$( $* _version) -$( BUILD_NUMBER) _amd64.deb tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder
mv tmp/$* -$( $* _version) -$( BUILD_NUMBER) _amd64.deb RPMS/
rm tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder tmp/_gpg
@echo " *** Packaged DEB $* version $( $* _version) - $( BUILD_NUMBER) "
install-% :
install-rpm- % : version -%
#Make sure your host has the IAM role to read/write the S3 bucket OR that you set up ~/.boto
@echo " *** Uploading $* - $( $* _version) - $( BUILD_NUMBER) .x86_64.rpm to AWS CentOS repository "
aws s3 sync s3://tendermint-packages/centos/ tmp/s3/
mkdir -p tmp/s3/7/os/x86_64/Packages
cp -r RPMS/x86_64/$* * tmp/s3/7/os/x86_64/Packages
cp RPMS/x86_64/$* -$( $ * _version) -$( BUILD_NUMBER) .x86_64.rpm tmp/s3/7/os/x86_64/Packages
cp repofiles/RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
cp repofiles/tendermint.repo tmp/s3/7/os/x86_64/
createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint
rm -rf tmp/s3/7/os/x86_64/repodata
rm -f tmp/s3/7/os/x86_64/repodata/repomd.xml.asc
createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint
gpg --batch --passphrase " $( GPG_PASSPHRASE) " --sign -a tmp/s3/7/os/x86_64/repodata/repomd.xml
aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --acl public-read
@echo " *** Uploaded $* to AWS CentOS repository "
install-debian-tendermint : prepare -spec -tendermint
#Prereq: package-debian-tendermint
install-deb-% : version -%
@echo " *** Uploading $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb to AWS Debian repository "
@echo " Testing if $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb is already uploaded "
test ! -f tmp/debian-s3/pool/$* -$( $* _version) -$( BUILD_NUMBER) _amd64.deb
aws s3 sync s3://tendermint-packages/debian/ tmp/debian-s3/
@echo " Testing if $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb is already uploaded "
test ! -f tmp/debian-s3/pool/$* -$( $* _version) -$( BUILD_NUMBER) _amd64.deb
mkdir -p tmp/debian-s3/pool tmp/debian-s3/dists/stable/main/binary-amd64
cp RPMS/tendermint-$( tendermint_version) -$( BUILD_NUMBER) _amd64.deb tmp/debian-s3/pool
cp RPMS/$* -$( $* _version) -$( BUILD_NUMBER) _amd64.deb tmp/debian-s3/pool
cp repofiles/Release_amd64 tmp/debian-s3/dists/stable/main/binary-amd64/Release
#Package.gz
test -f tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz && gunzip tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz || rm -f tmp/debian-s3/dists/stable/main/binary-amd64/Package
#Packages / Packages.gz
echo > tmp/Package
echo " Filename: pool/tendermint- $( tendermint _version) - $( BUILD_NUMBER) _amd64.deb " >> tmp/Package
echo " MD5sum: `md5sum RPMS/tendermint- $( tendermint _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " SHA1: `sha1sum RPMS/tendermint- $( tendermint _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " SHA256: `sha256sum RPMS/tendermint- $( tendermint _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " Size: `stat -c %s RPMS/tendermint- $( tendermint _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
cat BUILD/tendermint-$( tendermint _version) -$( BUILD_NUMBER) /DEBIAN/control >> tmp/Package
echo " Filename: pool/ $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb " >> tmp/Package
echo " MD5sum: `md5sum RPMS/ $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " SHA1: `sha1sum RPMS/ $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " SHA256: `sha256sum RPMS/ $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
echo " Size: `stat -c %s RPMS/ $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb | cut -d\ -f 1` " >> tmp/Package
cat BUILD/$* -$( $* _version) -$( BUILD_NUMBER) /DEBIAN/control >> tmp/Package
cat tmp/Package >> tmp/debian-s3/dists/stable/main/binary-amd64/Packages
gzip tmp/debian-s3/dists/stable/main/binary-amd64/Packages
rm -f tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz
gzip -c tmp/debian-s3/dists/stable/main/binary-amd64/Packages > tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz
rm -f tmp/Package
#Release / InRelease / Release.gpg
cp repofiles/Release tmp/debian-s3/dists/stable
#main / Release / InRelease / Release.gpg
cp repofiles/Release tmp/debian-s3/dists/stable/main/Release
rm -f tmp/debian-s3/dists/stable/main/InRelease
rm -f tmp/debian-s3/dists/stable/main/Release.gpg
echo "MD5Sum:" >> tmp/debian-s3/dists/stable/main/Release
cd tmp/debian-s3/dists/stable/main && for f in ` find . -type f | sed 's/^.\///' ` ; do test " $$ f " = = "Release" && continue ; echo -n " " ; md5sum $$ f | sed " s/ / `stat -c %s $$ f` / " ; done >> Release
echo "SHA1:" >> tmp/debian-s3/dists/stable/main/Release
cd tmp/debian-s3/dists/stable/main && for f in ` find . -type f | sed 's/^.\///' ` ; do test " $$ f " = = "Release" && continue ; echo -n " " ; sha1sum $$ f | sed " s/ / `stat -c %s $$ f` / " ; done >> Release
echo "SHA256:" >> tmp/debian-s3/dists/stable/main/Release
cd tmp/debian-s3/dists/stable/main && for f in ` find . -type f | sed 's/^.\///' ` ; do test " $$ f " = = "Release" && continue ; echo -n " " ; sha256sum $$ f | sed " s/ / `stat -c %s $$ f` / " ; done >> Release
gpg --batch --passphrase " $( GPG_PASSPHRASE) " --digest-algo SHA256 -b -a tmp/debian-s3/dists/stable/main/Release
mv tmp/debian-s3/dists/stable/main/Release.asc tmp/debian-s3/dists/stable/main/Release.gpg
gpg --batch --passphrase " $( GPG_PASSPHRASE) " --digest-algo SHA512 --clearsign tmp/debian-s3/dists/stable/main/Release
mv tmp/debian-s3/dists/stable/main/Release.asc tmp/debian-s3/dists/stable/main/InRelease
#stable / Release / InRelease / Release.gpg
cp repofiles/Release tmp/debian-s3/dists/stable/Release
rm -f tmp/debian-s3/dists/stable/InRelease
rm -f tmp/debian-s3/dists/stable/Release.gpg
@ -182,6 +207,7 @@ install-debian-tendermint: prepare-spec-tendermint
mv tmp/debian-s3/dists/stable/Release.asc tmp/debian-s3/dists/stable/InRelease
aws s3 sync tmp/debian-s3/ s3://tendermint-packages/debian/ --acl public-read
@echo " *** Uploaded $* - $( $* _version) - $( BUILD_NUMBER) _amd64.deb to AWS Debian repository "
mostlyclean :
rm -rf { BUILDROOT,SOURCES,SPECS,SRPMS,tmp}