1
0

173 Commits

Author SHA1 Message Date
SomberNight
ffba6061bc contrib: "set -e" behaves weird in subshells followed by OR. don't use.
This exits as expected:
```
$ cat s1.sh
#!/bin/bash
set -e
(
    echo "a"
    false
    echo "b"
)

$ ./s1.sh
a
```
This does NOT exit, seemingly because of the outer context?!
```
$ cat s2.sh
#!/bin/bash
set -e
(
    echo "a"
    false
    echo "b"
) || echo "c"

$ ./s2.sh
a
b
```

ref https://unix.stackexchange.com/questions/65532/why-does-set-e-not-work-inside-subshells-with-parenthesis-followed-by-an-or
2025-09-25 14:04:14 +00:00
SomberNight
4a0a3bb38a contrib: shell scripts: add quotes around more variables 2025-09-02 17:33:06 +00:00
SomberNight
d9480fe339 contrib: add "set -e" to bash scripts where missing 2025-08-25 12:22:37 +00:00
ghost43
5cb844fc7c Merge pull request #9945 from f321x/osx_sign_self_signed_cert
build-osx: add docs for testing with self-signed certificate
2025-06-30 14:08:05 +00:00
SomberNight
02249e3992 win/mac build: don't exclude QtNetwork, as it is needed by QtMultimedia (used for camera)
fixes https://github.com/spesmilo/electrum/issues/9949

follow-up b6e4ec8f95
2025-06-13 14:22:34 +00:00
f321x
eb7e72fd42 build-osx: add docs for testing with self-signed certificate 2025-06-13 10:22:31 +02:00
ThomasV
7d9bcfa7af osx/extract_sigs: add more search paths for signed files
- pyinstaller 6.0 changed the file layout of macos binaries
    https://pyinstaller.org/en/stable/CHANGES.html#id81
    https://github.com/pyinstaller/pyinstaller/pull/7619
- this adapts the extract_sigs script to the new layout
2025-06-12 16:23:40 +00:00
SomberNight
c0b235a74e mac build: document "codesigning" and "notarization" 2025-06-12 13:20:27 +00:00
SomberNight
bc672fd2f4 mac build: compare_dmg: "hdiutil attach" to different paths
was experiencing some weird race, maybe hdiutil attach/detach is not blocking?
2025-06-12 13:09:26 +00:00
SomberNight
b6e4ec8f95 mac build: fix broken symlinks inside .app, due to rm-ed qt parts
probably since qt6 migration many symlinks inside the .app in bundled PyQt were broken:
```
$ cp -r $HOME/electrum/dist/Electrum.app Electrum-ghost3.app
cp: /Users/vagrant/electrum/dist/Electrum.app/Contents/Resources/PyQt6/Qt6/lib/QtMultimediaQuick.framework/QtMultimediaQuick: No such file or directory
cp: /Users/vagrant/electrum/dist/Electrum.app/Contents/Resources/PyQt6/Qt6/lib/QtQuickTimeline.framework/QtQuickTimeline: No such file or directory
cp: /Users/vagrant/electrum/dist/Electrum.app/Contents/Resources/PyQt6/Qt6/lib/QtQuickControls2.framework/QtQuickControls2: No such file or directory
```
We were stripping out lots of datas/binaries from Qt from the mac build artifact, leaving behind dangling symlinks.

Instead of adding more hacks on top of the current hacks to also rm the dangling links, I tried to clean up this blacklisting.

There was no issue re the Windows build, no symlinks there, but I like to keep these two spec files in sync.

-----

Some numbers:
- mac:
  - without any exclusions at all, the mac .dmg is 80 MiB.
  - with these exclusions it is 57 MiB.
