release.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/usr/bin/env bash
  2. #------------------------------------------------------------------------------
  3. # Bash script implementing release flow for cpp-ethereum for Linux and macOS.
  4. #
  5. # TODO - At the time of writing, we only have ZIPs working. Need to hook up
  6. # support for Homebrew and PPAs.
  7. #
  8. # The documentation for cpp-ethereum is hosted at http://cpp-ethereum.org
  9. #
  10. # ------------------------------------------------------------------------------
  11. # This file is part of cpp-ethereum.
  12. #
  13. # cpp-ethereum is free software: you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation, either version 3 of the License, or
  16. # (at your option) any later version.
  17. #
  18. # cpp-ethereum is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>
  25. #
  26. # (c) 2016 cpp-ethereum contributors.
  27. #------------------------------------------------------------------------------
  28. set -e
  29. ZIP_SUFFIX=$1
  30. ZIP_TEMP_DIR=$(pwd)/zip/
  31. TESTS=$2
  32. if [[ "$OSTYPE" == "darwin"* ]]; then
  33. DLL_EXT=dylib
  34. else
  35. DLL_EXT=so
  36. fi
  37. mkdir -p $ZIP_TEMP_DIR
  38. # Copy all the cpp-ethereum executables into a temporary directory prior to ZIP creation
  39. cp bench/bench $ZIP_TEMP_DIR
  40. cp eth/eth $ZIP_TEMP_DIR
  41. cp ethkey/ethkey $ZIP_TEMP_DIR
  42. cp ethminer/ethminer $ZIP_TEMP_DIR
  43. cp ethvm/ethvm $ZIP_TEMP_DIR
  44. cp rlp/rlp $ZIP_TEMP_DIR
  45. if [[ "$TESTS" == "On" ]]; then
  46. cp test/testeth $ZIP_TEMP_DIR
  47. fi
  48. # Copy all the dynamic libraries into a temporary directory prior to ZIP creation.
  49. # There are a lot of these, and it would be great if we didn't have to worry about them.
  50. # There is work-in-progress to support static-linkage on the UNIX platforms, which
  51. # is most promising on Alpine Linux using musl. macOS doesn't support statically
  52. # linked binaries (ie. executables which make direct system calls to the kernel.
  53. #
  54. # See https://developer.apple.com/library/mac/qa/qa1118/_index.html.
  55. # See https://github.com/ethereum/webthree-umbrella/issues/495.
  56. cp libdevcore/*.$DLL_EXT $ZIP_TEMP_DIR
  57. cp libdevcrypto/*.$DLL_EXT $ZIP_TEMP_DIR
  58. cp libethash/*.$DLL_EXT $ZIP_TEMP_DIR
  59. cp libethash-cl/*.$DLL_EXT $ZIP_TEMP_DIR
  60. cp libethashseal/*.$DLL_EXT $ZIP_TEMP_DIR
  61. cp libethcore/*.$DLL_EXT $ZIP_TEMP_DIR
  62. cp libethereum/*.$DLL_EXT $ZIP_TEMP_DIR
  63. cp libevm/*.$DLL_EXT $ZIP_TEMP_DIR
  64. cp libevmcore/*.$DLL_EXT $ZIP_TEMP_DIR
  65. cp libp2p/*.$DLL_EXT $ZIP_TEMP_DIR
  66. cp libweb3jsonrpc/*.$DLL_EXT $ZIP_TEMP_DIR
  67. cp libwebthree/*.$DLL_EXT $ZIP_TEMP_DIR
  68. cp libwhisper/*.$DLL_EXT $ZIP_TEMP_DIR
  69. cp utils/libscrypt/*.$DLL_EXT $ZIP_TEMP_DIR
  70. # For macOS, we also copy the dynamic libraries for our external dependencies.
  71. # When building from source on your own machine, these libraries will be installed
  72. # globally, using Homebrew, but we don't want to rely on that for these ZIPs, so
  73. # we copy these into the ZIP temporary directory too.
  74. #
  75. # TODO - So what happens for Linux and other UNIX distros in this case?
  76. # There will be runtime dependencies on equivalent SO files being present, likely in
  77. # a completely analogous way. Does that mean that ZIPs are actually useless on such
  78. # distros, because there will be symbol links to global install locations (distro-specific)
  79. # and those files will just be missing on the target machines?
  80. if [[ "$OSTYPE" == "darwin"* ]]; then
  81. cp /usr/local/opt/cryptopp/lib/libcryptopp.dylib $ZIP_TEMP_DIR
  82. cp /usr/local/opt/gmp/lib/libgmp.10.dylib $ZIP_TEMP_DIR
  83. cp /usr/local/opt/jsoncpp/lib/libjsoncpp.1.dylib $ZIP_TEMP_DIR
  84. cp /usr/local/opt/leveldb/lib/libleveldb.1.dylib $ZIP_TEMP_DIR
  85. cp /usr/local/opt/libjson-rpc-cpp/lib/libjsonrpccpp-common.0.dylib $ZIP_TEMP_DIR
  86. cp /usr/local/opt/libjson-rpc-cpp/lib/libjsonrpccpp-client.0.dylib $ZIP_TEMP_DIR
  87. cp /usr/local/opt/libjson-rpc-cpp/lib/libjsonrpccpp-server.0.dylib $ZIP_TEMP_DIR
  88. cp /usr/local/opt/libmicrohttpd/lib/libmicrohttpd.12.dylib $ZIP_TEMP_DIR
  89. cp /usr/local/opt/miniupnpc/lib/libminiupnpc.16.dylib $ZIP_TEMP_DIR
  90. cp /usr/local/opt/snappy/lib/libsnappy.1.dylib $ZIP_TEMP_DIR
  91. fi
  92. # For macOS, we run a fix-up script which alters all of the symbolic links within
  93. # the executables and dynamic libraries such that the ZIP becomes self-contained, by
  94. # revectoring all the dylib references to be relative to the directory containing the
  95. # application, so that the ZIPs are self-contained, with the only external references
  96. # being for kernel-level dylibs.
  97. if [[ "$OSTYPE" == "darwin"* ]]; then
  98. python $(pwd)/../homebrew/fix_homebrew_paths_in_standalone_zip.py $ZIP_TEMP_DIR
  99. fi
  100. # And ZIP it all up, with a filename suffix passed in on the command-line.
  101. zip -j $(pwd)/../cpp-ethereum-develop-$ZIP_SUFFIX.zip $ZIP_TEMP_DIR/*