mac build: git clone pyinstaller to allow using custom commits
This allows more freedom than using releases from PyPI. (atm there is no released version that fixes https://github.com/pyinstaller/pyinstaller/pull/6701 ) Also, we now build the pyinstaller bootloader, just like in the windows build: one fewer binary blob to trust.
This commit is contained in:
@@ -100,6 +100,46 @@ python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-l
|
||||
-Ir ./contrib/deterministic-build/requirements-build-mac.txt \
|
||||
|| fail "Could not install build dependencies (mac)"
|
||||
|
||||
info "Installing some build-time deps for compilation..."
|
||||
brew install autoconf automake libtool gettext coreutils pkgconfig
|
||||
|
||||
info "Building PyInstaller."
|
||||
PYINSTALLER_REPO="https://github.com/pyinstaller/pyinstaller.git"
|
||||
PYINSTALLER_COMMIT="40c9abce2d8de879e414fd377c933dccaab1e156"
|
||||
# ^ tag "4.2"
|
||||
# TODO test newer versions of pyinstaller for build-reproducibility.
|
||||
# we are using this version for now due to change in code-signing behaviour
|
||||
# (https://github.com/pyinstaller/pyinstaller/pull/5581)
|
||||
(
|
||||
if [ -f "$CACHEDIR/pyinstaller/PyInstaller/bootloader/Darwin-64bit/runw" ]; then
|
||||
info "pyinstaller already built, skipping"
|
||||
exit 0
|
||||
fi
|
||||
cd "$PROJECT_ROOT"
|
||||
ELECTRUM_COMMIT_HASH=$(git rev-parse HEAD)
|
||||
cd "$CACHEDIR"
|
||||
rm -rf pyinstaller
|
||||
mkdir pyinstaller
|
||||
cd pyinstaller
|
||||
# Shallow clone
|
||||
git init
|
||||
git remote add origin $PYINSTALLER_REPO
|
||||
git fetch --depth 1 origin $PYINSTALLER_COMMIT
|
||||
git checkout -b pinned "${PYINSTALLER_COMMIT}^{commit}"
|
||||
rm -fv PyInstaller/bootloader/Darwin-*/run* || true
|
||||
# add reproducible randomness. this ensures we build a different bootloader for each commit.
|
||||
# if we built the same one for all releases, that might also get anti-virus false positives
|
||||
echo "const char *electrum_tag = \"tagged by Electrum@$ELECTRUM_COMMIT_HASH\";" >> ./bootloader/src/pyi_main.c
|
||||
pushd bootloader
|
||||
# compile bootloader
|
||||
python3 ./waf all CFLAGS="-static"
|
||||
popd
|
||||
# sanity check bootloader is there:
|
||||
[[ -e "PyInstaller/bootloader/Darwin-64bit/runw" ]] || fail "Could not find runw in target dir!"
|
||||
) || fail "PyInstaller build failed"
|
||||
info "Installing PyInstaller."
|
||||
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location "$CACHEDIR/pyinstaller"
|
||||
|
||||
info "Using these versions for building $PACKAGE:"
|
||||
sw_vers
|
||||
python3 --version
|
||||
@@ -130,9 +170,6 @@ info "generating locale"
|
||||
) || fail "failed generating locale"
|
||||
|
||||
|
||||
info "Installing some build-time deps for compilation..."
|
||||
brew install autoconf automake libtool gettext coreutils pkgconfig
|
||||
|
||||
if [ ! -f "$PROJECT_ROOT"/electrum/libsecp256k1.0.dylib ]; then
|
||||
info "Building libsecp256k1 dylib..."
|
||||
"$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp"
|
||||
|
||||
Reference in New Issue
Block a user