Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppImage: add missing icons #25

Merged
merged 6 commits into from
Sep 21, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ jobs:
shasum --binary --algorithm "${algo}" "${asset}" >"${asset}.sha${algo}"
done
- name: Upload artifacts to GitHub release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: assets/*
54 changes: 31 additions & 23 deletions AppImageBuilder.debian-bullseye.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,42 @@ AppDir:
fi
done

# install python3-vdf manually if not available as package
if ! apt-cache search --names-only python3-vdf | grep -q .; then
pip install --target "${TARGET_APPDIR}/usr/lib/python3/dist-packages/" vdf
# remove unused icons
icons="${TARGET_APPDIR}/usr/share/icons"
keep=$(
# Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*</td></tr><tr><td>([^<]+).*:\1:p' | sort`
printf '%s\n' index.theme close- edit- go- list- pan- window-
grep -rhoP '"icon_name">\K[^<]+(?=<)' glade
grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc
)
map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; }
paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq)
find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete
cancel() { echo >&2 "ERROR: ${@}" && return 1; }
if find "${icons}" -xtype l | grep .; then
cancel 'The symlinks shown above are broken.'
fi
if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then
cancel 'The icons above are missing.'
fi

after_runtime: |
set -eu
# Enable icon theme
xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini"
if [ ! -e "${xdg_settings}" ]; then
mkdir -p "$(dirname "${xdg_settings}")"
theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit)
printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}"
fi

# python3 is linked against 'lib64/ld-linux-x86-64.so.2'
# but 'compat/lib64' is missing for Ubuntu Noble
compat="${TARGET_APPDIR}/runtime/compat"
if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then
ln -s "usr/lib64" "${compat}/"
# install python3-vdf manually if not available as package
if ! apt-cache search --names-only python3-vdf | grep -q .; then
pip install --target "${TARGET_APPDIR}/usr/lib/python3/dist-packages/" vdf
fi

apt:
arch:
- "{{APPIMAGE_APT_ARCH}}"

sources:
- sourceline: deb http://deb.debian.org/debian {{APPIMAGE_APT_DISTRO}} main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}
Expand All @@ -72,16 +90,13 @@ AppDir:
- libbluetooth3
- libgtk-3-0
- librsvg2-common
- libx11-6
- libxcb1
- libxext6
- libxfixes3
- python3-evdev
- python3-gi-cairo
- python3-pylibacl
- python3-usb1
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- paper-icon-theme # required for icons
- shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing

exclude:
Expand Down Expand Up @@ -128,14 +143,7 @@ AppDir:
- libtirpc* # development
- libuuid* # development
- media-types # codec

# Debian Trixie
- libgprofng* # development
- libjansson* # codec
- libsframe* # development
- libcloudproviders* # networking
- netbase # network
- tzdata # date/time
- tzdata

# Debian Bullseye
- glib-networking* # network
Expand All @@ -152,7 +160,7 @@ AppDir:
- usr/bin/*gold* # alternative for ld
- usr/bin/*gp-display-html* # requires perl
- usr/lib/*/gconv # unicode
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g].so # only png & svg are required
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required
- usr/lib/*/glib-2.0
- usr/lib/python*/cgi.py
- usr/lib/python*/email
Expand Down
40 changes: 32 additions & 8 deletions AppImageBuilder.debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,37 @@ AppDir:
fi
done

# remove unused icons
icons="${TARGET_APPDIR}/usr/share/icons"
keep=$(
# Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*</td></tr><tr><td>([^<]+).*:\1:p' | sort`
printf '%s\n' index.theme close- edit- go- list- pan- window-
grep -rhoP '"icon_name">\K[^<]+(?=<)' glade
grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc
)
map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; }
paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq)
find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete
cancel() { echo >&2 "ERROR: ${@}" && return 1; }
if find "${icons}" -xtype l | grep .; then
cancel 'The symlinks shown above are broken.'
fi
if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then
cancel 'The icons above are missing.'
fi

# Enable icon theme
xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini"
if [ ! -e "${xdg_settings}" ]; then
mkdir -p "$(dirname "${xdg_settings}")"
theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit)
printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}"
fi

after_runtime: |
set -eu

# python3 is linked against 'lib64/ld-linux-x86-64.so.2'
# but 'compat/lib64' is missing for Ubuntu Noble
# python3 is linked against 'lib64/ld-linux-x86-64.so.2' but 'compat/lib64' is missing
compat="${TARGET_APPDIR}/runtime/compat"
if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then
ln -s "usr/lib64" "${compat}/"
Expand All @@ -54,6 +80,7 @@ AppDir:
apt:
arch:
- "{{APPIMAGE_APT_ARCH}}"

sources:
- sourceline: deb http://deb.debian.org/debian {{APPIMAGE_APT_DISTRO}} main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}
Expand All @@ -67,17 +94,14 @@ AppDir:
- libbluetooth3
- libgtk-3-0
- librsvg2-common
- libx11-6
- libxcb1
- libxext6
- libxfixes3
- python3-evdev
- python3-gi-cairo
- python3-pylibacl
- python3-vdf
- python3-usb1
- python3-vdf
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- paper-icon-theme # required for icons
- shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing

exclude:
Expand Down Expand Up @@ -138,7 +162,7 @@ AppDir:
- usr/bin/*gold* # alternative for ld
- usr/bin/*gp-display-html* # requires perl
- usr/lib/*/gconv # unicode
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g].so # only png & svg are required
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required
- usr/lib/*/glib-2.0
- usr/lib/python*/cgi.py
- usr/lib/python*/email
Expand Down
11 changes: 11 additions & 0 deletions AppImageBuilder.test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ RUN <<EOR
fi
}

