1
0
Commit Graph

56 Commits

Author SHA1 Message Date
SomberNight
69093cc183 build: appimage: fix fresh_clone builds for type2-runtime
Building the appimage with ELECBUILD_COMMIT unset would work,
however building with it set would not.

regression from daaf7b7c6b
2026-01-22 16:43:17 +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
daaf7b7c6b appimage build: split out building type2-runtime into separate .sh 2025-09-26 14:24:19 +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
f321x
b93ffdd79d appimage: bump appimagetool to new version/repo
Updates the appimage build scripts to use the newer
https://github.com/AppImage/appimagetool tool to bundle the appimage
instead of the discontinued https://github.com/AppImage/AppImageKit.
To prevent the new appimagetool from downloading a random "latest"
appimage runtime (`type2-runtime`) binary this PR also adds
functionality to clone and build
https://github.com/AppImage/type2-runtime from source. This is done
using the build scripts provided in the `type2-runtime` repository,
however the Dockerfile they use for building is replaced by a copy with
pinned package versions to prevent issues with reproducibility.

This should fix the issue of missing libfuse2 which users of the appimage
have on "modern" distributions.
The new `type2-runtime` is statically linked and includes the required
dependencies now instead of relying on the host to provide it.
2025-08-12 11:06:11 +02:00
SomberNight
c9b6a6c01e build: fix repro builds where host userid != 1000
- repro builds to use fixed uid=1000 inside the container
  - in case the file permissions leak into the binaries, they are still reproducible
  - chown 1000:1000 fresh_clone
- repro builds to create fresh_clone dir outside git clone
  - otherwise the local dev build would still interact with the fresh_clone dir
    - due to e.g. recursive "find -exec touch",
    - and even the "docker build" cmd itself would try to stat/read it
      - see https://github.com/docker/for-linux/issues/380
  - and "rm -rf fresh_clone" needs sudo if the host uid is not 1000
  - this way the local dev build does not need sudo

to recap:
- local dev builds use the host userid inside the container, directly operate on the project dir
  - does not need sudo
- repro builds create a fresh git clone, chown it to 1000, and use userid=1000 inside the container
  - if the host userid is 1000, does not need sudo
  - otherwise, needs sudo

closes https://github.com/spesmilo/electrum/issues/8261
2023-03-20 23:32:59 +00:00
SomberNight
6e472efd5f build: follow-up prev: only use host userid for local dev builds
reproducibility probably needs a hardcoded userid

Also, move the UID arg later in the dockerfiles, for better caching.
(if local dev build and repro build set different UIDs, the build caches
will diverge at that step)
2023-03-20 02:06:54 +00:00
Sander van Grieken
ab073827cf build: use uid of user building the build containers 2023-03-20 02:06:50 +00:00
SomberNight
0df8392c86 build: rm need for sudo in most places; and do not run as root
This includes two logically separate changes:
- on the host, try not to require sudo when running the build scripts
    - namely when interacting with the docker daemon, this requires
      the unix user on the host to be part of the `docker` group
    - this solves part of https://github.com/spesmilo/electrum/issues/7602
- while running inside the docker containers, do not run as root
    - this means that e.g. files created in mounted folders should
      no longer be owned by root on the host
    - there is some code duplication involved here - not sure
      how it could be deduped.
2022-03-03 19:24:18 +01:00
SomberNight
9d46fe775a build: try to consolidate instructions and decr codedupe in release.sh 2021-06-18 17:10:15 +02:00
SomberNight
3df1c3bbf7 build: rename some scripts
also, merge sdist/build.sh and sdist/make_tgz into sdist/make_sdist.sh
2021-06-18 16:29:03 +02:00
SomberNight
c23fca37d4 build: clarify which locale files are included
related: 2cb4e56be3
2021-03-31 17:00:39 +02:00
Axel Gembe
6e1caf7e88 AppImage build: Include libxcb into the image
Ubuntu 20.04 needs `libxcb-xinerama.so.0`
and Debian 10 needs `libxcb-util.so.1` for the Qt `xcb` plugin.

-----

ported from 380f04a805

see https://github.com/Electron-Cash/Electron-Cash/issues/2196

-----

In particular, see this comment:

>> I confirmed that both Ubuntu 20.04 and Debian 10.8 clean install have an issue with the 4.2.4 AppImage.
>
> Any idea what broke it? I assume it used to work.

Yes, it did work in 4.2.3 which used PyQt5 5.13.2. I just had a look at the xcb plugin and it definitely has less dependencies:
```
ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb
        libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f0ec9d07000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f0ec9cdd000)
        libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f0ec6ead000)
```

