Commit Graph

380 Commits

Author SHA1 Message Date
f321x 78135ac8b2 windows: delete lightning URI hooks on uninstall
On install we register the URIs for bitcoin, lightning, lnurlp and lnurlw
in the registry but on uninstall we would only remove bitcoin again.
2026-04-13 09:32:25 +02:00
f321x ef702d74cd pi: handle lud-17 URI payment identifier
LNURL-W/P can also be encoded in lud-17 form instead of bech32.
https://github.com/lnurl/luds/blob/luds/17.md
e.g.
lnurlw://example.com/api/test123
lnurlp://example.com/api/test123
2026-04-13 09:30:28 +02:00
SomberNight 31ed05c05c build: win: change from win-iconv to GNU libiconv
- (zbar requires [0] iconv)
- issues [1][3] compiling win-iconv:
    - pre-existing issue: lots of "-Wincompatible-pointer-types" warnings when compiling zbar with win-iconv
    - new debian means newer GCC
    - new GCC changed that [2] warning type to "error"
- GNU libiconv works as an alternative
    - drawback: win-iconv is more minimal, it uses the win32 API to do most of the work
    - still, is a 25+ year old GNU project with one release every ~2 years, so IMO fine

[0]: https://github.com/mchehab/zbar/blob/a549566ea11eb03622bd4458a1728ffe3f589163/README-windows.md
[1]: https://github.com/SomberNight/electrum/commit/cb00cb60cf9a0cb059dcac5e7acfe5186620cabe
[2]: https://gcc.gnu.org/pipermail/gcc-cvs/2023-December/394351.html

