make-release 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. builds=(win32 win64)
  15. win32_machine='i686-pc-mingw32'
  16. win32_CFLAGS='-g -march=i686'
  17. win64_machine='x86_64-w64-mingw32'
  18. win64_CFLAGS='-g'
  19. IDIR="$PWD"
  20. OUTDIR="$PWD"
  21. TMPROOT="$PWD/make-release-tmp"
  22. TMPDIR="${TMPROOT}/${sw}-tmp"
  23. mkdir -vp "$TMPDIR"
  24. # Source release
  25. git branch TMP "$tag"
  26. git clone . "$TMPDIR" -b TMP --depth 1
  27. git branch -D TMP
  28. cd "$TMPDIR"
  29. git submodule update --init
  30. {
  31. git archive --prefix "$sw"/ --format tar "$tag"
  32. git submodule --quiet foreach --recursive 'git archive --prefix "'"$sw"'/$path/" --format tar HEAD'
  33. } | tar -xivp
  34. cd "$sw"
  35. NOSUBMODULES=1 \
  36. NOCONFIGURE=1 \
  37. ./autogen.sh
  38. find . -name autom4te.cache |
  39. xargs rm -r
  40. cd ..
  41. zip -r "$OUTDIR/${sw}.zip" "$sw"
  42. tar cjvpf "$OUTDIR/${sw}.tbz2" "$sw"
  43. SRCDIR="$TMPDIR/$sw"
  44. dlls='
  45. backtrace.dll
  46. pdcurses.dll
  47. libcurl-4.dll
  48. pthreadGC2.dll
  49. libjansson-4.dll
  50. libusb-1.0.dll
  51. zlib1.dll
  52. '
  53. docs='
  54. AUTHORS
  55. COPYING
  56. NEWS
  57. README
  58. README.ASIC
  59. README.Debian
  60. README.FPGA
  61. README.RPC
  62. README.scrypt
  63. '
  64. for build in "${builds[@]}"; do
  65. PKGNAME="${sw}-${build}"
  66. PKGDIR="$TMPDIR/$PKGNAME"
  67. cd "$TMPDIR"
  68. mkdir -vp "$PKGDIR"
  69. for v in machine CFLAGS; do
  70. eval "${v}"="'$(eval echo "\${${build}_${v}}")'"
  71. done
  72. libdir="/usr/$machine/usr/bin/$dll"
  73. for dll in $dlls; do
  74. libdir="/usr/$machine/usr/lib"
  75. [ -e "$libdir/$dll" ] ||
  76. libdir="/usr/$machine/usr/bin"
  77. cp -v -L "$libdir/$dll" "$PKGDIR"
  78. "$machine"-strip "$PKGDIR/$dll"
  79. done
  80. for doc in $docs; do
  81. sed 's/$/\r/' <"$doc" >"$PKGDIR/${doc}.txt"
  82. done
  83. NOCONFIGURE=1 \
  84. ./autogen.sh
  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. "$machine"-strip \
  99. libblkmaker/.libs/*.dll \
  100. *.exe
  101. cp -v \
  102. *.exe \
  103. libblkmaker/.libs/*.dll \
  104. *.cl \
  105. example.conf \
  106. windows-build.txt \
  107. miner.php \
  108. "$PKGDIR/"
  109. make clean
  110. cd "$PKGDIR/.."
  111. zip -r "$OUTDIR/$PKGNAME.zip" "$PKGNAME"
  112. done
  113. cd "$IDIR"