1
0
Commit Graph

144 Commits

Author SHA1 Message Date
SomberNight
16fcfe34a7 build: rm "contrib" from debian apt sources lists 2023-04-18 16:09:50 +00:00
SomberNight
f25e384654 build: fail if not inside git clone
related: https://github.com/spesmilo/electrum/issues/8284
2023-03-28 22:35:19 +00: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
08ae0a73b2 build: add separate .dockerignore files
The .dockerignore symlink in the project root dir is only picked up by the android build.
The android build has the project root as its build context for "docker build" --
the other builds have their own subdirectories as build context, e.g. contrib/build-linux/appimage.
2023-03-20 02:05:40 +00:00
SomberNight
d8abab34d8 build: rm "non-free" from debian apt sources lists
was not needed, and better to avoid :)
2023-03-18 06:22:38 +00:00
Sander van Grieken
65abb90049 build: update build container base image versions, update apt sources to current 2023-02-27 11:16:04 +01:00
ghost43
0eea47c78d libsecp256k1: update hardcoded .so lib name in binaries (#8186)
follow-up 7d83335e34
2023-02-04 01:36:19 +00:00
SomberNight
65ae281180 build: don't hardcode num worker threads "make -j4" 2022-12-03 22:50:18 +00:00
Sander van Grieken
acde8cd0b7 add apt --allow-downgrades in more places.
build sdist also from debian bullseye container
2022-11-06 10:55:10 +01:00
Sander van Grieken
c0772019f1 rerun freeze_container_distro.sh and update docker base images for debian buster and bullseye 2022-11-06 10:42:39 +01:00
SomberNight
1e404f4e30 binaries: update python and openssl
note: python 3.9.x is now in source-only mode, so could not update to latest...
it is time to investigate upgrading to python 3.10 in the win and mac binaries
2022-11-05 14:41:23 +00:00
SomberNight
6f311c8930 appimage build: better caching, both locally and on CI 2022-11-04 15:49:16 +00:00
SomberNight
34488478e6 appimage build: build and include libxcb-util1
fixes https://github.com/spesmilo/electrum/issues/8011

> Upgraded from Appimage 4.1.5 to 4.3.2 on MX-Linux 19.
> The new version fails to start with:
>
> ```
> $ electrum
> qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
> This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may > fix this problem.
>
> Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
>
> Aborted (core dumped)
> ```

debian 10 only distributes libxcb-util0.
debian 11 distributes libxcb-util1.
our base image atm is debian 10, so we build the package from source.
2022-10-11 18:24:02 +00:00
SomberNight
b5900eae98 contrib: reformat most shell scripts
Mostly just indentations.
For consistency, to conform to .editorconfig.
2022-09-27 14:55:22 +00:00
SomberNight
1cecd2c6e8 contrib: rename some shell scripts to have ".sh" extension
The extension gives formatting hints to some editors. (especially if they support .editorconfig)
2022-09-27 13:34:03 +00:00
SomberNight
0abecffe6d mac build: force using source dist for most of our python dependencies
We compile from tar.gz, instead of using pre-built binary wheels from PyPI.
(or if the dep is pure-python, use tar.gz instead of "source-only" wheel)

-----
Some unorganised things below for future reference.

```
$ dsymutil -dump-debug-map dist1/hid.cpython-39-darwin.so
warning: (x86_64) /private/var/folders/1n/zc14m3td0rg4nt0ftklmm7z00000gn/T/pip-install-bm88zvc1/hidapi_cd307bc31ab34252b77d11d6d7212fc5/build/temp.macosx-10.9-x86_64-3.9/hid.o unable to open object file: No such file or directory
warning: (x86_64) /private/var/folders/1n/zc14m3td0rg4nt0ftklmm7z00000gn/T/pip-install-bm88zvc1/hidapi_cd307bc31ab34252b77d11d6d7212fc5/build/temp.macosx-10.9-x86_64-3.9/hidapi/mac/hid.o unable to open object file: No such file or directory
---
triple:          'x86_64-apple-darwin'
binary-path:     'dist1/hid.cpython-39-darwin.so'
...
```

```
$ nm -pa dist1/hid.cpython-39-darwin.so
```

- https://stackoverflow.com/questions/10044697/where-how-does-apples-gcc-store-dwarf-inside-an-executable
- https://github.com/pypa/pip/issues/6505
- https://github.com/pypa/pip/issues/7808#issuecomment-770275723
- https://github.com/NixOS/nixpkgs/pull/91272
- https://github.com/cython/cython/pull/1576
- 9d2ba1611b/Cython/Compiler/ModuleNode.py (L913)
2022-09-26 12:16:02 +00:00
SomberNight
4f574afe5a Merge remote-tracking branch 'remotes/spesmilo/appimage-debian-base'
Change Docker base images from Ubuntu to Debian, and use `snapshot.debian.org` as apt source list.
Ubuntu occasionally removes version-pinned packages from apt (see #7484), which
- breaks historical reproducible builds
- introduces maintenance burden as we have to update the version pins
Hopefully this change fixes both issues.

merges https://github.com/spesmilo/electrum/pull/7926
closes https://github.com/spesmilo/electrum/issues/7484
2022-08-22 13:10:25 +00:00
SomberNight
019d213325 Revert "mac build: force using source dist for most of our python dependencies"
This reverts commit 0c2a885c66.

Reverting for now due to reproducibility issues:
```
error: /Users/vagrant/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate: can't open file: /tmp/electrum_compare_dmg/signed_app/Electrum.app/Contents/MacOS/libffi.8.dylib (No such file or directory)
```
`Electrum.app/Contents/MacOS/libffi.8.dylib` is included when building on one machine, but missing on the other...
Will have to investigate later.

related https://github.com/spesmilo/electrum/pull/7918
2022-08-17 17:07:22 +00:00
SomberNight
c2b5e3ec15 build: use build-locale.sh in all build scripts 2022-08-16 19:06:47 +00:00
SomberNight
d0de44a794 build: also build a "source-only" linux-packager-friendly tarball
We now distribute two tarballs, a "normal" one (the default, recommended for users),
and a new strictly source-only one (for Linux distro packagers).
The normal tarball, in addition to including everything from
the source-only one, also includes:
- compiled (`.mo`) locale files (in addition to source `.po` locale files)
- compiled (`_pb2.py`) protobuf files (in addition to source `.proto` files)
- the `packages/` folder containing source-only pure-python runtime dependencies

merges https://github.com/spesmilo/electrum/pull/7594
with follow-ups
2022-08-16 17:28:41 +00:00
SomberNight
7d36f2ba3a build: follow-up source-only tarballs 2022-08-16 17:23:08 +00:00
yanmaani
9a37184a57 build: create source-only tarball in release.sh 2022-08-15 12:00:00 +00:00
Sander van Grieken
f63df43614 wine: rename freeze_appimage_distro.sh to freeze_containers_distro.sh and
adapt build-wine container to Debian+snapshots base
2022-08-11 12:36:48 +02:00
Sander van Grieken
a1975e2449 appimage: add freeze_appimage_distro.sh and adapt Dockerfile to use debian buster base 2022-08-11 12:15:22 +02:00
SomberNight
7e2fab809d appimage build: better parameterise python version 2022-08-10 21:03:55 +02:00
SomberNight
0c2a885c66 mac build: force using source dist for most of our python dependencies
We compile from tar.gz, instead of using pre-built binary wheels from PyPI.
(or if the dep is pure-python, use tar.gz instead of "source-only" wheel)

-----
Some unorganised things below for future reference.

```
$ dsymutil -dump-debug-map dist1/hid.cpython-39-darwin.so
warning: (x86_64) /private/var/folders/1n/zc14m3td0rg4nt0ftklmm7z00000gn/T/pip-install-bm88zvc1/hidapi_cd307bc31ab34252b77d11d6d7212fc5/build/temp.macosx-10.9-x86_64-3.9/hid.o unable to open object file: No such file or directory
warning: (x86_64) /private/var/folders/1n/zc14m3td0rg4nt0ftklmm7z00000gn/T/pip-install-bm88zvc1/hidapi_cd307bc31ab34252b77d11d6d7212fc5/build/temp.macosx-10.9-x86_64-3.9/hidapi/mac/hid.o unable to open object file: No such file or directory
---
triple:          'x86_64-apple-darwin'
binary-path:     'dist1/hid.cpython-39-darwin.so'
...
```

```
$ nm -pa dist1/hid.cpython-39-darwin.so
```

- https://stackoverflow.com/questions/10044697/where-how-does-apples-gcc-store-dwarf-inside-an-executable
- https://github.com/pypa/pip/issues/6505
- https://github.com/pypa/pip/issues/7808#issuecomment-770275723
- https://github.com/NixOS/nixpkgs/pull/91272
- https://github.com/cython/cython/pull/1576
- 9d2ba1611b/Cython/Compiler/ModuleNode.py (L913)
2022-08-06 07:52:03 +02:00
gruve-p
bc5b5eb0b1 appimage: Bump git
https://launchpad.net/ubuntu/+source/git/1:2.17.1-1ubuntu0.12
2022-07-20 15:45:01 +02:00
gruve-p
e50db4bf2b appimage: update libssl-dev libssl1.1 openssl
Windows image: update gnupg2 dirmngr
2022-07-09 14:41:41 +02:00
yanmaani
2da1859110 build: support OMIT_UNCLEAN_FILES in sdist/build.sh 2022-07-04 12:00:00 +00:00
yanmaani
a7e17ae4ee build: add OMIT_UNCLEAN_FILES option to make_sdist.sh 2022-07-04 12:00:00 +00:00
yanmaani
45b8f11c68 build: refactor out locale generation into build_locale.sh 2022-07-04 12:00:00 +00:00
gruve-p
29ab90e1b1 appimage: update libssl-dev libssl1.1 openssl (#7869) 2022-06-24 05:05:09 +00:00
SomberNight
1fedb23946 appimage: update package (libdbus-1-3) in dockerfile 2022-05-11 18:08:36 +02:00
gruve-p
eb66ed8e4b appimage: update libssl-dev libssl1.0.0 openssl libsqlite3-dev (#7798) 2022-05-05 14:57:35 +00:00
ghost43
c45170acfb Merge pull request #7785 from SomberNight/202204_bump_appimage
build appimage: bump pkg2appimage version
2022-04-26 18:29:10 +00:00
Michel van Kessel
54f5ad46b3 appimage: update package (git) in dockerfile (#7786)
https://launchpad.net/ubuntu/+source/git/1:2.17.1-1ubuntu0.11
2022-04-26 18:28:29 +00:00
SomberNight
6633ef4c35 build appimage: bump pkg2appimage version
should fix https://github.com/spesmilo/electrum/issues/7784
by including commit 1e3ecde6b9
2022-04-25 21:04:46 +02:00
gruve-p
75044f334b appimage: update git 2022-04-14 22:53:46 +02:00
SomberNight
634611272a build appimage: make binary somewhat smaller by excluding stuff
4.1.5->4.2.1, the appimage grew 54M->66M. This change shrinks it back to 58M.
```
$ ls -lah
total 224M
drwxrwxr-x  5 user user 4.0K Mar 27 18:18 .
drwxrwxr-x 16 user user 4.0K Mar 23 16:02 ..
-rwxrw-r--  1 user user  48M Dec 18  2020 electrum-4.0.9-x86_64.AppImage
-rwxrw-r--  1 user user  54M Jan 19 14:25 electrum-4.1.5-x86_64.AppImage
-rwxr-xr-x  1 user user  58M Mar 27 18:12 electrum-4.2.1-dirty-x86_64.AppImage
-rwxrw-r--  1 user user  66M Mar 27 15:00 electrum-4.2.1-x86_64.AppImage
```
I've used the great `ncdu` tool to investigate file sizes.
```
$ du squashfs-root-415/usr/lib/python3.7/ --max-depth=1 | sort -nr | head -n8
154608	squashfs-root-415/usr/lib/python3.7/
138864	squashfs-root-415/usr/lib/python3.7/site-packages
4720	squashfs-root-415/usr/lib/python3.7/lib-dynload
1744	squashfs-root-415/usr/lib/python3.7/encodings
664	squashfs-root-415/usr/lib/python3.7/pydoc_data
460	squashfs-root-415/usr/lib/python3.7/distutils
460	squashfs-root-415/usr/lib/python3.7/asyncio
436	squashfs-root-415/usr/lib/python3.7/email

$ du squashfs-root-421/usr/lib/python3.9/ --max-depth=1 | sort -nr | head -n8
194088	squashfs-root-421/usr/lib/python3.9/
143512	squashfs-root-421/usr/lib/python3.9/site-packages
33824	squashfs-root-421/usr/lib/python3.9/config-3.9-x86_64-linux-gnu
5244	squashfs-root-421/usr/lib/python3.9/lib-dynload
1720	squashfs-root-421/usr/lib/python3.9/encodings
696	squashfs-root-421/usr/lib/python3.9/pydoc_data
520	squashfs-root-421/usr/lib/python3.9/asyncio
464	squashfs-root-421/usr/lib/python3.9/distutils
```
We should delete `usr/lib/python3.9/config-3.9-x86_64-linux-gnu/` (which is 33M unpacked)
With py3.7 (electrum 4.1.5), this folder was named `config-3.7m-x86_64-linux-gnu`,
presumably because the default config to compile py3.7 was `--with-pymalloc`,
but maybe it is not for py3.9... ? not sure. (see https://peps.python.org/pep-3149/ )
2022-03-27 19:27:55 +02:00
SomberNight
98d32f41d5 build: (reproducibility) always uses "pip install" with "--no-build-isolation"
fixes https://github.com/spesmilo/electrum/issues/7737
fixes https://github.com/spesmilo/electrum/issues/7736
related 8559d1eb72
2022-03-26 02:45:47 +01:00
SomberNight
1bb7ef92e7 binaries: bump python 3.9.10->3.9.11; and for android 3.8.12->3.8.13
This is bumping the python versions bundled inside our binaries.
For macOS and AppImage, from 3.9.10 to 3.9.11.
For Android, from 3.8.12 to 3.8.13.

Windows is left untouched as I am having issues with the wine build when using 3.9.11.
(see https://github.com/spesmilo/electrum/pull/7721#issuecomment-1071901116 )
2022-03-18 16:21:24 +01:00
gruve-p
1aa831c7d9 appimage: update libssl-dev libssl1.0.0 openssl (#7715) 2022-03-15 23:45:49 +00:00
SomberNight
b726fe85e1 contrib: add docker_notes.md 2022-03-03 19:24:22 +01: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
cdfc75ff2b appimage: update package (libc) in dockerfile
Ubuntu no longer serves old version
2022-03-03 19:22:52 +01:00
SomberNight
5e2cee6a31 build appimage: rm importlib-metadata workaround
The importlib-metadata pkg is no longer needed apparently (since we bumped the min python to 3.8).
2022-02-22 17:14:23 +01:00
SomberNight
bb5b52f2d7 binaries: bump python 3.9.7->3.9.10 2022-02-17 16:51:13 +01:00
SomberNight
8559d1eb72 build: android reprod: "pip install" needs "--no-build-isolation"
maybe fixes https://github.com/spesmilo/electrum/issues/7640

Looks like by default pip is ignoring the locally available setuptools and wheel,
and downloading the latest ones from the internet at build time...

https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/?highlight=no-build-isolation#disabling-build-isolation
https://stackoverflow.com/a/62889268

> When making build requirements available, pip does so in an isolated environment. That is, pip does not install those requirements into the user’s site-packages, but rather installs them in a temporary directory which it adds to the user’s sys.path for the duration of the build. This ensures that build requirements are handled independently of the user’s runtime environment. For example, a project that needs a recent version of setuptools to build can still be installed, even if the user has an older version installed (and without silently replacing that version).
>
> In certain cases, projects (or redistributors) may have workflows that explicitly manage the build environment. For such workflows, build isolation can be problematic. If this is the case, pip provides a --no-build-isolation flag to disable build isolation. Users supplying this flag are responsible for ensuring the build environment is managed appropriately (including ensuring that all required build dependencies are installed).

If only it were that easy!
If we add the "--no-build-isolation" flag, it becomes our responsibility to install *all* build time deps,
hence we now have "requirements-build-makepackages.txt".
2022-01-22 14:49:35 +01:00