Browse Source

Merge pull request #7960 from SomberNight/202208_build_tighten3

mac build: `pip install --no-binary :all:` in more places (take 2)
patch-4
ghost43 2 years ago
committed by GitHub
parent
commit
2ac9c3c856
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      contrib/build-linux/appimage/make_appimage.sh
  2. 3
      contrib/osx/README.md
  3. 27
      contrib/osx/make_osx

12
contrib/build-linux/appimage/make_appimage.sh

@ -101,16 +101,20 @@ info "preparing electrum-locale."
info "Installing build dependencies." info "Installing build dependencies."
# note: re pip installing from PyPI,
# we prefer compiling C extensions ourselves, instead of using binary wheels,
# hence "--no-binary :all:" flags. However, we specifically allow
# - PyQt5, as it's harder to build from source
# - cryptography, as it's harder to build from source
# - the whole of "requirements-build-base.txt", which includes pip and friends, as it also includes "wheel",
# and I am not quite sure how to break the circular dependence there (I guess we could introduce
# "requirements-build-base-base.txt" with just wheel in it...)
"$python" -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ "$python" -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-base.txt" --cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-base.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \ "$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-appimage.txt" --cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements-build-appimage.txt"
info "installing electrum and its dependencies." info "installing electrum and its dependencies."
# note: we prefer compiling C extensions ourselves, instead of using binary wheels,
# hence "--no-binary :all:" flags. However, we specifically allow
# - PyQt5, as it's harder to build from source
# - cryptography, as building it would need openssl 1.1, not available on ubuntu 16.04
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \ "$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
--cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements.txt" --cache-dir "$PIP_CACHE_DIR" -r "$CONTRIB/deterministic-build/requirements.txt"
"$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --only-binary PyQt5,PyQt5-Qt5,cryptography --no-warn-script-location \ "$python" -m pip install --no-build-isolation --no-dependencies --no-binary :all: --only-binary PyQt5,PyQt5-Qt5,cryptography --no-warn-script-location \

3
contrib/osx/README.md

@ -57,6 +57,9 @@ Before starting, you should install [`brew`](https://brew.sh/).
$ xcrun --show-sdk-path $ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
``` ```
- Installing extraneous brew packages can result in build differences.
For example, pyinstaller seems to pick up and bundle brew-installed `libffi`.
So having a dedicated "electrum binary builder macOS VM" is recommended.
- Make sure that you are building from a fresh clone of electrum - Make sure that you are building from a fresh clone of electrum
(or run e.g. `git clean -ffxd` to rm all local changes). (or run e.g. `git clean -ffxd` to rm all local changes).

27
contrib/osx/make_osx

@ -4,6 +4,7 @@ set -e
# Parameterize # Parameterize
PYTHON_VERSION=3.9.11 PYTHON_VERSION=3.9.11
PY_VER_MAJOR="3.9" # as it appears in fs paths
PACKAGE=Electrum PACKAGE=Electrum
GIT_REPO=https://github.com/spesmilo/electrum GIT_REPO=https://github.com/spesmilo/electrum
@ -93,13 +94,23 @@ source $VENV_DIR/bin/activate
# don't add debug info to compiled C files (e.g. when pip calls setuptools/wheel calls gcc) # don't add debug info to compiled C files (e.g. when pip calls setuptools/wheel calls gcc)
# see https://github.com/pypa/pip/issues/6505#issuecomment-526613584 # see https://github.com/pypa/pip/issues/6505#issuecomment-526613584
# note: this does not seem sufficient when cython is involved (although it is on linux, just not on mac... weird.)
# see additional "strip" pass on built files later in the file.
export CFLAGS="-g0" export CFLAGS="-g0"
info "Installing build dependencies" info "Installing build dependencies"
# note: re pip installing from PyPI,
# we prefer compiling C extensions ourselves, instead of using binary wheels,
# hence "--no-binary :all:" flags. However, we specifically allow
# - PyQt5, as it's harder to build from source
# - cryptography, as it's harder to build from source
# - the whole of "requirements-build-base.txt", which includes pip and friends, as it also includes "wheel",
# and I am not quite sure how to break the circular dependence there (I guess we could introduce
# "requirements-build-base-base.txt" with just wheel in it...)
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \
-Ir ./contrib/deterministic-build/requirements-build-base.txt \ -Ir ./contrib/deterministic-build/requirements-build-base.txt \
|| fail "Could not install build dependencies (base)" || fail "Could not install build dependencies (base)"
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location \
-Ir ./contrib/deterministic-build/requirements-build-mac.txt \ -Ir ./contrib/deterministic-build/requirements-build-mac.txt \
|| fail "Could not install build dependencies (mac)" || fail "Could not install build dependencies (mac)"
@ -192,17 +203,20 @@ cp "$PROJECT_ROOT"/electrum/libusb-1.0.dylib "$CONTRIB"/osx
info "Installing requirements..." info "Installing requirements..."
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: \
--no-warn-script-location \
-Ir ./contrib/deterministic-build/requirements.txt \ -Ir ./contrib/deterministic-build/requirements.txt \
|| fail "Could not install requirements" || fail "Could not install requirements"
info "Installing hardware wallet requirements..." info "Installing hardware wallet requirements..."
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: --only-binary cryptography \
--no-warn-script-location \
-Ir ./contrib/deterministic-build/requirements-hw.txt \ -Ir ./contrib/deterministic-build/requirements-hw.txt \
|| fail "Could not install hardware wallet requirements" || fail "Could not install hardware wallet requirements"
info "Installing dependencies specific to binaries..." info "Installing dependencies specific to binaries..."
python3 -m pip install --no-build-isolation --no-dependencies --no-warn-script-location \ python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: --only-binary PyQt5,PyQt5-Qt5,cryptography \
--no-warn-script-location \
-Ir ./contrib/deterministic-build/requirements-binaries-mac.txt \ -Ir ./contrib/deterministic-build/requirements-binaries-mac.txt \
|| fail "Could not install dependencies specific to binaries" || fail "Could not install dependencies specific to binaries"
@ -210,6 +224,11 @@ info "Building $PACKAGE..."
python3 -m pip install --no-build-isolation --no-dependencies \ python3 -m pip install --no-build-isolation --no-dependencies \
--no-warn-script-location . > /dev/null || fail "Could not build $PACKAGE" --no-warn-script-location . > /dev/null || fail "Could not build $PACKAGE"
# strip debug symbols of some compiled libs
# - hidapi (hid.cpython-39-darwin.so) in particular is not reproducible without this
find "$VENV_DIR/lib/python$PY_VER_MAJOR/site-packages/" -type f -name '*.so' -print0 \
| xargs -0 -t strip -x
info "Faking timestamps..." info "Faking timestamps..."
find . -exec touch -t '200101220000' {} + || true find . -exec touch -t '200101220000' {} + || true

Loading…
Cancel
Save