mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
Improve AppImage
1. fix libbz2 soname differeence issue on appimage 2. Downgrade to 22.04 for better compatibility 3. improve appimage overall
This commit is contained in:
52
scripts/appimage_lib_policy.sh
Executable file
52
scripts/appimage_lib_policy.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Libraries that are safer to resolve from the host than bundle into the AppImage.
|
||||
# Keep this list focused on the glibc/runtime loader and host-specific graphics/audio stacks.
|
||||
appimage_is_host_library() {
|
||||
local lib_name
|
||||
lib_name="$(basename "$1")"
|
||||
|
||||
case "$lib_name" in
|
||||
linux-vdso.so.*|linux-gate.so.*|ld-linux*.so*|ld64.so*|ld-musl-*.so*|libc.so*|libpthread.so*|libm.so*|libdl.so*|librt.so*|libresolv.so*|libutil.so*|libanl.so*|libnsl.so*|libBrokenLocale.so*|libcrypt.so*|libnss_*.so*|\
|
||||
libGL.so*|libOpenGL.so*|libGLX*.so*|libGLU.so*|libEGL.so*|libGLES*.so*|libGLdispatch.so*|libdrm.so*|libdrm_*.so*|libgbm.so*|libwayland-*.so*|libxcb*.so*|libX11.so*|libX11-xcb.so*|libXau.so*|libXdmcp.so*|libXext.so*|libXdamage.so*|libXfixes.so*|libXcomposite.so*|libXrender.so*|libXrandr.so*|libXcursor.so*|libXi.so*|libXinerama.so*|libxshmfence.so*|libxkbcommon.so*|libxkbcommon-x11.so*|libSM.so*|libICE.so*|libudev.so*|libasound.so*|libpulse.so*|libpulsecommon*.so*|libjack.so*|libpipewire-*.so*|libvulkan.so*|libva.so*|libva-*.so*|\
|
||||
libgtk-*.so*|libgdk-*.so*|libpango*.so*|libatk*.so*|libatk-bridge-*.so*|libatspi.so*|libcairo*.so*|libgdk_pixbuf-*.so*|libgio-2.0.so*|libgmodule-2.0.so*|libgobject-2.0.so*|libglib-2.0.so*|\
|
||||
libgstreamer-1.0.so*|libgst*.so*|libsoup-*.so*|libwebkit2gtk-*.so*|libjavascriptcoregtk-*.so*|libsecret-1.so*|libmanette-0.2.so*|libenchant-2.so*|libhyphen.so*|libtasn1.so*|\
|
||||
libfontconfig.so*|libfreetype.so*|libharfbuzz*.so*|libfribidi.so*|libgraphite2.so*|libthai.so*|libdatrie.so*|libepoxy.so*|libpixman-1.so*|\
|
||||
libstdc++.so*|libgcc_s.so*|libatomic.so*|libdbus-1.so*|libuuid.so*|libffi.so*|libselinux.so*|libmount.so*|libblkid.so*|libpcre2-*.so*|libsystemd.so*|libcap.so*|libseccomp.so*|\
|
||||
libexpat.so*|libz.so*|liblzma.so*|libdeflate.so*|libzstd.so*|libpng*.so*|libjpeg.so*|libtiff.so*|libwebp*.so*|libwoff2*.so*|libjbig.so*|libLerc.so*|liblcms2.so*|libjxl*.so*|libhwy.so*|libsharpyuv.so*|\
|
||||
libxml2.so*|libxslt.so*|libsqlite3.so*|libicu*.so*|libpsl.so*|libnghttp2.so*|libbrotli*.so*|libidn2.so*|libunistring.so*|libgcrypt.so*|libgpg-error.so*|\
|
||||
libgssapi_krb5.so*|libkrb5.so*|libkrb5support.so*|libk5crypto.so*|libcom_err.so*|libkeyutils.so*|liborc-0.4.so*|libgudev-1.0.so*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
appimage_is_elf_file() {
|
||||
file -b "$1" 2>/dev/null | grep -q '^ELF '
|
||||
}
|
||||
|
||||
appimage_list_direct_dependencies() {
|
||||
local target="$1"
|
||||
local line dep
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"=> not found"* ]]; then
|
||||
echo "MISSING:${line%% *}"
|
||||
continue
|
||||
fi
|
||||
|
||||
dep=""
|
||||
if [[ "$line" == *"=>"* ]]; then
|
||||
dep="$(printf '%s\n' "$line" | sed -n 's/.*=> \(\/[^ ]*\).*/\1/p')"
|
||||
elif [[ "$line" =~ ^[[:space:]]/ ]]; then
|
||||
dep="$(printf '%s\n' "$line" | awk '{print $1}')"
|
||||
fi
|
||||
|
||||
if [[ -n "$dep" ]]; then
|
||||
echo "$dep"
|
||||
fi
|
||||
done < <(ldd "$target" 2>/dev/null || true)
|
||||
}
|
||||
99
scripts/check_appimage_libs.sh
Executable file
99
scripts/check_appimage_libs.sh
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${SCRIPT_DIR}/appimage_lib_policy.sh"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <appdir> [entrypoint]"
|
||||
}
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APPDIR="$1"
|
||||
ENTRYPOINT="${2:-}"
|
||||
|
||||
if [[ ! -d "$APPDIR" ]]; then
|
||||
echo "Error: AppDir does not exist: $APPDIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APPDIR="$(cd -- "$APPDIR" && pwd)"
|
||||
|
||||
if [[ -n "$ENTRYPOINT" ]]; then
|
||||
if [[ ! -e "$ENTRYPOINT" ]]; then
|
||||
echo "Error: entrypoint does not exist: $ENTRYPOINT"
|
||||
exit 1
|
||||
fi
|
||||
ENTRYPOINT="$(cd -- "$(dirname -- "$ENTRYPOINT")" && pwd)/$(basename -- "$ENTRYPOINT")"
|
||||
fi
|
||||
|
||||
declare -a lib_paths=(
|
||||
"$APPDIR/lib/orca-runtime"
|
||||
"$APPDIR/lib"
|
||||
"$APPDIR/bin"
|
||||
)
|
||||
|
||||
for candidate in \
|
||||
"$APPDIR/lib/gstreamer-1.0" \
|
||||
"$APPDIR/lib/gio/modules" \
|
||||
"$APPDIR/lib/gdk-pixbuf-2.0/2.10.0/loaders"; do
|
||||
if [[ -d "$candidate" ]]; then
|
||||
lib_paths+=("$candidate")
|
||||
fi
|
||||
done
|
||||
|
||||
audit_ld_library_path="$(IFS=:; printf '%s' "${lib_paths[*]}")"
|
||||
|
||||
declare -a targets=()
|
||||
declare -A seen_unresolved=()
|
||||
declare -A seen_host=()
|
||||
|
||||
if [[ -n "$ENTRYPOINT" ]]; then
|
||||
targets+=("$ENTRYPOINT")
|
||||
fi
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
if appimage_is_elf_file "$file"; then
|
||||
targets+=("$file")
|
||||
fi
|
||||
done < <(find "$APPDIR" -type f -print0)
|
||||
|
||||
for target in "${targets[@]}"; do
|
||||
while IFS= read -r dep; do
|
||||
if [[ "$dep" == MISSING:* ]]; then
|
||||
seen_unresolved["$target -> ${dep#MISSING:}"]=1
|
||||
continue
|
||||
fi
|
||||
|
||||
dep="$(readlink -f "$dep" 2>/dev/null || printf '%s' "$dep")"
|
||||
if [[ "$dep" == "$APPDIR"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if appimage_is_host_library "$dep"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
seen_host["$target -> $dep"]=1
|
||||
done < <(LD_LIBRARY_PATH="$audit_ld_library_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" appimage_list_direct_dependencies "$target")
|
||||
done
|
||||
|
||||
if (( ${#seen_unresolved[@]} > 0 )); then
|
||||
echo "AppImage dependency audit failed: unresolved runtime libraries detected"
|
||||
printf '%s\n' "${!seen_unresolved[@]}" | LC_ALL=C sort
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( ${#seen_host[@]} > 0 )); then
|
||||
echo "AppImage dependency audit failed: unexpected host libraries are still required"
|
||||
printf '%s\n' "${!seen_host[@]}" | LC_ALL=C sort
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "AppImage dependency audit passed: $APPDIR"
|
||||
Reference in New Issue
Block a user