windows build: separate 32/64 bit build caches
specify which architecture to target by setting WIN_ARCH env var
This commit is contained in:
@@ -5,31 +5,43 @@ set -e
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
test -n "$here" -a -d "$here" || exit
|
||||
|
||||
export CONTRIB="$here/.."
|
||||
export PROJECT_ROOT="$CONTRIB/.."
|
||||
export CACHEDIR="$here/.cache"
|
||||
export PIP_CACHE_DIR="$CACHEDIR/pip_cache"
|
||||
if [ -z "$WIN_ARCH" ] ; then
|
||||
export WIN_ARCH="win32" # default
|
||||
fi
|
||||
if [ "$WIN_ARCH" = "win32" ] ; then
|
||||
export GCC_TRIPLET_HOST="i686-w64-mingw32"
|
||||
elif [ "$WIN_ARCH" = "win64" ] ; then
|
||||
export GCC_TRIPLET_HOST="x86_64-w64-mingw32"
|
||||
else
|
||||
echo "unexpected WIN_ARCH: $WIN_ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export BUILD_TYPE="wine"
|
||||
export GCC_TRIPLET_HOST="i686-w64-mingw32" # make sure to clear caches if changing this
|
||||
export GCC_TRIPLET_BUILD="x86_64-pc-linux-gnu"
|
||||
export GCC_STRIP_BINARIES="1"
|
||||
|
||||
export CONTRIB="$here/.."
|
||||
export PROJECT_ROOT="$CONTRIB/.."
|
||||
export CACHEDIR="$here/.cache/$WIN_ARCH"
|
||||
export PIP_CACHE_DIR="$CACHEDIR/pip_cache"
|
||||
export DLL_TARGET_DIR="$CACHEDIR/dlls"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "Clearing $here/build and $here/dist..."
|
||||
rm "$here"/build/* -rf
|
||||
rm "$here"/dist/* -rf
|
||||
|
||||
mkdir -p "$CACHEDIR" "$PIP_CACHE_DIR"
|
||||
mkdir -p "$CACHEDIR" "$DLL_TARGET_DIR" "$PIP_CACHE_DIR"
|
||||
|
||||
if [ -f "$PROJECT_ROOT/electrum/libsecp256k1-0.dll" ]; then
|
||||
if [ -f "$DLL_TARGET_DIR/libsecp256k1-0.dll" ]; then
|
||||
info "libsecp256k1 already built, skipping"
|
||||
else
|
||||
"$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp"
|
||||
fi
|
||||
|
||||
if [ -f "$PROJECT_ROOT/electrum/libzbar-0.dll" ]; then
|
||||
if [ -f "$DLL_TARGET_DIR/libzbar-0.dll" ]; then
|
||||
info "libzbar already built, skipping"
|
||||
else
|
||||
"$CONTRIB"/make_zbar.sh || fail "Could not build zbar"
|
||||
|
||||
@@ -43,19 +43,19 @@ info "Installing Python."
|
||||
# keys from https://www.python.org/downloads/#pubkeys
|
||||
KEYRING_PYTHON_DEV="keyring-electrum-build-python-dev.gpg"
|
||||
gpg --no-default-keyring --keyring $KEYRING_PYTHON_DEV --import "$here"/gpg_keys/7ED10B6531D7C8E1BC296021FC624643487034E5.asc
|
||||
if [ "$GCC_TRIPLET_HOST" = "i686-w64-mingw32" ] ; then
|
||||
ARCH="win32"
|
||||
elif [ "$GCC_TRIPLET_HOST" = "x86_64-w64-mingw32" ] ; then
|
||||
ARCH="amd64"
|
||||
if [ "$WIN_ARCH" = "win32" ] ; then
|
||||
PYARCH="win32"
|
||||
elif [ "$WIN_ARCH" = "win64" ] ; then
|
||||
PYARCH="amd64"
|
||||
else
|
||||
fail "unexpected GCC_TRIPLET_HOST: $GCC_TRIPLET_HOST"
|
||||
fail "unexpected WIN_ARCH: $WIN_ARCH"
|
||||
fi
|
||||
PYTHON_DOWNLOADS="$CACHEDIR/python$PYTHON_VERSION-$ARCH"
|
||||
PYTHON_DOWNLOADS="$CACHEDIR/python$PYTHON_VERSION"
|
||||
mkdir -p "$PYTHON_DOWNLOADS"
|
||||
for msifile in core dev exe lib pip tools; do
|
||||
echo "Installing $msifile..."
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi" "https://www.python.org/ftp/python/$PYTHON_VERSION/$ARCH/${msifile}.msi"
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi.asc" "https://www.python.org/ftp/python/$PYTHON_VERSION/$ARCH/${msifile}.msi.asc"
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi" "https://www.python.org/ftp/python/$PYTHON_VERSION/$PYARCH/${msifile}.msi"
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi.asc" "https://www.python.org/ftp/python/$PYTHON_VERSION/$PYARCH/${msifile}.msi.asc"
|
||||
verify_signature "$PYTHON_DOWNLOADS/${msifile}.msi.asc" $KEYRING_PYTHON_DEV
|
||||
wine msiexec /i "$PYTHON_DOWNLOADS/${msifile}.msi" /qb TARGETDIR=$PYHOME
|
||||
done
|
||||
@@ -102,8 +102,8 @@ cp "$CACHEDIR/libusb/libusb/.libs/libusb-1.0.dll" $WINEPREFIX/drive_c/tmp/ || f
|
||||
|
||||
|
||||
# copy already built DLLs
|
||||
cp "$PROJECT_ROOT/electrum/libsecp256k1-0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libsecp to its destination"
|
||||
cp "$PROJECT_ROOT/electrum/libzbar-0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libzbar to its destination"
|
||||
cp "$DLL_TARGET_DIR/libsecp256k1-0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libsecp to its destination"
|
||||
cp "$DLL_TARGET_DIR/libzbar-0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libzbar to its destination"
|
||||
|
||||
|
||||
info "Building PyInstaller."
|
||||
@@ -136,12 +136,12 @@ info "Building PyInstaller."
|
||||
-Wno-error=stringop-truncation"
|
||||
popd
|
||||
# sanity check bootloader is there:
|
||||
if [ "$GCC_TRIPLET_HOST" = "i686-w64-mingw32" ] ; then
|
||||
if [ "$WIN_ARCH" = "win32" ] ; then
|
||||
[[ -e PyInstaller/bootloader/Windows-32bit/runw.exe ]] || fail "Could not find runw.exe in target dir! (32bit)"
|
||||
elif [ "$GCC_TRIPLET_HOST" = "x86_64-w64-mingw32" ] ; then
|
||||
elif [ "$WIN_ARCH" = "win64" ] ; then
|
||||
[[ -e PyInstaller/bootloader/Windows-64bit/runw.exe ]] || fail "Could not find runw.exe in target dir! (64bit)"
|
||||
else
|
||||
fail "unexpected GCC_TRIPLET_HOST: $GCC_TRIPLET_HOST"
|
||||
fail "unexpected WIN_ARCH: $WIN_ARCH"
|
||||
fi
|
||||
) || fail "PyInstaller build failed"
|
||||
info "Installing PyInstaller."
|
||||
|
||||
@@ -65,4 +65,7 @@ info "Building $pkgname..."
|
||||
host_strip "$here/$pkgname/dist/lib/$dlname"
|
||||
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$PROJECT_ROOT/electrum" || fail "Could not copy the $pkgname binary to its destination"
|
||||
info "$dlname has been placed in the inner 'electrum' folder."
|
||||
if [ -n "$DLL_TARGET_DIR" ] ; then
|
||||
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$DLL_TARGET_DIR" || fail "Could not copy the $pkgname binary to DLL_TARGET_DIR"
|
||||
fi
|
||||
)
|
||||
|
||||
@@ -93,4 +93,7 @@ info "Building $pkgname..."
|
||||
host_strip "$here/$pkgname/dist/lib/$dlname"
|
||||
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$PROJECT_ROOT/electrum" || fail "Could not copy the $pkgname binary to its destination"
|
||||
info "$dlname has been placed in the inner 'electrum' folder."
|
||||
if [ -n "$DLL_TARGET_DIR" ] ; then
|
||||
cp -fpv "$here/$pkgname/dist/lib/$dlname" "$DLL_TARGET_DIR" || fail "Could not copy the $pkgname binary to DLL_TARGET_DIR"
|
||||
fi
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user