make-release 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. cd ..
  39. zip -r "$OUTDIR/${sw}.zip" "$sw"
  40. tar cjvpf "$OUTDIR/${sw}.tbz2" "$sw"
  41. SRCDIR="$TMPDIR/$sw"
  42. dlls='
  43. backtrace.dll
  44. pdcurses.dll
  45. libcurl-4.dll
  46. pthreadGC2.dll
  47. libjansson-4.dll
  48. libusb-1.0.dll
  49. zlib1.dll
  50. '
  51. docs='
  52. AUTHORS
  53. COPYING
  54. NEWS
  55. README
  56. API-README
  57. FPGA-README
  58. SCRYPT-README
  59. '
  60. for build in "${builds[@]}"; do
  61. PKGNAME="${sw}-${build}"
  62. PKGDIR="$TMPDIR/$PKGNAME"
  63. cd "$TMPDIR"
  64. mkdir -vp "$PKGDIR"
  65. for v in machine CFLAGS; do
  66. eval "${v}"="'$(eval echo "\${${build}_${v}}")'"
  67. done
  68. libdir="/usr/$machine/usr/bin/$dll"
  69. for dll in $dlls; do
  70. libdir="/usr/$machine/usr/lib"
  71. [ -e "$libdir/$dll" ] ||
  72. libdir="/usr/$machine/usr/bin"
  73. cp -v -L "$libdir/$dll" "$PKGDIR"
  74. "$machine"-strip "$PKGDIR/$dll"
  75. done
  76. for doc in $docs; do
  77. sed 's/$/\r/' <"$doc" >"$PKGDIR/${doc}.txt"
  78. done
  79. cp -av "bitstreams" "$PKGDIR/"
  80. NOCONFIGURE=1 \
  81. ./autogen.sh
  82. ./configure \
  83. --prefix='C:\\Program Files\\BFGMiner\\' \
  84. CFLAGS="${CFLAGS} -Wall" \
  85. --disable-cpumining \
  86. --enable-opencl \
  87. --enable-adl \
  88. --enable-bitforce \
  89. --enable-icarus \
  90. --enable-modminer \
  91. --enable-ztex \
  92. --enable-scrypt \
  93. --host="$machine"
  94. make $MAKEOPTS
  95. "$machine"-strip \
  96. libblkmaker/.libs/*.dll \
  97. *.exe
  98. cp -v \
  99. *.exe \
  100. libblkmaker/.libs/*.dll \
  101. *.cl \
  102. example.conf \
  103. windows-build.txt \
  104. miner.php \
  105. "$PKGDIR/"
  106. make clean
  107. cd "$PKGDIR/.."
  108. zip -r "$OUTDIR/$PKGNAME.zip" "$PKGNAME"
  109. done
  110. cd "$IDIR"