Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ jobs:
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl git build-essential pkg-config file dpkg-dev rpm \
libxkbcommon-dev libgtk-3-dev libwayland-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
libxkbcommon-dev libgtk-3-dev libwayland-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
patchelf libxkbcommon-x11-0 libxcursor1 libxi6
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.0
- uses: taiki-e/install-action@v2
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ its GitHub release ([docs/releasing.md](docs/releasing.md)).

## [0.1.2] - unreleased

- **AppImage on more systems:** the AppImage carries the keyboard and cursor libraries
of X11 (xkbcommon, Xcursor, Xi), so the editor and the parts manager start on systems
without them instead of quitting with *Library libxkbcommon-x11.so could not be
loaded*.
- **Invisible grid lines:** connection points and wire ends off the drawing grid, as in
imported drawings or on device boxes of any size, add invisible grid lines through
them. The pointer snaps to them where they are nearer than the grid, so wires can be
Expand Down
5 changes: 4 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bash installer/linux/build.sh flatpak snap # sandboxed packages
| --- | --- | --- | --- |
| Debian, Ubuntu | `openecraft_<version>_amd64.deb` | `sudo apt install ./openecraft_*.deb` | `dpkg-dev` |
| Fedora, RHEL, openSUSE | `openecraft-<version>-1.x86_64.rpm` | `sudo dnf install ./openecraft-*.rpm` | `rpmbuild` |
| Any distribution | `OpenECraft-<version>-x86_64.AppImage` | `chmod +x`, start it | `appimagetool` and its runtime (downloaded, checksums verified) |
| Any distribution | `OpenECraft-<version>-x86_64.AppImage` | `chmod +x`, start it | Debian or Ubuntu, `patchelf`, `appimagetool` and its runtime (downloaded, checksums verified) |
| Any distribution | `OpenECraft-<version>-x86_64.flatpak` | `flatpak install --user OpenECraft-*.flatpak` | `flatpak-builder` |
| Any distribution | `openecraft_<version>_amd64.snap` | `sudo snap install --dangerous openecraft_*.snap` | `snapcraft` |
| Any distribution | `OpenECraft-<version>-linux-x86_64.tar.gz` | `./install.sh` (to `~/.local`) | `tar` |
Expand All @@ -81,6 +81,9 @@ the Flatpak with `flatpak run --command=openecraft-cli io.github.nilres.OpenECra
and in the snap as `openecraft.cli`, `openecraft.parts-manager`, … CI builds them on every
push (artifacts `openecraft-linux-packages`, `openecraft-flatpak`, `openecraft-snap`);
deb, rpm, AppImage and tar.gz are built on Debian 12 and run with glibc 2.36 or newer.
The AppImage carries the window libraries that are not on every system (xkbcommon,
Xcursor, Xi: `appimage_libs` in `installer/linux/build.sh`); the build refuses one that
needs another library or a newer glibc than the programs.
The desktop entries, MIME types and AppStream data (`io.github.nilres.OpenECraft`) are
in `installer/linux/`; a new version needs a `<release>` in the metainfo file.

Expand Down
56 changes: 54 additions & 2 deletions installer/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#
# deb dpkg-deb, dpkg-shlibdeps (apt install dpkg-dev)
# rpm rpmbuild (dnf install rpm-build, apt install rpm)
# appimage appimagetool (APPIMAGETOOL=<path>, otherwise release 1.9.1 is downloaded) and
# the AppImage runtime (release 20251108, downloaded; both checksums verified)
# appimage Debian or Ubuntu (dpkg-query), patchelf, appimagetool (APPIMAGETOOL=<path>,
# otherwise release 1.9.1 is downloaded) and the AppImage runtime (release
# 20251108, downloaded; both checksums verified)
# flatpak flatpak, flatpak-builder (the runtime is installed from Flathub)
# snap snapcraft (SNAPCRAFT="sudo snapcraft" SNAPCRAFT_ARGS=--destructive-mode in CI)
#
Expand Down Expand Up @@ -168,10 +169,61 @@ download() {
fi
}

# The window libraries winit loads at run time that are not on every system, with what
# they need. The AppImage carries them; the libraries of the AppImage excludelist
# (libX11, libxcb, libwayland-client, libGL, libEGL, …) and the Wayland libraries tied to
# libwayland-client come from the system.
appimage_libs=(libxkbcommon.so.0 libxkbcommon-x11.so.0 libxcb-xkb.so.1 libXcursor.so.1 libXrender.so.1
libXfixes.so.3 libXi.so.6 libXext.so.6)
appimage_system_libs=(libc.so.6 libm.so.6 libdl.so.2 libpthread.so.0 librt.so.1 libutil.so.1 libgcc_s.so.1
ld-linux-x86-64.so.2 ld-linux-aarch64.so.1 libX11.so.6 libX11-xcb.so.1 libxcb.so.1 libz.so.1)

# bundle_libs <AppDir>: copies appimage_libs to usr/lib and their packages' copyright
# files to usr/share/doc, makes the editor and the parts manager look there first and refuses a library the AppImage neither has nor may expect.
# $ORIGIN is for patchelf, not the shell.
# shellcheck disable=SC2016
bundle_libs() {
local dir="$1" lib path pkg file need
need patchelf appimage
need readelf appimage
need ldconfig appimage
need dpkg-query "the licenses of the libraries in the AppImage (build it on Debian or Ubuntu)"
install -d "$dir/usr/lib"
for lib in "${appimage_libs[@]}"; do
path="$(ldconfig -p | awk -v lib="$lib" '$1 == lib && !found { print $NF; found = 1 }')"
[ -n "$path" ] || die "$lib not found, needed for appimage"
path="$(readlink -f "$path")"
install -m 644 "$path" "$dir/usr/lib/$lib"
patchelf --set-rpath '$ORIGIN' "$dir/usr/lib/$lib"
pkg="$(dpkg-query -S "*/${path##*/}" | awk -F : 'NR == 1 { print $1 }')" || die "no package contains $path"
install -D -m 644 "/usr/share/doc/$pkg/copyright" "$dir/usr/share/doc/$pkg/copyright"
done
patchelf --set-rpath '$ORIGIN/../lib' "$dir/usr/bin/openecraft" "$dir/usr/bin/openecraft-parts-manager"
for file in "$dir"/usr/bin/* "$dir"/usr/lib/*; do
for need in $(readelf -d "$file" | sed -n 's/.*(NEEDED).*\[\(.*\)\]$/\1/p'); do
[ -e "$dir/usr/lib/$need" ] || [[ " ${appimage_system_libs[*]} " == *" $need "* ]] \
|| die "$need, needed by ${file##*/}, is neither in the AppImage nor on every system"
done
done
local bins_glibc libs_glibc
bins_glibc="$(glibc_needed "$dir"/usr/bin/*)"
libs_glibc="$(glibc_needed "$dir"/usr/lib/*)"
[ "$(printf '%s\n' "$bins_glibc" "$libs_glibc" | sort -V | tail -n 1)" = "$bins_glibc" ] \
|| die "the libraries for the AppImage need $libs_glibc, the programs only $bins_glibc: build on an older system"
}

# glibc_needed <ELF file>...: the newest glibc version the files need, e.g. GLIBC_2.35.
glibc_needed() {
readelf -V "$@" | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -n 1
}

build_appimage() {
local dir="$work/OpenECraft.AppDir" tool="${APPIMAGETOOL:-}" runtime
[ -n "${runtime_sha256[$arch]:-}" ] || die "no AppImage runtime for $arch"
stage "$dir/usr"
bundle_libs "$dir"
# The AppImage catalog and appimagetool look for AppStream data by its older name.
mv "$dir/usr/share/metainfo/$id.metainfo.xml" "$dir/usr/share/metainfo/$id.appdata.xml"
install -m 644 "$here/appimage/RUNTIME-LICENSES.txt" "$dir/usr/share/doc/openecraft/APPIMAGE-RUNTIME-LICENSES.txt"
install -m 755 "$here/appimage/AppRun" "$dir/AppRun"
cp "$here/$id.desktop" "$dir/$id.desktop"
Expand Down