| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- #!/bin/bash
- # Copyright 2012-2014 Luke Dashjr
- #
- # This program is free software; you can redistribute it and/or modify it
- # under the terms of the GNU General Public License as published by the Free
- # Software Foundation; either version 3 of the License, or (at your option)
- # any later version. See COPYING for more details.
- set -e
- set -x
- tag="$1"; shift
- [ -n "$tag" ] || exit 1
- sw="$1"; shift || true
- [ -n "$sw" ] || sw="$tag"
- test -n "$DEBUG_RELEASE" || DEBUG_RELEASE=1
- builds=(win32 win64)
- win32_machine='i686-pc-mingw32'
- win32_CFLAGS='-march=i686'
- win64_machine='x86_64-w64-mingw32'
- win64_CFLAGS=''
- IDIR="$PWD"
- OUTDIR="$PWD"
- TMPROOT="$PWD/make-release-tmp"
- TMPDIR="${TMPROOT}/${sw}-tmp"
- mkdir -vp "$TMPDIR"
- # Source release
- git branch TMP "$tag"
- git clone . "$TMPDIR" -b TMP --depth 1
- git branch -D TMP
- cd "$TMPDIR"
- sed 's/^\[submodule "\(.*\)"\]$/\1/;t;d' .gitmodules |
- while read submodule; do
- git config submodule.$submodule.url "$IDIR/.git/modules/$submodule"
- done
- git submodule update --init
- {
- git archive --prefix "$sw"/ --format tar "$tag"
- git submodule --quiet foreach --recursive 'git archive --prefix "'"$sw"'/$path/" --format tar HEAD'
- } | tar -xivp
- cd "$sw"
- NOSUBMODULES=1 \
- NOCONFIGURE=1 \
- ./autogen.sh
- find . -name autom4te.cache |
- xargs rm -r
- cd ..
- zip -r "$OUTDIR/${sw}.zip" "$sw"
- tar cjvpf "$OUTDIR/${sw}.tbz2" "$sw"
- SRCDIR="$TMPDIR/$sw"
- docs='
- AUTHORS
- COPYING
- NEWS
- README
- README.ASIC
- README.FPGA
- README.GPU
- README.RPC
- README.scrypt
- '
- for build in "${builds[@]}"; do
- PKGNAME="${sw}-${build}"
- PKGDIR="$TMPDIR/$PKGNAME"
- cd "$SRCDIR"
- mkdir -vp "$PKGDIR"
- for v in machine CFLAGS; do
- eval "${v}"="'$(eval echo "\${${build}_${v}}")'"
- done
- if test "x$DEBUG_RELEASE" = "x1"; then
- CFLAGS="${CFLAGS} -g"
- fi
- for doc in $docs; do
- sed 's/$/\r/' <"$doc" >"$PKGDIR/${doc}.txt"
- done
-
- ./configure \
- --prefix='C:\\Program Files\\BFGMiner\\' \
- CFLAGS="${CFLAGS} -Wall" \
- --disable-cpumining \
- --enable-opencl \
- --enable-adl \
- --enable-bitforce \
- --enable-icarus \
- --enable-modminer \
- --enable-ztex \
- --enable-scrypt \
- --host="$machine"
- make $MAKEOPTS
- if test "x$DEBUG_RELEASE" != "x1"; then
- "$machine"-strip \
- libblkmaker/.libs/*.dll \
- *.exe
- fi
- cp -v \
- *.exe \
- libblkmaker/.libs/*.dll \
- *.cl \
- example.conf \
- windows-build.txt \
- miner.php \
- "$PKGDIR/"
- mkdir "$PKGDIR/bitstreams"
-
- ls "$PKGDIR" | grep '\.\(exe\|dll\)$' |
- perl -e '
- use strict;
- use warnings;
- use File::Basename;
- use File::Glob;
-
- my ($PKGDIR, $machine) = @ARGV;
- my @todo = map { chomp; $_ } <STDIN>;
- my %have = map { lc $_=>undef } (@todo, qw(
- advapi32.dll
- imagehlp.dll
- kernel32.dll
- msvcrt.dll
- setupapi.dll
- shell32.dll
- user32.dll
- winmm.dll
- ws2_32.dll
- wsock32.dll
- ));
- # Optional/dlopen libs
- push @todo, qw(
- backtrace.dll
- libhidapi-0.dll
- libfootest.dll
- );
- sub ciexist {
- my ($f) = @_;
- my $lcf = lc $f;
- for my $match (File::Glob::bsd_glob("${f}*", File::Glob::GLOB_CSH | File::Glob::GLOB_NOCASE)) {
- my $matchlc = lc $match;
- if ($matchlc eq $lcf) {
- return basename($match);
- }
- }
- undef
- }
- sub copydll {
- my ($dlllc, $opt) = @_;
- my $dll;
- my $libdir;
- for my $check_libdir (
- "/usr/$machine/usr/lib",
- "/usr/$machine/usr/bin",
- ) {
- $dll = ciexist "$check_libdir/${dlllc}";
- if ($dll) {
- $libdir = $check_libdir;
- last
- }
- }
- if (not defined $libdir) {
- return if $opt;
- die "Cannot find $dlllc\n"
- }
- system("cp -v -L \"$libdir/$dll\" \"$PKGDIR\"") && die "Copy $dll failed\n";
- system("\"${machine}-strip\" \"$PKGDIR/$dll\"") && die "Strip $dll failed\n";
- push @todo, $dll;
- $have{$dlllc} = undef;
- 1
- }
- while (my $c = shift @todo) {
- if (not ciexist "$PKGDIR/$c") {
- copydll $c, 1;
- # copydll will add it to @todo again if found
- next
- }
-
- my $found;
- print("Processing dependencies for ${c}...\n");
- my $objdump = `"${machine}-objdump" -p "${PKGDIR}/${c}"`;
- while ($objdump =~ /\G(?:\n|.)*?^\s*DLL Name\:\s*(.*)$/mg) {
- my $dlllc = lc $1;
- ++$found;
- next if exists $have{$dlllc};
-
- copydll $dlllc;
- }
- die "Failed to objdump $c\n" unless $found;
- }
- ' "$PKGDIR" "$machine"
-
- make clean
- cd "$PKGDIR/.."
- zip -r "$OUTDIR/$PKGNAME.zip" "$PKGNAME"
- done
- cd "$IDIR"
|