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.

112 lines
3.8 KiB

  1. ##
  2. # Extra checks, because we do not use autoconf. Set extra_check to false if it is bothering you.
  3. ##
  4. extra_check = true
  5. go_min_version = 1.8.3
  6. gpg_key = 2122CBE9
  7. ifeq ($(extra_check),true)
  8. ifndef GOPATH
  9. $(error GOPATH not set)
  10. else
  11. go_version := $(shell go version | sed "s/^.* go\([0-9\.]*\) .*$$/\1/" )
  12. $(info Found go version $(go_version))
  13. go_version_check := $(shell echo -e "$(go_min_version)\n$(go_version)" | sort -V | head -1)
  14. ifneq ($(go_min_version),$(go_version_check))
  15. $(error go version go_min_version or above is required)
  16. endif
  17. endif
  18. gpg_check := $(shell gpg -K | grep '/$(gpg_key) ' | sed 's,^.*/\($(gpg_key)\) .*$$,\1,')
  19. ifneq ($(gpg_check),$(gpg_key))
  20. $(error GPG key not found. Add key ID $(gpg_key) to gpg-agent)
  21. else
  22. $(info GPG key $(gpg_key) found)
  23. endif
  24. endif
  25. ###
  26. # Here comes the real deal
  27. ###
  28. binaries = tendermint basecoin ethermint
  29. build-binaries = build-tendermint build-basecoin build-ethermint
  30. package-binaries = package-tendermint package-basecoin package-ethermint
  31. all: $(binaries)
  32. build: $(build-binaries)
  33. package: $(package-binaries)
  34. $(binaries): %: build-% package-% ;
  35. ###
  36. # Building the binaries is not in the spec file, because in the spec file you already need to know the version number
  37. ###
  38. build-tendermint:
  39. $(info Building tendermint)
  40. go get -u github.com/tendermint/tendermint/cmd/tendermint
  41. build-basecoin:
  42. $(info Building basecoin)
  43. go get -u github.com/tendermint/basecoin/cmd/basecoin
  44. $(info Building basecli)
  45. go get -u github.com/tendermint/basecoin/cmd/basecli
  46. build-ethermint:
  47. $(info Building ethermint)
  48. go get -d -u github.com/tendermint/ethermint/cmd/ethermint
  49. $(MAKE) -C $(GOPATH)/src/github.com/tendermint/ethermint get_vendor_deps
  50. $(MAKE) -C $(GOPATH)/src/github.com/tendermint/ethermint build
  51. cp $(GOPATH)/src/github.com/tendermint/ethermint/build/ethermint $(GOPATH)/bin
  52. prepare-spec-%: $(GOPATH)/bin/%
  53. $(info Preparing build for $*)
  54. if [ -z "$(BUILD_NUMBER)" ]; then echo "BUILD_NUMBER not set" ; false ; fi
  55. mkdir -p {SPECS,tmp}
  56. $(eval $*_version=$(shell $< version | cut -d- -f1 ))
  57. echo "Version: $($*_version)" > SPECS/$*.spec
  58. echo "Release: $(BUILD_NUMBER)" >> SPECS/$*.spec
  59. cat spectemplates/$*.spec >> SPECS/$*.spec
  60. package-tendermint: prepare-spec-tendermint
  61. $(info Packaging tendermint version $(tendermint_version))
  62. rpmbuild -bb SPECS/tendermint.spec --sign
  63. package-basecoin: prepare-spec-basecoin
  64. $(info Packaging basecoin version $(basecoin_version))
  65. rpmbuild -bb SPECS/basecoin.spec --sign
  66. package-ethermint: prepare-spec-ethermint ;
  67. $(info Packaging ethermint version $(ethermint_version))
  68. rpmbuild -bb SPECS/ethermint.spec --sign
  69. install-%:
  70. #Make sure your host has the IAM role to read/write the S3 bucket OR that you set up ~/.boto
  71. aws s3 sync s3://tendermint-packages/centos/ tmp/s3/
  72. mkdir -p tmp/s3/7/cr/x86_64/Packages
  73. cp -r RPMS/x86_64/$** tmp/s3/7/cr/x86_64/Packages
  74. cp ./RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
  75. cp ./tendermint.repo tmp/s3/7/os/x86_64/
  76. cp ./tendermint-dev.repo tmp/s3/7/cr/x86_64/
  77. createrepo tmp/s3/7/cr/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/cr/x86_64/Packages -o tmp/s3/7/cr/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint
  78. #Asks about overwrite
  79. gpg --clearsign tmp/s3/7/cr/x86_64/repodata/repomd.xml
  80. aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --acl public-read
  81. mostlyclean:
  82. rm -rf {BUILDROOT,SOURCES,SPECS,SRPMS,tmp}
  83. clean: mostlyclean
  84. rm -rf {BUILD,RPMS}
  85. distclean: clean
  86. rm -rf $(GOPATH)/src/github.com/tendermint/tendermint
  87. rm -rf $(GOPATH)/src/github.com/tendermint/basecoin
  88. rm -rf $(GOPATH)/src/github.com/tendermint/ethermint
  89. rm -rf $(GOPATH)/bin/tendermint
  90. rm -rf $(GOPATH)/bin/basecoin
  91. rm -rf $(GOPATH)/bin/basecli
  92. rm -rf $(GOPATH)/bin/ethermint
  93. .PHONY : clean