make-release 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #!/bin/bash
  2. # Copyright 2012-2013 Luke Dashjr
  3. #
  4. # This program is free software; you can redistribute it and/or modify it
  5. # under the terms of the GNU General Public License as published by the Free
  6. # Software Foundation; either version 3 of the License, or (at your option)
  7. # any later version. See COPYING for more details.
  8. set -e
  9. set -x
  10. tag="$1"; shift
  11. [ -n "$tag" ] || exit 1
  12. sw="$1"; shift || true
  13. [ -n "$sw" ] || sw="$tag"
  14. test -n "$DEBUG_RELEASE" || DEBUG_RELEASE=1
  15. builds=(win32 win64)
  16. win32_machine='i686-pc-mingw32'
  17. win32_CFLAGS='-march=i686'
  18. win64_machine='x86_64-w64-mingw32'
  19. win64_CFLAGS=''
  20. IDIR="$PWD"
  21. OUTDIR="$PWD"
  22. TMPROOT="$PWD/make-release-tmp"
  23. TMPDIR="${TMPROOT}/${sw}-tmp"
  24. mkdir -vp "$TMPDIR"
  25. # Source release
  26. git branch TMP "$tag"
  27. git clone . "$TMPDIR" -b TMP --depth 1
  28. git branch -D TMP
  29. cd "$TMPDIR"
  30. git submodule update --init
  31. {
  32. git archive --prefix "$sw"/ --format tar "$tag"
  33. git submodule --quiet foreach --recursive 'test x$name = xccan || git archive --prefix "'"$sw"'/$path/" --format tar HEAD'
  34. (
  35. cd ccan-upstream
  36. git archive --prefix "$sw/ccan-upstream/" --format tar HEAD ccan/{build_assert,cast,compiler,opt,typesafe_cb} licenses/{CC0,GPL-3,LGPL-2.1}
  37. )
  38. } | tar -xivp
  39. cd "$sw"
  40. NOSUBMODULES=1 \
  41. NOCONFIGURE=1 \
  42. ./autogen.sh
  43. find . -name autom4te.cache |
  44. xargs rm -r
  45. cd ..
  46. zip -r "$OUTDIR/${sw}.zip" "$sw"
  47. tar cjvpf "$OUTDIR/${sw}.tbz2" "$sw"
  48. SRCDIR="$TMPDIR/$sw"
  49. dlls='
  50. backtrace.dll
  51. pdcurses.dll
  52. libcurl-4.dll
  53. libevent-2-0-5.dll
  54. libhidapi-0.dll
  55. pthreadGC2.dll
  56. libjansson-4.dll
  57. libusb-1.0.dll
  58. zlib1.dll
  59. '
  60. libmicrohttpd_dlls='
  61. libmicrohttpd-10.dll
  62. libplibc-1.dll
  63. '
  64. docs='
  65. AUTHORS
  66. COPYING
  67. NEWS
  68. README
  69. README.ASIC
  70. README.FPGA
  71. README.GPU
  72. README.RPC
  73. README.scrypt
  74. '
  75. for build in "${builds[@]}"; do
  76. PKGNAME="${sw}-${build}"
  77. PKGDIR="$TMPDIR/$PKGNAME"
  78. cd "$TMPDIR"
  79. mkdir -vp "$PKGDIR"
  80. for v in machine CFLAGS; do
  81. eval "${v}"="'$(eval echo "\${${build}_${v}}")'"
  82. done
  83. if test "x$DEBUG_RELEASE" = "x1"; then
  84. CFLAGS="${CFLAGS} -g"
  85. fi
  86. for doc in $docs; do
  87. sed 's/$/\r/' <"$doc" >"$PKGDIR/${doc}.txt"
  88. done
  89. NOCONFIGURE=1 \
  90. ./autogen.sh
  91. ./configure \
  92. --prefix='C:\\Program Files\\BFGMiner\\' \
  93. CFLAGS="${CFLAGS} -Wall" \
  94. --disable-cpumining \
  95. --enable-opencl \
  96. --enable-adl \
  97. --enable-bitforce \
  98. --enable-icarus \
  99. --enable-modminer \
  100. --enable-ztex \
  101. --enable-scrypt \
  102. --host="$machine"
  103. make $MAKEOPTS
  104. if test "x$DEBUG_RELEASE" != "x1"; then
  105. "$machine"-strip \
  106. libblkmaker/.libs/*.dll \
  107. *.exe
  108. fi
  109. cp -v \
  110. *.exe \
  111. libblkmaker/.libs/*.dll \
  112. *.cl \
  113. example.conf \
  114. windows-build.txt \
  115. miner.php \
  116. "$PKGDIR/"
  117. mkdir "$PKGDIR/bitstreams"
  118. mydlls="$dlls"
  119. if "${machine}-objdump" -p bfgminer.exe | grep -q "DLL Name: libmicrohttpd"; then
  120. mydlls="$mydlls $libmicrohttpd_dlls"
  121. fi
  122. for dll in $mydlls; do
  123. libdir="/usr/$machine/usr/lib"
  124. [ -e "$libdir/$dll" ] ||
  125. libdir="/usr/$machine/usr/bin"
  126. [ -e "$libdir/$dll" ] ||
  127. continue
  128. cp -v -L "$libdir/$dll" "$PKGDIR"
  129. "$machine"-strip "$PKGDIR/$dll"
  130. done
  131. make clean
  132. cd "$PKGDIR/.."
  133. zip -r "$OUTDIR/$PKGNAME.zip" "$PKGNAME"
  134. done
  135. cd "$IDIR"