make-release 2.4 KB

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