- win:
  - (haven't built without exclusions.)
  - with the previous stripping strategy, exes were 68M/68M/50M
  - with these exclusions, exes are 66M/66M/50M
2025-06-11 21:35:44 +00:00
SomberNight
2645456130 build: pyinstaller: add type hint imports for spec namespace stuff
see cef4d530e3/PyInstaller/building/build_main.py (L1189)
2025-06-11 21:35:41 +00:00
SomberNight
a042eb9eac mac build: take control of pip's caching mechanism
just like in e.g. appimage build
2025-06-11 18:15:08 +00:00
SomberNight
fc574b4c2f mac build: readme: add more sanity checks for repro 2025-06-11 16:54:15 +00:00
SomberNight
8398a8ae2e mac build: don't compile C extensions for "propcache"
makes build not reproducible

random temporary paths leak into a compiled .so:
dist_ghost43/Electrum.app/Contents/Resources/propcache/_helpers_c.cpython-312-darwin.so
2025-06-11 16:54:12 +00:00
SomberNight
376d5eb6e0 mac build: call "git describe" without "--dirty"
as we dirty the git clone ourselves, well the locale submodule, when we rm the .po files
2025-06-11 16:54:09 +00:00
SomberNight
af01cba5f7 fix macos build: pyinstaller.spec: copy_metadata was undefined
regression from aecc22dc08
2025-06-10 18:33:29 +00:00
SomberNight
ff777946fe build: win/mac: rename pyinstaller spec files
for clarity
also, "deterministic.spec" is a confusing name
2025-06-06 15:00:20 +00:00
SomberNight
aecc22dc08 build: win/mac: fix trezor plugin for new trezorlib
trezor==0.13.10 pulls in new dep "slip10", which relies on importlib magic

see 19561f0429/slip10/__init__.py (L6)

```
 10.13 | E | plugins.trezor.trezor | error importing trezor plugin deps
Traceback (most recent call last):
  File "importlib/metadata/__init__.py", line 397, in from_name
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "electrum/plugins/trezor/trezor.py", line 29, in <module>
    from .clientbase import TrezorClientBase, RecoveryDeviceInputMethod
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "electrum/plugins/trezor/clientbase.py", line 18, in <module>
    import trezorlib.device
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "trezorlib/device.py", line 27, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "slip10/__init__.py", line 6, in <module>
  File "importlib/metadata/__init__.py", line 889, in version
  File "importlib/metadata/__init__.py", line 862, in distribution
  File "importlib/metadata/__init__.py", line 399, in from_name
importlib.metadata.PackageNotFoundError: No package metadata was found for slip10
```
2025-06-05 17:59:31 +00:00
SomberNight
c8a9083d28 macos build: include libsecp256k1 dylib 2025-06-05 16:51:21 +00:00
SomberNight
538fc37f03 build: bump pyinstaller 2025-06-05 16:51:18 +00:00
SomberNight
608fedd7cd build: libsecp: rm hardcoded ABI version 2025-06-05 16:50:51 +00:00
SomberNight
bf0ad20c60 build: bump python versions in binaries 2025-06-05 16:50:35 +00:00
SomberNight
491b808cc5 macos build: fix missing keepkeylib
```
  9.76 | D | plugins.keepkey.qt.Plugin | error importing keepkeylib
Traceback (most recent call last):
  File "electrum/plugins/keepkey/keepkey.py", line 77, in __init__
    from . import client
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "electrum/plugins/keepkey/client.py", line 1, in <module>
    from .keepkeylib.keepkeylib.client import proto, BaseClient, ProtocolMixin
ModuleNotFoundError: No module named 'electrum.plugins.keepkey.keepkeylib.keepkeylib'
```
2025-06-05 16:48:33 +00:00
SomberNight
31b176169a contrib: mv locale-related scripts to contrib/locale/ 2025-04-14 17:18:37 +00:00
SomberNight
1144d9b8ea build: add script build_cleanlocale.sh 2025-04-14 17:18:34 +00:00
SomberNight
3567a4cfb0 mv git submodule electrum-locale from contrib to electrum/locale
- this merges `contrib/deterministic-build/locale` and `electrum/locale`
- it is now once again possible have translations when running from a local git clone
    - which was already possible in the past before crowdin removed their unauthenticated APIs
        - see https://github.com/spesmilo/electrum/issues/9531
    - however, the translations available are the often-old frozen strings from electrum-locale
        - while previously one could just download the latest strings from crowdin
2025-04-14 17:18:30 +00:00
SomberNight
b70da1d3b9 build: set YARL_NO_EXTENSIONS for all builds
due to cython version mismatch -- easier to just disable the compilation for now
2025-04-01 16:59:26 +00:00
SomberNight
154adf0081 plugins: ledger: rm support for hw.1
This removes support for Ledger HW.1 and "Nano" (non-S) devices.
These were manufactured/sold around 2015-2016, and are long unsupported by the upstream vendor.

We previously added a deprecation warning to the GUI [0] released in 4.3.3 (2023-01-02), to warn owners of these devices.
This PR now fully removes support.

As a consequence, the unmaintained btchip-python dependency can now be removed, which solves [1].

[0]: 9b82eb6d06
[1]: https://github.com/spesmilo/electrum/issues/9370#issuecomment-2593675364
2025-03-18 16:18:49 +00:00
SomberNight
c8143957a6 plugins: keepkey: rm dependence on external keepkeylib
we will instead bundle our own fork, as a git submodule,
https://github.com/spesmilo/electrum-keepkeylib

related https://github.com/spesmilo/electrum/issues/7922
and https://github.com/keepkey/python-keepkey/issues/146
(i.e. upstream keepkeylib is unmaintained)
2025-03-17 17:53:48 +00:00
Sander van Grieken
fc2d43acfd qt,qml: move fonts to /electrum/gui for use in all guis. 2025-03-03 13:47:03 +01:00
SomberNight
172c3721bd follow-up prev: include chains/ folder in win and mac binaries 2025-01-27 14:21:34 +00:00
SomberNight
581082d5bb updates READMEs re electrum-ecc 2024-10-10 15:46:21 +00:00
SomberNight
f35437f03c build: set ELECTRUM_ECC_DONT_COMPILE=1, instead manually build lib
Haven't checked if electrum-ecc compiles libsecp reproducibly.
For now let's just keep the old flow.
(but if we spent time on making that compilation reproducible,
the appimage and the macos builds could use it directly)
2024-10-10 15:46:18 +00:00
ThomasV
9dbbd815a3 build scripts: add libsecp256k1 library to the electrum_ecc directory 2024-10-10 15:46:07 +00:00
SomberNight
276488e3d0 binaries: document min requirements for target systems 2024-10-04 14:02:51 +00:00
SomberNight
47d094fda0 mac build: bump declared min supported macos version (10.13->11)
due to the qt 5.15 -> qt 6.7 bump

related https://github.com/spesmilo/electrum/issues/3685
2024-09-18 15:48:43 +00:00
SomberNight
cfe8502f96 qt desktop gui: upgrade qt5->qt6
closes https://github.com/spesmilo/electrum/issues/8007
2024-09-18 15:48:38 +00:00
SomberNight
d46e724816 win/mac build: bump pyinstaller (5.13.2->6.6.0) 2024-04-19 13:07:39 +00:00
SomberNight
85af0b8030 win/mac build: bump pyinstaller (5.11.0->5.13.2)
- needed for bumping python version, as 3.11+ is borked without https://github.com/pyinstaller/pyinstaller/issues/7692
- plugin.py: adapt to pyinstaller 5.12+
    loader was renamed in b9111db8a8
2024-04-18 18:16:10 +00:00
SomberNight
41d6f08de9 win/mac build: bump python version (3.10.11->3.11.9) 2024-04-18 18:15:26 +00:00
ThomasV
de5ca461d4 contrib/osx:
- rename make_osx2.sh -> sign_osx.sh
- add command to unlock keychain
- chmod +x
2024-03-15 11:02:45 +01:00
SomberNight
409bd0199c build: split make_osx.sh script into two: "build" and "sign" parts 2024-03-15 11:02:45 +01:00
SomberNight
9c7b2bd877 mac build: log hash of .app for quick checking of build-repro
I think that hash should match between unsigned and release builds,
as the codesigning/notarisation is done right after.
2023-12-13 18:16:57 +00:00
SomberNight
c98830d091 mac build: follow-up prev (altool -> notarytool migration)
related 7ee078852a
2023-12-12 00:57:01 +00:00
ThomasV
99da6507fc osx builds: use notarytool 2023-12-12 00:56:58 +00:00
SomberNight
86f6e3dbcb mac build: update README for new macOS 11 build VM
- For the notarisation, we were using "altool" (part of xcode), but Apple now fully deprecated that.
    - need to migrate from altool to notarytool
        https://developer.apple.com/news/?id=y5mjxqmn
    - currently using macOS 10.14.6
                  and xcode 11.3.1
    - notarytool requires xcode 13+
    - xcode 13 requires macOS 11.3
        https://en.wikipedia.org/wiki/Xcode#Version_comparison_table
    ==> created new build VM with macOS 11.7.10 and xcode 13.2
2023-12-12 00:56:55 +00:00
SomberNight
77f84060f4 mac build: clang to always target x86_64
With newer xcode (12+, I think), the default behaviour is to build
universal binaries that include native code for both arm64 and x86_64.
On older xcode, the default was to only target x86_64.

I am not sure why, but "hid.cpython-310-darwin.so" is not built
reproducibly when it is "universal".
(Even for consecutive builds done on the same machine.)
```
- + diff='Files /tmp/electrum_compare_dmg/signed_app/Electrum.app/Contents/MacOS/hid.cpython-310-darwin.so and /tmp/electrum_compare_dmg/dmg2/Electrum.app/Contents/MacOS/hid.cpython-310-darwin.so differ
```

This commit works around the reproducibly issue by making clang only
build for the x86_64 target. The binary should still be able to run
on arm64 macs using rosetta (same with previous versions of Electrum).

-----

The `lipo` tool can tell what archs a shared object is built for, e.g.:
```
$ lipo -info /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so
Non-fat file: /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so is architecture: x86_64
```

For quick testing, we don't need to build the whole .app, only hid.so:
```
source /Users/vagrant/electrum/contrib/osx/build-venv/bin/activate
export CFLAGS="-g0"
python3 -m pip install -I --no-build-isolation --no-dependencies --no-binary :all: --no-warn-script-location hidapi==0.14.0
strip -x /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so
cp /Users/vagrant/electrum/contrib/osx/build-venv/lib/python3.10/site-packages/hid.cpython-310-darwin.so /Users/vagrant/wspace/tmp/try7/hid10.so
```

Re ARCHFLAGS env var, see https://stackoverflow.com/a/5808548

-----

Note: I've found several xcode build settings that looked relevant
but in the end were not useful, e.g. ARCHS, ONLY_ACTIVE_ARCH,
EXCLUDED_ARCHS, VALID_ARCHS.
- see https://developer.apple.com/documentation/technotes/tn3117-resolving-build-errors-for-apple-silicon
- see https://stackoverflow.com/a/64422757
2023-12-12 00:56:43 +00:00
SomberNight
9743bd5219 pyinstaller build: (trivial) format so that win/osx look more similar 2023-11-30 13:52:20 +00:00
SomberNight
b551cb5f75 pyinstaller build: better parameterise .spec 2023-11-30 13:50:21 +00:00
SomberNight
0912e5615d pyinstaller build: follow-up: dirty hack for duplicate plugins
Ah ok, I give up for now... the prev does not really work.

The prior commit works on Windows but not on macOS.
On Windows, it would package all plugins as code and only as code.
On MacOS however, it would not package any plugins at all. And with this commit,
where I mark the plugins folder to be packaged as *data*, it packages all plugins as *both* code and data.
Not sure why.

Let's just package all plugins as both code and data, and ignore the code instances explicitly...
2023-11-30 13:48:53 +00:00