build.sh (1801B)
1 #!/bin/bash 2 3 set -e 4 5 here="$(dirname "$(readlink -e "$0")")" 6 test -n "$here" -a -d "$here" || exit 7 8 if [ -z "$WIN_ARCH" ] ; then 9 export WIN_ARCH="win32" # default 10 fi 11 if [ "$WIN_ARCH" = "win32" ] ; then 12 export GCC_TRIPLET_HOST="i686-w64-mingw32" 13 elif [ "$WIN_ARCH" = "win64" ] ; then 14 export GCC_TRIPLET_HOST="x86_64-w64-mingw32" 15 else 16 echo "unexpected WIN_ARCH: $WIN_ARCH" 17 exit 1 18 fi 19 20 export BUILD_TYPE="wine" 21 export GCC_TRIPLET_BUILD="x86_64-pc-linux-gnu" 22 export GCC_STRIP_BINARIES="1" 23 24 export CONTRIB="$here/.." 25 export PROJECT_ROOT="$CONTRIB/.." 26 export CACHEDIR="$here/.cache/$WIN_ARCH" 27 export PIP_CACHE_DIR="$CACHEDIR/wine_pip_cache" 28 export WINE_PIP_CACHE_DIR="c:/electrum/contrib/build-wine/.cache/$WIN_ARCH/wine_pip_cache" 29 export DLL_TARGET_DIR="$CACHEDIR/dlls" 30 31 export WINEPREFIX="/opt/wine64" 32 export WINEDEBUG=-all 33 export WINE_PYHOME="c:/python3" 34 export WINE_PYTHON="wine $WINE_PYHOME/python.exe -OO -B" 35 36 . "$CONTRIB"/build_tools_util.sh 37 38 info "Clearing $here/build and $here/dist..." 39 rm "$here"/build/* -rf 40 rm "$here"/dist/* -rf 41 42 mkdir -p "$CACHEDIR" "$DLL_TARGET_DIR" "$PIP_CACHE_DIR" 43 44 if [ -f "$DLL_TARGET_DIR/libsecp256k1-0.dll" ]; then 45 info "libsecp256k1 already built, skipping" 46 else 47 "$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp" 48 fi 49 50 if [ -f "$DLL_TARGET_DIR/libzbar-0.dll" ]; then 51 info "libzbar already built, skipping" 52 else 53 "$CONTRIB"/make_zbar.sh || fail "Could not build zbar" 54 fi 55 56 $here/prepare-wine.sh || fail "prepare-wine failed" 57 58 info "Resetting modification time in C:\Python..." 59 # (Because of some bugs in pyinstaller) 60 pushd /opt/wine64/drive_c/python* 61 find -exec touch -d '2000-11-11T11:11:11+00:00' {} + 62 popd 63 ls -l /opt/wine64/drive_c/python* 64 65 $here/build-electrum-git.sh || fail "build-electrum-git failed" 66 67 info "Done."