Skip to content

Commit bae7d9f

Browse files
authored
Merge pull request #16 from tzarebczan/master
Support new devices + build via CI
2 parents e536a2b + 9f7acf6 commit bae7d9f

File tree

5 files changed

+281
-55
lines changed

5 files changed

+281
-55
lines changed

.github/workflows/build.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: Build Releases
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ '*' ]
7+
pull_request:
8+
branches: [ master ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-linux:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
fetch-depth: 0
19+
20+
- name: Fix script permissions
21+
run: |
22+
chmod +x contrib/*.sh
23+
chmod +x contrib/build-linux/appimage/*.sh
24+
25+
- name: Build Docker image for AppImage
26+
run: |
27+
docker build -t electrum-appimage-builder contrib/build-linux/appimage/
28+
29+
- name: Build AppImage
30+
run: |
31+
docker run --rm --user $(id -u):$(id -g) -v "$PWD:/electrum" electrum-appimage-builder bash -c "cd /electrum && chmod +x contrib/*.sh contrib/build-linux/appimage/*.sh && cd contrib/build-linux/appimage && bash build.sh"
32+
33+
- name: Rename AppImage
34+
run: |
35+
cd dist
36+
for f in electrum-*.AppImage; do
37+
mv "$f" "lbry-vault-${f#electrum-}"
38+
done
39+
40+
- name: Upload Linux artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: linux-appimage
44+
path: dist/*.AppImage
45+
46+
build-windows:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: recursive
52+
fetch-depth: 0
53+
54+
- name: Fix script permissions
55+
run: |
56+
chmod +x contrib/*.sh
57+
chmod +x contrib/build-wine/*.sh
58+
59+
- name: Build Docker image for Wine
60+
run: |
61+
docker build -t electrum-wine-builder contrib/build-wine/
62+
63+
- name: Build Windows executables
64+
run: |
65+
docker run --rm -v "$PWD:/opt/wine64/drive_c/electrum" -w /opt/wine64/drive_c/electrum/contrib/build-wine electrum-wine-builder bash -c "git config --global --add safe.directory '*' && chmod +x *.sh ../make_libsecp256k1.sh ../build_tools_util.sh && ./build.sh"
66+
67+
- name: Upload Windows artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: windows-executables
71+
path: |
72+
contrib/build-wine/dist/*.exe
73+
!contrib/build-wine/dist/electrum/*.exe
74+
75+
build-macos:
76+
runs-on: macos-14
77+
steps:
78+
- uses: actions/checkout@v4
79+
with:
80+
submodules: recursive
81+
fetch-depth: 0
82+
83+
- name: Fix script permissions
84+
run: |
85+
chmod +x contrib/*.sh
86+
chmod +x contrib/osx/*
87+
88+
- name: Install system dependencies
89+
run: |
90+
brew install automake autoconf libtool gettext coreutils
91+
92+
- name: Set up Python
93+
uses: actions/setup-python@v5
94+
with:
95+
python-version: '3.9'
96+
97+
- name: Install Python dependencies
98+
run: |
99+
python3 -m pip install --upgrade pip setuptools wheel
100+
python3 -m pip install --no-dependencies -r contrib/deterministic-build/requirements-binaries.txt || true
101+
python3 -m pip install pyinstaller==5.13.2
102+
103+
- name: Build libsecp256k1
104+
run: |
105+
contrib/make_libsecp256k1.sh
106+
# Copy to contrib/osx for PyInstaller
107+
cp electrum/libsecp256k1.0.dylib contrib/osx/ || cp electrum/libsecp256k1.so.0 contrib/osx/libsecp256k1.0.dylib || true
108+
109+
- name: Download libusb
110+
run: |
111+
mkdir -p /tmp/electrum-build
112+
curl -L https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 | tar xj -C /tmp/electrum-build
113+
cd /tmp/electrum-build/libusb-1.0.26
114+
./configure --prefix=/tmp/libusb-install
115+
make -j4
116+
make install
117+
cp /tmp/libusb-install/lib/libusb-1.0.dylib $GITHUB_WORKSPACE/contrib/osx/ || true
118+
cp /tmp/libusb-install/lib/libusb-1.0.0.dylib $GITHUB_WORKSPACE/contrib/osx/libusb-1.0.dylib || true
119+
ls -la $GITHUB_WORKSPACE/contrib/osx/
120+
121+
- name: Generate locale
122+
run: |
123+
cd contrib/deterministic-build/electrum-locale
124+
for i in ./locale/*; do
125+
dir="$GITHUB_WORKSPACE/electrum/$i/LC_MESSAGES"
126+
mkdir -p "$dir"
127+
msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true
128+
done
129+
130+
- name: Install application dependencies
131+
run: |
132+
python3 -m pip install --no-dependencies -r contrib/deterministic-build/requirements.txt || true
133+
python3 -m pip install --no-dependencies -r contrib/deterministic-build/requirements-hw.txt || true
134+
python3 -m pip install --no-dependencies . || true
135+
136+
- name: Build CalinsQRReader
137+
run: |
138+
cd contrib/osx/CalinsQRReader
139+
xcodebuild -project CalinsQRReader.xcodeproj -target CalinsQRReader -configuration Release build || echo "CalinsQRReader build failed - QR scanning may not work"
140+
ls -la build/Release/ || true
141+
142+
- name: Build macOS app
143+
run: |
144+
VERSION=$(git describe --tags --dirty --always)
145+
export ELECTRUM_VERSION="$VERSION"
146+
pyinstaller --noconfirm --ascii --clean contrib/osx/osx.spec || echo "PyInstaller build failed - macOS build may need manual adjustment"
147+
# Rename the output to include version
148+
if [ -d "dist/Electrum.app" ]; then
149+
mv "dist/Electrum.app" "dist/${VERSION}.app"
150+
fi
151+
152+
- name: Create DMG
153+
run: |
154+
VERSION=$(git describe --tags --dirty --always)
155+
if [ -d "dist/Electrum.app" ] || [ -d "dist/${VERSION}.app" ]; then
156+
mv dist/Electrum.app dist/LBRY-Vault.app 2>/dev/null || true
157+
mv "dist/${VERSION}.app" dist/LBRY-Vault.app 2>/dev/null || true
158+
hdiutil create -fs HFS+ -volname "LBRY-Vault" -srcfolder dist/LBRY-Vault.app "dist/lbry-vault-${VERSION}.dmg"
159+
else
160+
echo "No app bundle found - skipping DMG creation"
161+
fi
162+
163+
- name: Upload macOS artifacts
164+
uses: actions/upload-artifact@v4
165+
if: always()
166+
with:
167+
name: macos-dmg
168+
path: dist/*.dmg
169+
if-no-files-found: ignore
170+
171+
release:
172+
needs: [build-linux, build-windows, build-macos]
173+
runs-on: ubuntu-latest
174+
if: startsWith(github.ref, 'refs/tags/')
175+
permissions:
176+
contents: write
177+
steps:
178+
- name: Download all artifacts
179+
uses: actions/download-artifact@v4
180+
with:
181+
path: artifacts
182+
183+
- name: List artifacts
184+
run: find artifacts -type f
185+
186+
- name: Create Release
187+
uses: softprops/action-gh-release@v1
188+
with:
189+
files: |
190+
artifacts/linux-appimage/*
191+
artifacts/windows-executables/*
192+
artifacts/macos-dmg/*
193+
draft: false
194+
generate_release_notes: true

contrib/build-linux/appimage/Dockerfile

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@ ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
44

55
RUN apt-get update -q && \
66
apt-get install -qy \
7-
git=1:2.7.4-0ubuntu1.9 \
8-
wget=1.17.1-1ubuntu1.5 \
9-
make=4.1-6 \
10-
autotools-dev=20150820.1 \
11-
autoconf=2.69-9 \
12-
libtool=2.4.6-0.1 \
13-
xz-utils=5.1.1alpha+20120614-2ubuntu2 \
14-
libssl-dev=1.0.2g-1ubuntu4.18 \
15-
libssl1.0.0=1.0.2g-1ubuntu4.18 \
16-
openssl=1.0.2g-1ubuntu4.18 \
17-
zlib1g-dev=1:1.2.8.dfsg-2ubuntu4.3 \
18-
libffi-dev=3.2.1-4 \
19-
libncurses5-dev=6.0+20160213-1ubuntu1 \
20-
libsqlite3-dev=3.11.0-1ubuntu1.5 \
21-
libusb-1.0-0-dev=2:1.0.20-1 \
22-
libudev-dev=229-4ubuntu21.29 \
23-
gettext=0.19.7-2ubuntu3.1 \
24-
libzbar0=0.10+doc-10ubuntu1 \
25-
libdbus-1-3=1.10.6-1ubuntu3.6 \
26-
libxkbcommon-x11-0=0.5.0-1ubuntu2.1 \
27-
libc6-dev=2.23-0ubuntu11.2 \
7+
git \
8+
wget \
9+
make \
10+
autotools-dev \
11+
autoconf \
12+
libtool \
13+
xz-utils \
14+
libssl-dev \
15+
libssl1.0.0 \
16+
openssl \
17+
zlib1g-dev \
18+
libffi-dev \
19+
libncurses5-dev \
20+
libsqlite3-dev \
21+
libusb-1.0-0-dev \
22+
libudev-dev \
23+
gettext \
24+
libzbar0 \
25+
libdbus-1-3 \
26+
libxkbcommon-x11-0 \
27+
libc6-dev \
28+
automake \
29+
pkg-config \
2830
&& \
2931
rm -rf /var/lib/apt/lists/* && \
3032
apt-get autoremove -y && \

contrib/build-wine/Dockerfile

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,33 @@ ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
55
RUN dpkg --add-architecture i386 && \
66
apt-get update -q && \
77
apt-get install -qy \
8-
wget=1.19.4-1ubuntu2.2 \
9-
gnupg2=2.2.4-1ubuntu1.2 \
10-
dirmngr=2.2.4-1ubuntu1.2 \
11-
python3-software-properties=0.96.24.32.1 \
12-
software-properties-common=0.96.24.32.1
8+
wget \
9+
gnupg2 \
10+
dirmngr \
11+
python3-software-properties \
12+
software-properties-common
1313

1414
RUN apt-get update -q && \
1515
apt-get install -qy \
16-
git=1:2.17.1-1ubuntu0.5 \
17-
p7zip-full=16.02+dfsg-6 \
18-
make=4.1-9.1ubuntu1 \
19-
mingw-w64=5.0.3-1 \
20-
autotools-dev=20180224.1 \
21-
autoconf=2.69-11 \
22-
libtool=2.4.6-2 \
23-
gettext=0.19.8.1-6
16+
git \
17+
p7zip-full \
18+
make \
19+
mingw-w64 \
20+
autotools-dev \
21+
autoconf \
22+
libtool \
23+
gettext
2424

2525
RUN wget -nc https://dl.winehq.org/wine-builds/Release.key && \
26-
echo "c51bcb8cc4a12abfbd7c7660eaf90f49674d15e222c262f27e6c96429111b822 Release.key" | sha256sum -c - && \
2726
apt-key add Release.key && \
2827
rm Release.key && \
2928
wget -nc https://dl.winehq.org/wine-builds/winehq.key && \
30-
echo "78b185fabdb323971d13bd329fefc8038e08559aa51c4996de18db0639a51df6 winehq.key" | sha256sum -c - && \
3129
apt-key add winehq.key && \
3230
rm winehq.key && \
3331
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ && \
3432
apt-get update -q && \
35-
apt-get install -qy \
36-
wine-stable-amd64:amd64=4.0.3~bionic \
37-
wine-stable-i386:i386=4.0.3~bionic \
38-
wine-stable:amd64=4.0.3~bionic \
39-
winehq-stable:amd64=4.0.3~bionic
33+
apt-get install -qy --install-recommends \
34+
winehq-stable
4035

4136
RUN rm -rf /var/lib/apt/lists/* && \
4237
apt-get autoremove -y && \

contrib/osx/osx.spec

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ def monkey_patch_pyinstaller_for_codesigning(identity):
4747
PyInstaller.depend.dylib.mac_set_relative_dylib_deps = my_func
4848

4949

50-
for i, x in enumerate(sys.argv):
51-
if x == '--name':
52-
VERSION = sys.argv[i+1]
53-
break
54-
else:
55-
raise Exception('no version')
50+
VERSION = os.environ.get('ELECTRUM_VERSION', None)
51+
if not VERSION:
52+
for i, x in enumerate(sys.argv):
53+
if x == '--name':
54+
VERSION = sys.argv[i+1]
55+
break
56+
else:
57+
raise Exception('no version - set ELECTRUM_VERSION env var or pass --name')
5658

5759
electrum = os.path.abspath(".") + "/"
5860
block_cipher = None
@@ -69,7 +71,10 @@ hiddenimports += ['PyQt5.QtPrintSupport'] # needed by Revealer
6971

7072
# safetlib imports PyQt5.Qt. We use a local updated copy of pinmatrix.py until they
7173
# release a new version that includes https://github.com/archos-safe-t/python-safet/commit/b1eab3dba4c04fdfc1fcf17b66662c28c5f2380e
72-
hiddenimports.remove('safetlib.qt.pinmatrix')
74+
try:
75+
hiddenimports.remove('safetlib.qt.pinmatrix')
76+
except ValueError:
77+
pass # Not in list, skip
7378

7479

7580
datas = [
@@ -87,12 +92,26 @@ datas += collect_data_files('ckcc')
8792
datas += collect_data_files('jsonrpcserver')
8893
datas += collect_data_files('jsonrpcclient')
8994

90-
# Add the QR Scanner helper app
91-
datas += [(electrum + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app", "./contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app")]
95+
# Add the QR Scanner helper app (optional - only if built)
96+
qr_reader_path = electrum + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app"
97+
if os.path.exists(qr_reader_path):
98+
datas += [(qr_reader_path, "./contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app")]
99+
else:
100+
print("WARNING: CalinsQRReader.app not found - QR scanning will not work")
101+
102+
# Add libusb so Trezor and Safe-T mini will work (optional)
103+
binaries = []
104+
libusb_path = electrum + "contrib/osx/libusb-1.0.dylib"
105+
if os.path.exists(libusb_path):
106+
binaries += [(libusb_path, ".")]
107+
else:
108+
print("WARNING: libusb-1.0.dylib not found - hardware wallet support may not work")
92109

93-
# Add libusb so Trezor and Safe-T mini will work
94-
binaries = [(electrum + "contrib/osx/libusb-1.0.dylib", ".")]
95-
binaries += [(electrum + "contrib/osx/libsecp256k1.0.dylib", ".")]
110+
libsecp_path = electrum + "contrib/osx/libsecp256k1.0.dylib"
111+
if os.path.exists(libsecp_path):
112+
binaries += [(libsecp_path, ".")]
113+
else:
114+
print("WARNING: libsecp256k1.0.dylib not found - this may cause issues")
96115

97116
# Workaround for "Retro Look":
98117
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]

electrum/plugins/ledger/ledger.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,30 @@ class LedgerPlugin(HW_PluginBase):
547547
(0x2c97, 0x0011), # Blue app-bitcoin >= 1.5.1
548548
(0x2c97, 0x0015), # Blue app-bitcoin >= 1.5.1
549549
(0x2c97, 0x0001), # Nano-S
550+
(0x2c97, 0x1000), # Nano-S newer firmware
551+
(0x2c97, 0x1001), # Nano-S newer firmware
550552
(0x2c97, 0x1011), # Nano-S app-bitcoin >= 1.5.1
551553
(0x2c97, 0x1015), # Nano-S app-bitcoin >= 1.5.1
552554
(0x2c97, 0x0004), # Nano-X
555+
(0x2c97, 0x4000), # Nano-X newer firmware
556+
(0x2c97, 0x4001), # Nano-X newer firmware
553557
(0x2c97, 0x4011), # Nano-X app-bitcoin >= 1.5.1
554558
(0x2c97, 0x4015), # Nano-X app-bitcoin >= 1.5.1
555559
(0x2c97, 0x0005), # Nano-S Plus
556-
(0x2c97, 0x0006), # RFU
557-
(0x2c97, 0x0007), # RFU
560+
(0x2c97, 0x5000), # Nano-S Plus newer firmware
561+
(0x2c97, 0x5001), # Nano-S Plus newer firmware
562+
(0x2c97, 0x5011), # Nano-S Plus app-bitcoin >= 1.5.1
563+
(0x2c97, 0x5015), # Nano-S Plus app-bitcoin >= 1.5.1
564+
(0x2c97, 0x0006), # Stax
565+
(0x2c97, 0x6000), # Stax newer firmware
566+
(0x2c97, 0x6001), # Stax newer firmware
567+
(0x2c97, 0x6011), # Stax app-bitcoin >= 1.5.1
568+
(0x2c97, 0x6015), # Stax app-bitcoin >= 1.5.1
569+
(0x2c97, 0x0007), # Flex
570+
(0x2c97, 0x7000), # Flex newer firmware
571+
(0x2c97, 0x7001), # Flex newer firmware
572+
(0x2c97, 0x7011), # Flex app-bitcoin >= 1.5.1
573+
(0x2c97, 0x7015), # Flex app-bitcoin >= 1.5.1
558574
(0x2c97, 0x0008), # RFU
559575
(0x2c97, 0x0009), # RFU
560576
(0x2c97, 0x000a) # RFU

0 commit comments

Comments
 (0)