compared to PyQt5 5.15.2 in 4.2.4:
```
ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.8/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb
        libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fcb5715f000)
        libxcb-icccm.so.4 => /lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007fcb57158000)
        libxcb-image.so.0 => /lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007fcb56f51000)
        libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fcb56f4c000)
        libxcb-util.so.1 => /lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007fcb56d46000)
        libxcb-keysyms.so.1 => /lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007fcb56d41000)
        libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007fcb56d2e000)
        libxcb-render-util.so.0 => /lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007fcb56d27000)
        libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fcb56d16000)
        libxcb-shape.so.0 => /lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007fcb56d11000)
        libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fcb56d07000)
        libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007fcb56cfd000)
        libxcb-xinerama.so.0 => /lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007fcb56cf8000)
        libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007fcb56cda000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcb56cae000)
```
2021-03-27 21:41:09 +01:00
SomberNight
eaffced6dd binaries: bump python version 2021-03-13 16:52:19 +01:00
SomberNight
6e6e956de4 appimage build: adapt to new PyQt (5.15.3+) layout 2021-03-13 16:52:15 +01:00
SomberNight
dded25f398 windows build: cache pip downloads 2021-03-07 22:12:26 +01:00
SomberNight
3d640dfc1f windows binaries: bump python version (3.7.9->3.8.7)
Had to also bump ubuntu version 18.04->20.04,
as was getting errors running the self-compiled pyinstaller otherwise (weird...):