prepare() {
if command -v apt-get >/dev/null; then
apt-get update && apt-get install -y --no-install-recommends libx11-6
elif command -v pacman >/dev/null; then
pacman -Syu --noconfirm libx11
elif command -v dnf >/dev/null; then
dnf list updates && dnf install -y libX11
fi
}

main() {
files="$(find /opt/ -maxdepth 1 -type f -name '*.AppImage')"
if [ -z "${files}" ]; then
cancel "Error: No AppImage file found."
fi
prepare
echo "${files}" | while read -r file; do
log "${file}"
chmod +x "${file}"
Expand Down
50 changes: 30 additions & 20 deletions AppImageBuilder.ubuntu-focal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,37 @@ AppDir:
pip install --target "${TARGET_APPDIR}/usr/lib/python3/dist-packages/" vdf
fi

after_runtime: |
set -eu
# remove unused icons
icons="${TARGET_APPDIR}/usr/share/icons"
keep=$(
# Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*</td></tr><tr><td>([^<]+).*:\1:p' | sort`
printf '%s\n' index.theme close- edit- go- list- pan- window-
grep -rhoP '"icon_name">\K[^<]+(?=<)' glade
grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc
)
map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; }
paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq)
find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete
cancel() { echo >&2 "ERROR: ${@}" && return 1; }
if find "${icons}" -xtype l | grep .; then
cancel 'The symlinks shown above are broken.'
fi
if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then
cancel 'The icons above are missing.'
fi

# python3 is linked against 'lib64/ld-linux-x86-64.so.2'
# but 'compat/lib64' is missing for Ubuntu Noble
compat="${TARGET_APPDIR}/runtime/compat"
if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then
ln -s "usr/lib64" "${compat}/"
# Enable icon theme
xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini"
if [ ! -e "${xdg_settings}" ]; then
mkdir -p "$(dirname "${xdg_settings}")"
theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit)
printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}"
fi

apt:
arch:
- "{{APPIMAGE_APT_ARCH}}"

sources:
- sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{APPIMAGE_APT_DISTRO}} main universe
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}
Expand All @@ -67,23 +85,22 @@ AppDir:
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}} main universe
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-updates main universe
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-security main universe
- sourceline: deb https://ppa.launchpadcontent.net/snwh/ppa/ubuntu focal main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x023634F5E3DE42B7594EB77B9528DA3D98902E4B

include:
- gir1.2-gtk-3.0
- gir1.2-rsvg-2.0
- libbluetooth3
- libgtk-3-0
- librsvg2-common
- libx11-6
- libxcb1
- libxext6
- libxfixes3
- python3-evdev
- python3-gi-cairo
- python3-pylibacl
- python3-libusb1
- python3-pylibacl
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- paper-icon-theme # required for icons
- shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing

exclude:
Expand Down Expand Up @@ -140,19 +157,12 @@ AppDir:
- libunistring* # unicode
- mime-support # codec

# Ubuntu Noble
- libgprofng* # development
- libjansson* # codec
- libsframe* # development
- netbase # network
- tzdata # date/time

files:
exclude:
- usr/bin/*gold* # alternative for ld
- usr/bin/*gp-display-html* # requires perl
- usr/lib/*/gconv # unicode
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g].so # only png & svg are required
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required
- usr/lib/*/glib-2.0
- usr/lib/python*/cgi.py
- usr/lib/python*/email
Expand Down
40 changes: 32 additions & 8 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,37 @@ AppDir:
fi
done

# remove unused icons
icons="${TARGET_APPDIR}/usr/share/icons"
keep=$(
# Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*</td></tr><tr><td>([^<]+).*:\1:p' | sort`
printf '%s\n' index.theme close- edit- go- list- pan- window-
grep -rhoP '"icon_name">\K[^<]+(?=<)' glade
grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc
)
map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; }
paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq)
find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete
cancel() { echo >&2 "ERROR: ${@}" && return 1; }
if find "${icons}" -xtype l | grep .; then
cancel 'The symlinks shown above are broken.'
fi
if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then
cancel 'The icons above are missing.'
fi

# Enable icon theme
xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini"
if [ ! -e "${xdg_settings}" ]; then
mkdir -p "$(dirname "${xdg_settings}")"
theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit)
printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}"
fi

after_runtime: |
set -eu

# python3 is linked against 'lib64/ld-linux-x86-64.so.2'
# but 'compat/lib64' is missing for Ubuntu Noble
# python3 is linked against 'lib64/ld-linux-x86-64.so.2' but 'compat/lib64' is missing
compat="${TARGET_APPDIR}/runtime/compat"
if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then
ln -s "usr/lib64" "${compat}/"
Expand All @@ -54,6 +80,7 @@ AppDir:
apt:
arch:
- "{{APPIMAGE_APT_ARCH}}"

sources:
- sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{APPIMAGE_APT_DISTRO}} main universe
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}
Expand All @@ -69,17 +96,14 @@ AppDir:
- libbluetooth3
- libgtk-3-0
- librsvg2-common
- libx11-6
- libxcb1
- libxext6
- libxfixes3
- python3-evdev
- python3-gi-cairo
- python3-pylibacl
- python3-usb1
- python3-vdf
- python3-libusb1
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- paper-icon-theme # required for icons
- shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing

exclude:
Expand Down Expand Up @@ -139,7 +163,7 @@ AppDir:
- usr/bin/*gold* # alternative for ld
- usr/bin/*gp-display-html* # requires perl
- usr/lib/*/gconv # unicode
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g].so # only png & svg are required
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required
- usr/lib/*/glib-2.0
- usr/lib/python*/cgi.py
- usr/lib/python*/email
Expand Down