Skip to content

Commit

Permalink
Merge pull request #18178 from victoryforce/fix-18111
Browse files Browse the repository at this point in the history
Include the Lensfun database in the AppImage
  • Loading branch information
TurboGit authored Jan 8, 2025
2 parents 37f7fc2 + fe654a1 commit b0d9885
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions tools/appimage-build-script.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env bash

# This script builds darktable and then packages it as an AppImage.
# You are expected to call it from the darktable root folder.
# You are expected to call it from the darktable sources root folder.

# This script contains the launch of the AppImage program, linuxdeploy.
# This script contains the launch of linuxdeply, which itself is an AppImage.
# By default, FUSE, which is required for the standard technology of
# launching programs in AppImage format, does not work in Docker containers.
# So if this script is running in a Docker container, the environment
# variable APPIMAGE_EXTRACT_AND_RUN=1 must be set before calling it.

# desktop-file-validate is an optional dependency for darktable build, but is required by linuxdeploy.
# desktop-file-validate is an optional dependency for darktable build,
# but is required by linuxdeploy.
if ! [ -x "$(command -v desktop-file-validate)" ]; then
echo 'Error: desktop-file-validate is not installed.' >&2
exit 1
Expand All @@ -23,20 +24,35 @@ mkdir {build,AppDir}
export DESTDIR=../AppDir

# The CLI parameters of this script will be passed verbatim to build.sh.
# This allows you to conveniently manage the enabling/disabling of various features.
# For example, you can easily build darktable with support for ImageMagick instead of GraphicsMagick
# by running this script with the parameters `--disable-graphicsmagick --enable-imagemagick`
# This allows you to conveniently manage the enabling/disabling of various
# features. For example, you can easily build darktable with support for
# ImageMagick instead of GraphicsMagick by running this script with the
# parameters `--disable-graphicsmagick --enable-imagemagick`
./build.sh --build-dir ./build/ --prefix /usr --build-type Release $@ --install -- "-DBINARY_PACKAGE_BUILD=1 -DBUILD_CURVE_TOOLS=ON -DBUILD_NOISE_TOOLS=ON -DDONT_USE_INTERNAL_LUA=Off -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"

# Sanitize path to executable in org.darktable.darktable.desktop (it will be handled by AppImage).
# In fact, most desktop files do not include the full path to the program in the Exec field
# (relying on the OS's path lookup functionality). When we'll do the same, this hack can be removed.
# Sanitize path to executable in the .desktop (it will be handled by AppImage).
# In reality, most .desktop files do not include the full path to the program
# in the Exec field (relying on the OS's path lookup functionality).
# When we'll do the same, this hack can be removed.
cd build
sed -i 's/\/usr\/bin\///' ../AppDir/usr/share/applications/org.darktable.darktable.desktop

# Since linuxdeploy is itself an AppImage, we don't rely on it being installed on the build system, but download it every time
# we run this script. If that doesn't suit you (for example, you want to build an AppImage without an Internet connection),
# you can edit this script accordingly, and call linuxdeploy and its plugin from where you put them.
# The caller of the script should run `sudo lensfun-update-data` before making
# AppImage, for the nightly builds we did this in the GitHub Action.
# Ideally, we should include the latest lens data at the time of the build.
# So we assume that before calling this script, there was a call to
# lensfun-update-data, which downloaded the updates to /var/lib/lensfun-updates.
# It might be worth adding more complex logic here to find where the latest
# data is located on the build host, but for now we'll rely on the user of this
# script to read this comment and act accordingly.
mkdir -p ../AppDir/usr/share/lensfun
cp -a /var/lib/lensfun-updates/* ../AppDir/usr/share/lensfun

# Since linuxdeploy is itself an AppImage, we don't rely on it being installed
# on the build system, but download it every time we run this script. If that
# doesn't suit you (for example, you want to build an AppImage without an
# Internet connection), you can edit this script accordingly, and call
# linuxdeploy and its plugin from where you put them.
wget -c --no-verbose "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget -c --no-verbose "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"

Expand All @@ -53,8 +69,8 @@ elif [ "$DARKTABLE_APPIMAGE_UPDATE" != "no" ]; then
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|darktable-org|darktable|nightly|Darktable-*-x86_64.AppImage.zsync"
fi

# '--deploy-deps-only' are needed to tell linuxdeploy where to collect dependencies
# of modules that are loaded via dlopen (and therefore cannot be found automatically)
# '--deploy-deps-only' are needed to tell linuxdeploy where to collect deps of
# modules that are loaded via dlopen (therefore cannot be found automatically)
./linuxdeploy-x86_64.AppImage \
--appdir ../AppDir \
--plugin gtk \
Expand Down

0 comments on commit b0d9885

Please sign in to comment.