[3]: see snippet when compiling libzbar:
```
decoder.c: In function ‘zbar_decoder_reset’:
decoder.c:116:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  116 |     memset(dcode, 0, (long)&dcode->buf_alloc - (long)dcode);
      |                      ^
decoder.c:116:48: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  116 |     memset(dcode, 0, (long)&dcode->buf_alloc - (long)dcode);
      |                                                ^
  CC       processor/libzbar_la-win.lo
/bin/bash ../libtool --tag=RC   \
--mode=compile x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I. -I../include  \
-I../include  -o libzbar-rc.lo libzbar.rc
  CC       processor/libzbar_la-lock.lo
  CC       decoder/libzbar_la-qr_finder.lo
  CC       qrcode/libzbar_la-qrdec.lo
In file included from ./processor.h:26,
                 from processor/lock.c:25:
../include/config.h:423:9: warning: "_WIN32_WINNT" redefined
  423 | #define _WIN32_WINNT 0x0500
      |         ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/corecrt.h:10,
                 from /usr/share/mingw-w64/include/crtdefs.h:10,
                 from /usr/share/mingw-w64/include/assert.h:15,
                 from processor/lock.c:24:
/usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition
  232 | #define _WIN32_WINNT 0xa00
      |         ^~~~~~~~~~~~
libtool: compile:  x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I. -I../include -I../include libzbar.rc  -o .libs/libzbar-rc.o
  CC       qrcode/libzbar_la-qrdectxt.lo
  CC       qrcode/libzbar_la-rs.lo
  CC       qrcode/libzbar_la-isaac.lo
  CC       qrcode/libzbar_la-bch15_5.lo
  CC       qrcode/libzbar_la-binarize.lo
  CC       qrcode/libzbar_la-util.lo
In file included from ./image.h:26,
                 from qrcode/binarize.c:10:
../include/config.h:423:9: warning: "_WIN32_WINNT" redefined
  423 | #define _WIN32_WINNT 0x0500
      |         ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/corecrt.h:10,
                 from /usr/share/mingw-w64/include/crtdefs.h:10,
                 from /usr/share/mingw-w64/include/math.h:13,
                 from qrcode/binarize.c:7:
/usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition
  232 | #define _WIN32_WINNT 0xa00
      |         ^~~~~~~~~~~~
  CC       video/libzbar_la-dshow.lo
  CC       window/libzbar_la-win.lo
In file included from ./window.h:26,
                 from window/win.c:26:
../include/config.h:423:9: warning: "_WIN32_WINNT" redefined
  423 | #define _WIN32_WINNT 0x0500
      |         ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/corecrt.h:10,
                 from /usr/share/mingw-w64/include/crtdefs.h:10,
                 from /usr/share/mingw-w64/include/ctype.h:9,
                 from window/win.c:24:
/usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition
  232 | #define _WIN32_WINNT 0xa00
      |         ^~~~~~~~~~~~
In file included from ./processor.h:26,
                 from processor/win.c:29:
../include/config.h:423:9: warning: "_WIN32_WINNT" redefined
  423 | #define _WIN32_WINNT 0x0500
      |         ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/corecrt.h:10,
                 from /usr/share/mingw-w64/include/crtdefs.h:10,
                 from /usr/share/mingw-w64/include/assert.h:15,
                 from processor/win.c:24:
/usr/share/mingw-w64/include/_mingw.h:232:9: note: this is the location of the previous definition
  232 | #define _WIN32_WINNT 0xa00
      |         ^~~~~~~~~~~~
processor/win.c: In function ‘_zbar_processor_open’:
processor/win.c:282:47: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  282 |     proc->display = CreateWindowEx(EXT_STYLE, (LPCTSTR)(long)wca, "ZBar",
      |                                               ^
processor/win.c: In function ‘_zbar_processor_close’:
processor/win.c:297:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  297 |         UnregisterClass((LPCTSTR)(long)proc->state->registeredClass, 0);
      |                         ^
  CC       window/libzbar_la-dib.lo
qrcode/qrdectxt.c: In function ‘qr_code_data_list_extract_text’:
qrcode/qrdectxt.c:302:62: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types]
  302 |                                               iconv(utf8_cd, &in, &inleft, &out,
      |                                                              ^~~
      |                                                              |
      |                                                              char **
In file included from qrcode/qrdectxt.c:12:
/usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’
   43 |         size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
qrcode/qrdectxt.c:352:71: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types]
  352 |                                             err = iconv(enc_list[ei], &in,
      |                                                                       ^~~
      |                                                                       |
      |                                                                       char **
/usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’
   43 |         size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
qrcode/qrdectxt.c:374:53: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types]
  374 |                                       iconv(eci_cd, &in, &inleft, &out,
      |                                                     ^~~
      |                                                     |
      |                                                     char **
/usr/x86_64-w64-mingw32/include/iconv.h:43:56: note: expected ‘const char **’ but argument is of type ‘char **’
   43 |         size_t iconv(iconv_t cd, WINICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
make[2]: *** [Makefile:1089: qrcode/libzbar_la-qrdectxt.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/opt/wine64/drive_c/electrum/contrib/zbar/zbar'
make[1]: *** [Makefile:1895: all-recursive] Error 1
make[1]: Leaving directory '/opt/wine64/drive_c/electrum/contrib/zbar'
make: *** [Makefile:989: all] Error 2
🗯 ERROR: Could not build zbar
🗯 ERROR: Could not build zbar

```
2026-02-28 07:41:45 +00:00
SomberNight 3674232dd5 build: win: bump wine (10->11) 2026-02-27 16:35:05 +00:00
SomberNight b939e8779f build: win: update debian base (12->13) 2026-02-27 16:27:11 +00:00
SomberNight ceadcac922 contrib: minor clean-up shell usage 2026-01-23 17:48:06 +00:00
SomberNight 447c7cf8b3 build: Dockerfile: mod "new user to avoid using root" to support UID=0
Extend "create new user to avoid using root" copypasta to support being run as root
(ARG UID=0).

When running build.sh directly on a cirrus CI runner, we are running as root.
2025-09-26 14:24:26 +00:00
SomberNight b676c1e9d3 build: docker run: make "-it" flags conditional on tty being available
from https://stackoverflow.com/a/69088164

