Skip to content

Commit 15fee8c

Browse files
author
David Reband
committed
build-wine: update
1 parent 8508e46 commit 15fee8c

File tree

9 files changed

+234
-78
lines changed

9 files changed

+234
-78
lines changed

contrib/build-wine/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:bullseye@sha256:82bab30ed448b8e2509aabe21f40f0607d905b7fd0dec72802627a20274eba55
1+
FROM debian:bullseye@sha256:bfe6615d017d1eebe19f349669de58cda36c668ef916e618be78071513c690e5
22

33
# need ca-certificates before using snapshot packages
44
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
@@ -24,7 +24,6 @@ RUN dpkg --add-architecture i386 && \
2424
make \
2525
mingw-w64 \
2626
mingw-w64-tools \
27-
win-iconv-mingw-w64-dev \
2827
autotools-dev \
2928
autoconf \
3029
autopoint \
@@ -70,4 +69,4 @@ RUN chown --recursive ${USER} ${WORK_DIR}
7069
RUN chown ${USER} /opt
7170
USER ${USER}
7271

73-
RUN mkdir --parents "/opt/wine64/drive_c/electrum"
72+
RUN mkdir --parents "/opt/wine64/drive_c/electrum-doi"

contrib/build-wine/README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,11 @@ similar system.
2020
$ ./build.sh
2121
```
2222
If you want reproducibility, try instead e.g.:
23-
```
24-
$ FRESH_CLONE=contrib/build-wine/fresh_clone && \
25-
sudo rm -rf $FRESH_CLONE && \
26-
mkdir -p $FRESH_CLONE && \
27-
cd $FRESH_CLONE && \
28-
git clone https://github.com/Doichain/electrum-doi.git && \
29-
cd electrum
30-
```
3123
32-
And then build from this directory:
3324
```
34-
$ git checkout $REV
35-
$ sudo docker run -it \
36-
--name electrum-wine-builder-cont \
37-
-v $PWD:/opt/wine64/drive_c/electrum-doi \
38-
--rm \
39-
--workdir /opt/wine64/drive_c/electrum-doi/contrib/build-wine \
40-
electrum-wine-builder-img \
41-
./build.sh
25+
$ ELECBUILD_COMMIT=HEAD ELECBUILD_NOCACHE=1 ./build.sh
4226
```
27+
4328
4. The generated binaries are in `./contrib/build-wine/dist`.
4429
4530

contrib/build-wine/apt.preferences

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ Package: *
22
Pin: release n=bullseye
33
Pin-Priority: 1001
44

5-
Package: win-iconv-mingw-w64-dev
6-
Pin: release a=unstable
7-
Pin-Priority: 1001
5+

contrib/build-wine/apt.sources.list

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
deb https://snapshot.debian.org/archive/debian/20220811T031049Z/ bullseye main non-free contrib
22
deb-src https://snapshot.debian.org/archive/debian/20220811T031049Z/ bullseye main non-free contrib
3-
deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20220811T031049Z/ sid main non-free contrib

contrib/build-wine/build.sh

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,10 @@
66

77
set -e
88

9-
here="$(dirname "$(readlink -e "$0")")"
10-
test -n "$here" -a -d "$here" || exit
11-
12-
if [ -z "$WIN_ARCH" ] ; then
13-
export WIN_ARCH="win32" # default
14-
fi
15-
if [ "$WIN_ARCH" = "win32" ] ; then
16-
export GCC_TRIPLET_HOST="i686-w64-mingw32"
17-
elif [ "$WIN_ARCH" = "win64" ] ; then
18-
export GCC_TRIPLET_HOST="x86_64-w64-mingw32"
19-
else
20-
echo "unexpected WIN_ARCH: $WIN_ARCH"
21-
exit 1
22-
fi
23-
24-
export BUILD_TYPE="wine"
25-
export GCC_TRIPLET_BUILD="x86_64-pc-linux-gnu"
26-
export GCC_STRIP_BINARIES="1"
27-
28-
export CONTRIB="$here/.."
29-
export PROJECT_ROOT="$CONTRIB/.."
30-
export CACHEDIR="$here/.cache/$WIN_ARCH"
31-
export PIP_CACHE_DIR="$CACHEDIR/wine_pip_cache"
32-
export WINE_PIP_CACHE_DIR="c:/electrum-doi/contrib/build-wine/.cache/$WIN_ARCH/wine_pip_cache"
33-
export DLL_TARGET_DIR="$CACHEDIR/dlls"
34-
35-
export WINEPREFIX="/opt/wine64"
36-
export WINEDEBUG=-all
37-
export WINE_PYHOME="c:/python3"
38-
export WINE_PYTHON="wine $WINE_PYHOME/python.exe -OO -B"
9+
PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../.."
10+
PROJECT_ROOT_OR_FRESHCLONE_ROOT="$PROJECT_ROOT"
11+
CONTRIB="$PROJECT_ROOT/contrib"
12+
CONTRIB_WINE="$CONTRIB/build-wine"
3913

4014
. "$CONTRIB"/build_tools_util.sh
4115

contrib/build-wine/deterministic.spec

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
44

5-
import sys
6-
for i, x in enumerate(sys.argv):
7-
if x == '--name':
8-
cmdline_name = sys.argv[i+1]
9-
break
10-
else:
5+
import sys, os
6+
7+
cmdline_name = os.environ.get("ELECTRUM_CMDLINE_NAME")
8+
if not cmdline_name:
119
raise Exception('no name')
1210

1311
home = 'C:\\electrum-doi\\'
@@ -22,6 +20,8 @@ hiddenimports += collect_submodules('keepkeylib')
2220
hiddenimports += collect_submodules('websocket')
2321
hiddenimports += collect_submodules('ckcc')
2422
hiddenimports += collect_submodules('bitbox02')
23+
hiddenimports += ['electrum.plugins.jade.jade']
24+
hiddenimports += ['electrum.plugins.jade.jadepy.jade']
2525
hiddenimports += ['PyQt5.QtPrintSupport'] # needed by Revealer
2626

2727

@@ -38,6 +38,7 @@ datas = [
3838
(home+'electrum/*.json', 'electrum'),
3939
(home+'electrum/lnwire/*.csv', 'electrum/lnwire'),
4040
(home+'electrum/wordlist/english.txt', 'electrum/wordlist'),
41+
(home+'electrum/wordlist/slip39.txt', 'electrum/wordlist'),
4142
(home+'electrum/locale', 'electrum/locale'),
4243
(home+'electrum/plugins', 'electrum/plugins'),
4344
(home+'electrum/gui/icons', 'electrum/gui/icons'),
@@ -52,6 +53,7 @@ datas += collect_data_files('bitbox02')
5253
# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
5354
a = Analysis([home+'run_electrum',
5455
home+'electrum/gui/qt/main_window.py',
56+
home+'electrum/gui/qt/qrreader/qtmultimedia/camera_dialog.py',
5557
home+'electrum/gui/text.py',
5658
home+'electrum/util.py',
5759
home+'electrum/wallet.py',
@@ -60,13 +62,13 @@ a = Analysis([home+'run_electrum',
6062
home+'electrum/dnssec.py',
6163
home+'electrum/commands.py',
6264
home+'electrum/plugins/cosigner_pool/qt.py',
63-
home+'electrum/plugins/email_requests/qt.py',
6465
home+'electrum/plugins/trezor/qt.py',
6566
home+'electrum/plugins/safe_t/client.py',
6667
home+'electrum/plugins/safe_t/qt.py',
6768
home+'electrum/plugins/keepkey/qt.py',
6869
home+'electrum/plugins/ledger/qt.py',
6970
home+'electrum/plugins/coldcard/qt.py',
71+
home+'electrum/plugins/jade/qt.py',
7072
#home+'packages/requests/utils.py'
7173
],
7274
binaries=binaries,
@@ -100,6 +102,14 @@ for x in a.datas.copy():
100102
a.datas.remove(x)
101103
print('----> Removed x =', x)
102104

105+
# not reproducible (see #7739):
106+
print("Removing *.dist-info/ from datas:")
107+
for x in a.datas.copy():
108+
if ".dist-info\\" in x[0].lower():
109+
a.datas.remove(x)
110+
print('----> Removed x =', x)
111+
112+
103113
# hotfix for #3171 (pre-Win10 binaries)
104114
a.binaries = [x for x in a.binaries if not x[1].lower().startswith(r'c:\windows')]
105115

@@ -114,7 +124,7 @@ exe_standalone = EXE(
114124
a.scripts,
115125
a.binaries,
116126
a.datas,
117-
name=os.path.join('build\\pyi.win32\\electrum-doi', cmdline_name + ".exe"),
127+
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + ".exe"),
118128
debug=False,
119129
strip=None,
120130
upx=False,
@@ -127,7 +137,7 @@ exe_portable = EXE(
127137
a.scripts,
128138
a.binaries,
129139
a.datas + [('is_portable', 'README.md', 'DATA')],
130-
name=os.path.join('build\\pyi.win32\\electrum-doi', cmdline_name + "-portable.exe"),
140+
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + "-portable.exe"),
131141
debug=False,
132142
strip=None,
133143
upx=False,
@@ -141,7 +151,7 @@ exe_inside_setup_noconsole = EXE(
141151
pyz,
142152
a.scripts,
143153
exclude_binaries=True,
144-
name=os.path.join('build\\pyi.win32\\electrum-doi', cmdline_name),
154+
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name),
145155
debug=False,
146156
strip=None,
147157
upx=False,
@@ -152,7 +162,7 @@ exe_inside_setup_console = EXE(
152162
pyz,
153163
a.scripts,
154164
exclude_binaries=True,
155-
name=os.path.join('build\\pyi.win32\\electrum-doi', cmdline_name+"-debug"),
165+
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name+"-debug"),
156166
debug=False,
157167
strip=None,
158168
upx=False,

contrib/build-wine/electrum.nsi

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
;--------------------------------
2+
;Include Modern UI
3+
!include "TextFunc.nsh" ;Needed for the $GetSize function. I know, doesn't sound logical, it isn't.
4+
!include "MUI2.nsh"
5+
6+
;--------------------------------
7+
;Variables
8+
9+
!define PRODUCT_NAME "Electrum"
10+
!define PRODUCT_WEB_SITE "https://github.com/spesmilo/electrum"
11+
!define PRODUCT_PUBLISHER "Electrum Technologies GmbH"
12+
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
13+
14+
;--------------------------------
15+
;General
16+
17+
;Name and file
18+
Name "${PRODUCT_NAME}"
19+
OutFile "dist/electrum-setup.exe"
20+
21+
;Default installation folder
22+
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
23+
24+
;Get installation folder from registry if available
25+
InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
26+
27+
;Request application privileges for Windows Vista
28+
RequestExecutionLevel admin
29+
30+
;Specifies whether or not the installer will perform a CRC on itself before allowing an install
31+
CRCCheck on
32+
33+
;Sets whether or not the details of the install are shown. Can be 'hide' (the default) to hide the details by default, allowing the user to view them, or 'show' to show them by default, or 'nevershow', to prevent the user from ever seeing them.
34+
ShowInstDetails show
35+
36+
;Sets whether or not the details of the uninstall are shown. Can be 'hide' (the default) to hide the details by default, allowing the user to view them, or 'show' to show them by default, or 'nevershow', to prevent the user from ever seeing them.
37+
ShowUninstDetails show
38+
39+
;Sets the colors to use for the install info screen (the default is 00FF00 000000. Use the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#', since # can be used for comments). Note that if "/windows" is specified as the only parameter, the default windows colors will be used.
40+
InstallColors /windows
41+
42+
;This command sets the compression algorithm used to compress files/data in the installer. (http://nsis.sourceforge.net/Reference/SetCompressor)
43+
SetCompressor /SOLID lzma
44+
45+
;Sets the dictionary size in megabytes (MB) used by the LZMA compressor (default is 8 MB).
46+
SetCompressorDictSize 64
47+
48+
;Sets the text that is shown (by default it is 'Nullsoft Install System vX.XX') in the bottom of the install window. Setting this to an empty string ("") uses the default; to set the string to blank, use " " (a space).
49+
BrandingText "${PRODUCT_NAME} Installer v${PRODUCT_VERSION}"
50+
51+
;Sets what the titlebars of the installer will display. By default, it is 'Name Setup', where Name is specified with the Name command. You can, however, override it with 'MyApp Installer' or whatever. If you specify an empty string (""), the default will be used (you can however specify " " to achieve a blank string)
52+
Caption "${PRODUCT_NAME}"
53+
54+
;Adds the Product Version on top of the Version Tab in the Properties of the file.
55+
VIProductVersion 1.0.0.0
56+
57+
;VIAddVersionKey - Adds a field in the Version Tab of the File Properties. This can either be a field provided by the system or a user defined field.
58+
VIAddVersionKey ProductName "${PRODUCT_NAME} Installer"
59+
VIAddVersionKey Comments "The installer for ${PRODUCT_NAME}"
60+
VIAddVersionKey CompanyName "${PRODUCT_NAME}"
61+
VIAddVersionKey LegalCopyright "2013-2018 ${PRODUCT_PUBLISHER}"
62+
VIAddVersionKey FileDescription "${PRODUCT_NAME} Installer"
63+
VIAddVersionKey FileVersion ${PRODUCT_VERSION}
64+
VIAddVersionKey ProductVersion ${PRODUCT_VERSION}
65+
VIAddVersionKey InternalName "${PRODUCT_NAME} Installer"
66+
VIAddVersionKey LegalTrademarks "${PRODUCT_NAME} is a trademark of ${PRODUCT_PUBLISHER}"
67+
VIAddVersionKey OriginalFilename "${PRODUCT_NAME}.exe"
68+
69+
;--------------------------------
70+
;Interface Settings
71+
72+
!define MUI_ABORTWARNING
73+
!define MUI_ABORTWARNING_TEXT "Are you sure you wish to abort the installation of ${PRODUCT_NAME}?"
74+
75+
!define MUI_ICON "..\..\electrum\gui\icons\electrum.ico"
76+
77+
;--------------------------------
78+
;Pages
79+
80+
!insertmacro MUI_PAGE_DIRECTORY
81+
!insertmacro MUI_PAGE_INSTFILES
82+
!insertmacro MUI_UNPAGE_CONFIRM
83+
!insertmacro MUI_UNPAGE_INSTFILES
84+
85+
;--------------------------------
86+
;Languages
87+
88+
!insertmacro MUI_LANGUAGE "English"
89+
90+
;--------------------------------
91+
;Installer Sections
92+
93+
;Check if we have Administrator rights
94+
Function .onInit
95+
UserInfo::GetAccountType
96+
pop $0
97+
${If} $0 != "admin" ;Require admin rights on NT4+
98+
MessageBox mb_iconstop "Administrator rights required!"
99+
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
100+
Quit
101+
${EndIf}
102+
FunctionEnd
103+
104+
Section
105+
SetOutPath $INSTDIR
106+
107+
;Uninstall previous version files
108+
RMDir /r "$INSTDIR\*.*"
109+
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
110+
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
111+
112+
;Files to pack into the installer
113+
File /r "dist\electrum\*.*"
114+
File "..\..\electrum\gui\icons\electrum.ico"
115+
116+
;Store installation folder
117+
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "" $INSTDIR
118+
119+
;Create uninstaller
120+
DetailPrint "Creating uninstaller..."
121+
WriteUninstaller "$INSTDIR\Uninstall.exe"
122+
123+
;Create desktop shortcut
124+
DetailPrint "Creating desktop shortcut..."
125+
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" ""
126+
127+
;Create start-menu items
128+
DetailPrint "Creating start-menu items..."
129+
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
130+
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
131+
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" 0
132+
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Testnet.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "--testnet" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" 0
133+
134+
135+
;Links bitcoin: and lightning: URIs to Electrum
136+
WriteRegStr HKCU "Software\Classes\bitcoin" "" "URL:bitcoin Protocol"
137+
WriteRegStr HKCU "Software\Classes\bitcoin" "URL Protocol" ""
138+
WriteRegStr HKCU "Software\Classes\bitcoin" "DefaultIcon" "$\"$INSTDIR\electrum.ico, 0$\""
139+
WriteRegStr HKCU "Software\Classes\bitcoin\shell\open\command" "" "$\"$INSTDIR\electrum-${PRODUCT_VERSION}.exe$\" $\"%1$\""
140+
WriteRegStr HKCU "Software\Classes\lightning" "" "URL:lightning Protocol"
141+
WriteRegStr HKCU "Software\Classes\lightning" "URL Protocol" ""
142+
WriteRegStr HKCU "Software\Classes\lightning" "DefaultIcon" "$\"$INSTDIR\electrum.ico, 0$\""
143+
WriteRegStr HKCU "Software\Classes\lightning\shell\open\command" "" "$\"$INSTDIR\electrum-${PRODUCT_VERSION}.exe$\" $\"%1$\""
144+
145+
;Adds an uninstaller possibility to Windows Uninstall or change a program section
146+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
147+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
148+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
149+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
150+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
151+
WriteRegStr HKCU "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\electrum.ico"
152+
153+
;Fixes Windows broken size estimates
154+
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
155+
IntFmt $0 "0x%08X" $0
156+
WriteRegDWORD HKCU "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0"
157+
SectionEnd
158+
159+
;--------------------------------
160+
;Descriptions
161+
162+
;--------------------------------
163+
;Uninstaller Section
164+
165+
Section "Uninstall"
166+
RMDir /r "$INSTDIR\*.*"
167+
168+
RMDir "$INSTDIR"
169+
170+
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
171+
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
172+
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
173+
174+
DeleteRegKey HKCU "Software\Classes\bitcoin"
175+
DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
176+
DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
177+
SectionEnd

0 commit comments

Comments
 (0)