make-release 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 'git archive --prefix "'"$sw"'/$path/" --format tar HEAD'
  34. } | tar -xivp
  35. cd "$sw"
  36. NOSUBMODULES=1 \
  37. NOCONFIGURE=1 \
  38. ./autogen.sh
  39. find . -name autom4te.cache |
  40. xargs rm -r
  41. cd ..
  42. zip -r "$OUTDIR/${sw}.zip" "$sw"
  43. tar cjvpf "$OUTDIR/${sw}.tbz2" "$sw"
  44. SRCDIR="$TMPDIR/$sw"
  45. dlls='
  46. backtrace.dll
  47. pdcurses.dll
  48. libcurl-4.dll
  49. libevent-2-0-5.dll
  50. libhidapi-0.dll
  51. pthreadGC2.dll
  52. libjansson-4.dll
  53. libusb-1.0.dll
  54. zlib1.dll
  55. '
  56. libmicrohttpd_dlls='
  57. libmicrohttpd-10.dll
  58. libplibc-1.dll
  59. '
  60. docs='
  61. AUTHORS
  62. COPYING
  63. NEWS
  64. README
  65. README.ASIC
  66. README.FPGA
  67. README.GPU
  68. README.RPC
  69. README.scrypt
  70. '
  71. for build in "${builds[@]}"; do
  72. PKGNAME="${sw}-${build}"
  73. PKGDIR="$TMPDIR/$PKGNAME"
  74. cd "$SRCDIR"
  75. mkdir -vp "$PKGDIR"
  76. for v in machine CFLAGS; do
  77. eval "${v}"="'$(eval echo "\${${build}_${v}}")'"
  78. done
  79. if test "x$DEBUG_RELEASE" = "x1"; then
  80. CFLAGS="${CFLAGS} -g"
  81. fi
  82. for doc in $docs; do
  83. sed 's/$/\r/' <"$doc" >"$PKGDIR/${doc}.txt"
  84. done
  85. ./configure \
  86. --prefix='C:\\Program Files\\BFGMiner\\' \
  87. CFLAGS="${CFLAGS} -Wall" \
  88. --disable-cpumining \
  89. --enable-opencl \
  90. --enable-adl \
  91. --enable-bitforce \
  92. --enable-icarus \
  93. --enable-modminer \
  94. --enable-ztex \
  95. --enable-scrypt \
  96. --host="$machine"
  97. make $MAKEOPTS
  98. if test "x$DEBUG_RELEASE" != "x1"; then
  99. "$machine"-strip \
  100. libblkmaker/.libs/*.dll \
  101. *.exe
  102. fi
  103. cp -v \
  104. *.exe \
  105. libblkmaker/.libs/*.dll \
  106. *.cl \
  107. example.conf \
  108. windows-build.txt \
  109. miner.php \
  110. "$PKGDIR/"
  111. mkdir "$PKGDIR/bitstreams"
  112. mydlls="$dlls"
  113. if "${machine}-objdump" -p bfgminer.exe | grep -q "DLL Name: libmicrohttpd"; then
  114. mydlls="$mydlls $libmicrohttpd_dlls"
  115. fi
  116. for dll in $mydlls; do
  117. libdir="/usr/$machine/usr/lib"
  118. [ -e "$libdir/$dll" ] ||
  119. libdir="/usr/$machine/usr/bin"
  120. [ -e "$libdir/$dll" ] ||
  121. continue
  122. cp -v -L "$libdir/$dll" "$PKGDIR"
  123. "$machine"-strip "$PKGDIR/$dll"
  124. done
  125. make clean
  126. cd "$PKGDIR/.."
  127. zip -r "$OUTDIR/$PKGNAME.zip" "$PKGNAME"
  128. done
  129. cd "$IDIR"