I am trying to run the build.sh scripts directly on a cirrus CI runner, and "docker run -it" is erroring due to lack of a tty.
2025-09-26 14:24:23 +00:00
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
accumulator 998e9a5f48 Merge pull request #9966 from f321x/improve_windows_installer_safety
block windows installer if Electrum is still running
2025-06-16 16:08:31 +02:00
f321x ddddaad9a1 block windows installer if Electrum is still running
Adds a check to the Windows nsis installer and uninstaller
that will show an error popup if Electrum is still running to prevent
a broken installation that happen if the installer only partly
overwrites the existing installation (see #6748).
This works by trying to open the .exe files in the Electrum installation
directory in append mode, if Electrum is still running the installer
will not be able to open the .exe and the check fails.
Based on https://github.com/Electron-Cash/Electron-Cash/pull/2185
2025-06-16 15:08:22 +02:00
f321x eba21231c9 fix: build-wine/unsign.sh fail if osslsigncode is missing
If osslsigncode is missing `build-wine/unsign.sh` fails silently with
status code 0 causing the `release.sh` script to interpret the result as
valid and skipping the actual comparison of the windows binaries.
2025-06-16 14:50:22 +02: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 https://github.com/spesmilo/electrum/commit/b6e4ec8f95c5f405dc4c0b6750df076e56740ae0
2025-06-13 14:22:34 +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 https://github.com/pyinstaller/pyinstaller/blob/cef4d530e375647e43572fd50b98b8e3729e329c/PyInstaller/building/build_main.py#L1189
2025-06-11 21:35:41 +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 https://github.com/trezor/python-slip10/blob/19561f04298ae24a9623464b82b765504f1f0bcd/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 2543c85712 windows build: workaround no longer needed with modern pip
upstream now carries our fix

ref https://github.com/spesmilo/electrum/issues/7739
ref https://github.com/pypa/distlib/pull/165
2025-06-05 17:59:17 +00:00
SomberNight 538fc37f03 build: bump pyinstaller 2025-06-05 16:51:18 +00:00
SomberNight dd42c12ec4 windows build: bump wine 2025-06-05 16:51:10 +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 37ca5f7eff build: appimage: bump base from debian buster(2019) to bullseye(2021) 2025-06-05 16:50:31 +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 269a240fb9 build: partial rerun freeze_packages
update electrum-aionostr, aiorpcx, and aiohttp (and friends)
2025-04-01 16:59:22 +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]: https://github.com/spesmilo/electrum/commit/9b82eb6d06f8534652849f3370ab8af7d7ca9c7f
[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 492d3c3b80 win build: setup exe should install to 64-bit "Program Files"
setup exe used to install Electrum to `C:\Program Files (x86)\Electrum`,
but now as the binaries are amd64, we should install to `C:\Program Files\Electrum`.

With this change, based on my experiments, looks like if there is an existing install,
nsis will keep using that path, but if it's a fresh install, it will now use the 64-bit path.

follow-up https://github.com/spesmilo/electrum/commit/fcc4e1d38773da0484910cacc80c16117b9c15c5
2024-10-07 13:44:16 +00:00
SomberNight 276488e3d0 binaries: document min requirements for target systems 2024-10-04 14:02:51 +00:00
ThomasV b1db99fde8 update hash for winehq.key
Looks like upstream key file changed. Still the same crypto key, just updated expiration date.

```
$ sha256sum winehq_20*
78b185fabdb323971d13bd329fefc8038e08559aa51c4996de18db0639a51df6 *winehq_2019.key
d965d646defe94b3dfba6d5b4406900ac6c81065428bf9d9303ad7a72ee8d1b8 *winehq_2024.key

$ gpg winehq_2019.key
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
pub   rsa3072 2018-12-10 [SC]
      D43F640145369C51D786DDEA76F1A20FF987672F
uid           WineHQ packages <wine-devel@winehq.org>
sub   rsa3072 2018-12-10 [E] [expired: 2020-12-09]

$ gpg winehq_2024.key
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
pub   rsa3072 2018-12-10 [SC]
      D43F640145369C51D786DDEA76F1A20FF987672F
uid           WineHQ packages <wine-devel@winehq.org>
sub   rsa3072 2018-12-10 [E]
```

Co-authored-by: SomberNight <somber.night@protonmail.com>
2024-10-01 15:27:34 +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 fcc4e1d387 wine build: build 64-bit windows binaries
required for qt6

related: https://github.com/spesmilo/electrum/issues/6598
2024-09-18 15:46:16 +00:00
SomberNight 20d7543b53 win build: remove deprecated apt-key for winehq key
```
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
```

from https://github.com/Electron-Cash/Electron-Cash/commit/5b40744831f367d800f7832d89375991374af142
2024-04-19 14:52:29 +00:00
SomberNight a4cb69d1b5 win build: update debian base (11->12), and wine 2024-04-19 14:52:25 +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 https://github.com/pyinstaller/pyinstaller/commit/b9111db8a869dd19dd7e8b3c952abea3238d02a6
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
SomberNight 51bc23c92f build scripts: (trivial) add quotes around some shell variables 2023-12-18 18:15:33 +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