```
from .utils.git import get_repo_revision
ModuleNotFoundError: No module named 'PyInstaller.utils'
```
(similar to https://github.com/pyinstaller/pyinstaller/issues/4403 )

-----

Note re appimage: when trying to compile python 3.8.x on ubuntu 16.04, I am getting:

./Modules/posixmodule.c: In function ‘os_copy_file_range_impl’:
./Modules/posixmodule.c:10351:15: error: implicit declaration of function ‘copy_file_range’ [-Werror=implicit-function-declaration]
         ret = copy_file_range(src, p_offset_src, dst, p_offset_dst, count, flags);

This is because ubuntu 16.04 has too old glibc.
2021-01-12 02:28:35 +01:00
SomberNight
19f806ddf4 build: don't allow setuptools to sneakily install build-time deps
see https://pip.pypa.io/en/stable/reference/pip_install/#controlling-setup-requires
> Setuptools offers the setup_requires setup() keyword for specifying
> dependencies that need to be present in order for the setup.py
> script to run. Internally, Setuptools uses easy_install to
> fulfill these dependencies.
> pip has no way to control how these dependencies are located.
> None of the package index options have an effect.

With these changes, we will now instead hard fail if this were to happen.

related: https://github.com/spesmilo/electrum/issues/5859#issuecomment-743621898
2020-12-12 02:52:38 +01:00
SomberNight
4ca2a5cf3e appimage build: build most of our python dependencies from source
instead of using pre-built binary wheels from PyPI
2020-12-09 16:38:03 +01:00
SomberNight
a4e342ac58 requirements: rename some files 2020-11-14 04:30:48 +01:00
SomberNight
9204102663 binaries: pip install build requirements first
I no longer trust pip to install packages from a requirements.txt file in the correct order.
For reproducibility, let's install pip/setuptools/wheels/cython first.

see https://github.com/pypa/pip/issues/2362#issuecomment-418423458
see #5859 and #6382
2020-09-08 16:44:35 +02:00
SomberNight
4f46741c52 binaries: bump python version (3.7.7->3.7.9) 2020-09-08 16:44:24 +02:00
SomberNight
f5f3394552 git sanity: enforce "git checkout commithash" actually pulls commit
If there is a collision between a branch name and a commit hash, git
will choose the branch, even if the full 40-hex-long commit hash is
given. GitHub disallows branches/tags with such a name but git itself
does not. By adding the `^{commit}` syntax sugar after a ref name,
we can tell git that we want the commit hash to be preferred,
and hence we don't need to trust GitHub (only git).

see https://security.stackexchange.com/questions/225411/
2020-06-16 19:55:17 +02:00
SomberNight
b0230f6a4b build: fix win/appimage binaries following jsonrpc dep-removal
follow-up #6220
2020-06-11 05:37:52 +02:00
SomberNight
7143e9199f binaries: bump python version (3.7.6->3.7.7) 2020-05-14 20:24:07 +02:00
SomberNight
4cec098d2d build: create a standalone build script for libsecp256k1
heavily based on Electron-Cash/Electron-Cash@eda015908e
2020-02-11 16:48:24 +01:00
SomberNight
a5cd34dc08 follow-up prev (oops, only committed part of the changes) 2020-01-22 18:26:29 +01:00
Axel Gembe
4406eebbfe Build: Uninstall Cython from AppImage
Cython is not needed at runtime.

-----

taken from c64910055d

related #5859
2020-01-22 12:27:17 +01:00
SomberNight
80025a3af4 requirements-hw: re-add Cython
this reverts ec496a8222
Cython must be pinned down for reproducible builds
related #5859
2020-01-22 12:08:30 +01:00
SomberNight
1c4728ecc6 appimage binary: bump python version (3.6.8->3.7.6) 2020-01-16 19:12:24 +01:00
SomberNight
7c090f92ce binaries: use "--no-dependencies" option for pip install
All (incl indirect) dependencies are already listed in deterministic-build/requirements*.txt.
This option makes it easier to manually rm a dependency from that list for e.g. testing.
2020-01-10 19:01:32 +01:00
Axel Gembe
880bd16883 AppImage: Improve binary stripping
Slightly reduces file size, improves build speed and makes build more
reproducible.

The .comment section contained GCC version information which could cause
different build output from just a minor update in GCC. The information is not
needed so we strip this.

The strip command was invoked using xargs, spawning a new process for each file.
This is inefficient as xargs can correctly run the strip command with multiple
file names.

-----

taken from 43aaf9572f
2019-12-17 21:41:17 +01:00
SomberNight
b381fd84fb build: when building libsecp256k1, patch Makefile.am before autogen.sh
apparently this could have caused issues on MacOS

based on Electron-Cash/Electron-Cash@69f6cd0aa0
2019-09-08 18:47:30 +02:00
SomberNight
3d7cb935ff appimage: don't rm jsonschema-*.dist-info as pkg needs it 2019-09-02 19:21:53 +02:00
SomberNight
fc5248550c appimage build: change base to ubuntu 16.04
ubuntu 14.04 is EOL
2019-08-09 20:56:20 +02:00
SomberNight
249e3d496b appimage build: rm "build" folder if present as it makes build non-reproducible
AFAICT the "build" is created if you "python setup.py install" electrum,
which is now deprecated in any case.
2019-07-19 04:52:26 +02:00
SomberNight
c67705e116 appimage build: build was failing on some host systems
On Ubuntu host, build succeeded; but e.g. on Manjaro host, it failed with:
```
./build.sh: line 233: /opt/electrum/contrib/build-linux/appimage/../../../contrib/build-linux/appimage/.cache/appimage/appimagetool: No such file or directory
```
2019-07-10 20:26:25 +02:00
Axel Gembe
69b673b8a1 AppImage: Bundle more binaries to increase compatibility
This slightly increases the AppImage size but allows us to be more
compatible with older distributions.

-----

taken from Electron-Cash/Electron-Cash@96644acd6f
2019-07-04 23:35:52 +02:00
Axel Gembe
0d1a473bb0 AppImage: Disable pip warnings about script install locations
It warns about scripts being installed in a location that is not on the
path, but that is inconsequential as they are not used.

-----

taken from Electron-Cash/Electron-Cash@9a29017c5d
2019-07-04 22:31:56 +02:00
SomberNight
9f28f8bcc6 Appimage: follow-up b69249f6c3
libsecp256k1.a needs to be deleted as it's not reproducible...
2019-06-23 04:17:46 +02:00
SomberNight
266484e0fd Appimage: nits. use "fail"
somewhat based on same script in Electron-Cash/Electron-Cash
2019-06-23 04:13:28 +02:00
Axel Gembe
bb59a1298a AppImage: Patch Python sysconfigdata
When building in docker on macOS, python builds with .exe extension
because the case insensitive file system of macOS leaks into docker.
This causes the build to result in a different output on macOS compared
to Linux. We simply patch sysconfigdata to remove the extension.

Some more info: https://bugs.python.org/issue27631
2019-06-23 04:13:23 +02:00
SomberNight
ec496a8222 requirements-hw: rm Cython
not actually needed
based on Electron-Cash/Electron-Cash@70de1a2b53
2019-06-23 03:06:36 +02:00
Axel Gembe
b69249f6c3 AppImage: Remove unused binaries
There are a lot of dupliacted files, testing files and unused libraries
present in the AppImage. Removing these reduces the AppImage size
significantly.

-----

taken from Electron-Cash/Electron-Cash@cff5fb1289
2019-06-23 02:56:33 +02:00
Axel Gembe
501fd8f9e5 AppImage: Improve reproducible Python build reliability on Linux
There was a problem where Python would not properly include the faketime
timestamp sometimes. This patch replaces faketime with a patch that is
used by Ubuntu for reproducible builds by exporting BUILD_DATE and
BUILD_TIME with the desired values.

-----

taken from Electron-Cash/Electron-Cash@9532508a3f
2019-06-23 02:47:16 +02:00
Axel Gembe
ae714772c3 AppImage: Make build reproducible
We build our own mksquashfs from squashfskit which supports generating
reproducible squashfs images. We use a small wrapper script to remove
the -mkfs-fixed-time which appimagekit passes but squashfskits
mksquashfs does not support.

-----

taken from Electron-Cash/Electron-Cash@dd1f106f4f
see AppImage/AppImageKit#929
2019-06-23 02:40:29 +02:00
SomberNight
c7b64f4794 AppImage: update appimagetool version 2019-06-11 20:24:51 +02:00
SomberNight
63e5119ceb builds: parallelise "make" by setting "-j4" 2019-06-11 20:02:28 +02:00
Axel Gembe
cd52350f5d AppImage: Remove unused PyQt5 modules
We already delete unused Qt modules, but we weren't deleting their PyQt5 modules.

-----

taken from Electron-Cash/Electron-Cash@e044c94677
2019-05-15 19:04:42 +02:00
Axel Gembe
5afda62ee3 AppImage: Remove Qt.so to prevent importing from PyQt5.Qt
Importing from PyQt5.Qt is an unnecessary fallback that loads every PyQt5 module.

-----

taken from Electron-Cash/Electron-Cash@d69471b31d
2019-05-15 19:03:18 +02:00