diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50d18ebb8e..88427271ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,27 @@ # Default commit CI should only run the following pipelines: -# - Linux native CLang build (base & fast) -# - Win64 crossbuild (base & fast) +# - Linux build (base & fast) +# - Win crossbuild (base & fast) # Scheduled CI ($CI_PIPELINE_SOURCE == "schedule") will run regularly: -# - Linux native GCC build (rare usefulness) -# - Win Aarch64/64/32 native builds (base but slow) -# - Flatpak build (slow and doesn't need constant publishing) +# - Linux GCC build (rare usefulness) +# - Linux build without vector icons (rare usefulness) +# - Linux Flatpak build (base but slow) +# - Win builds: Inno Windows installer (base but slow) # - cppcheck (static code analysis) # Releases ($CI_COMMIT_TAG != null) should run only: -# - Win Aarch64/64/32 native builds (Inno Windows installer creation) +# - Source tarball (base & fast) +# - Developer documentation (base & fast) +# - Win builds: Inno Windows installer (base but slow) # # To force step-specific pipelines without waiting for commits and/or # pipelines, these are the variable you should set: -# - GIMP_CI_MESON_CLANG: trigger the Debian clang build. -# - GIMP_CI_MESON_GCC: trigger the Debian gcc build. -# - GIMP_CI_RASTER_ICONS: trigger the Debian build without vector icons. +# - GIMP_CI_MESON_CLANG: trigger the Debian Clang build with AppImage artifact. +# - GIMP_CI_MESON_GCC: trigger the Debian GCC build with AppImage artifact. +# - GIMP_CI_RASTER_ICONS: trigger the Debian Clang build with AppImage artifact without vector icons. # - GIMP_CI_CROSSROAD_WIN64: trigger the crossroad build for Win 64-bit. # - GIMP_CI_MSYS2_WIN_AARCH64: trigger the native MSYS2 build for Win Aarch64. # - GIMP_CI_MSYS2_WIN64: trigger the native MSYS2 build for Win 64-bit. # - GIMP_CI_MSYS2_WIN32: trigger the native MSYS2 build for Win 32-bit. -# - GIMP_CI_SOURCES: trigger the Debian build and the source tarball job. +# - GIMP_CI_SOURCES: trigger the Debian Clang build and the source tarball job. # - GIMP_CI_FLATPAK: trigger the flatpak build and publishing. # - GIMP_CI_WIN_INSTALLER: trigger all native MSYS2 builds then creates Inno Windows installer. # - GIMP_CI_CPPCHECK: trigger cppcheck static analysis. @@ -52,7 +55,7 @@ workflow: CC: "ccache clang" CXX: "ccache clang++" cache: - key: $CI_JOB_NAME + key: ${CI_JOB_NAME}${VARIANT} paths: - _ccache/ # Universal variables (works in all POSIX OSes and archs) @@ -124,6 +127,7 @@ image-debian-x64: ghostscript gi-docgen git + gjs glib-networking gobject-introspection graphviz @@ -186,8 +190,24 @@ image-debian-x64: ## GNU/Linux 64-bit CIs (Debian bookworm) ## -.deps-debian-base: +deps-debian-x64: extends: .default + rules: + # On releases. + - if: '$CI_COMMIT_TAG != null' + interruptible: false + # Custom builds though web GUI, API or schedules. + - if: '$GIMP_CI_MESON_GCC != null' + variables: + CC: "ccache cc" + CXX: "ccache c++" + - if: '$GIMP_CI_RASTER_ICONS != null' + - if: '$GIMP_CI_MESON_CLANG != null' + - if: '$GIMP_CI_CROSSROAD_WIN64 != null' + - if: '$GIMP_CI_SOURCES != null' + # On merge requests and commits. + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_PIPELINE_SOURCE == "push"' needs: ["image-debian-x64"] stage: dependencies image: $CI_REGISTRY_IMAGE:build-debian-latest @@ -226,110 +246,76 @@ image-debian-x64: - _gegl/_build${ARTIFACTS_SUFFIX}/ expire_in: 2 hours -deps-debian-x64: - extends: .deps-debian-base +gimp-debian-x64: + extends: .default rules: # On releases. - if: '$CI_COMMIT_TAG != null' interruptible: false # Custom builds though web GUI, API or schedules. - - if: '$GIMP_CI_MESON_CLANG != null' + - if: '$GIMP_CI_MESON_GCC != null' + variables: + CC: "ccache cc" + CXX: "ccache c++" + VARIANT: "-gcc" - if: '$GIMP_CI_RASTER_ICONS != null' + variables: + MESON_OPTIONS: "-Dvector-icons=false" + VARIANT: "-raster" + - if: '$GIMP_CI_MESON_CLANG != null' - if: '$GIMP_CI_CROSSROAD_WIN64 != null' - if: '$GIMP_CI_SOURCES != null' # On merge requests and commits. - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_PIPELINE_SOURCE == "push"' - -# GitLab "rules:variables:" is buggy so let's use jobs -deps-debian-gcc: - extends: .deps-debian-base - rules: - # Custom builds though web GUI, API or schedules. - - if: '$GIMP_CI_MESON_GCC != null' - variables: - CC: "ccache gcc" - CXX: "ccache gcc" - -.gimp-debian-base: - extends: .default needs: ["deps-debian-x64"] stage: gimp image: $CI_REGISTRY_IMAGE:build-debian-latest - before_script: - # Universal variables - - !reference [.default, before_script] - - mkdir -p _build${ARTIFACTS_SUFFIX} && cd _build${ARTIFACTS_SUFFIX} - after_script: - - ccache --show-stats - artifacts: - paths: - - _install${ARTIFACTS_SUFFIX}/ - - _build${ARTIFACTS_SUFFIX}/ - expire_in: 1 days - -gimp-debian-x64: - extends: .gimp-debian-base - rules: - # On releases. - - if: '$CI_COMMIT_TAG != null' - interruptible: false - # Custom builds though web GUI, API or schedules. - - if: '$GIMP_CI_MESON_CLANG != null' - - if: '$GIMP_CI_CROSSROAD_WIN64 != null' - - if: '$GIMP_CI_SOURCES != null' - # On merge requests and commits. - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - - if: '$CI_PIPELINE_SOURCE == "push"' script: + # Check building + - mkdir -p _build${ARTIFACTS_SUFFIX} && cd _build${ARTIFACTS_SUFFIX} - meson setup .. -Dprefix="${GIMP_PREFIX}" -Dgi-docgen=enabled -Dg-ir-doc=true + -Drelocatable-bundle=no + $MESON_OPTIONS - ninja + # Check execution - ninja test - # The src should not be changed by the build. If it is, something is - # wrong. Let's print out the diff for debugging in such case, and - # exit to fail the CI. - - if [ $(git diff |wc -l) -ne 0 ]; then - git diff; - exit 1; + # Check source + - echo ${VARIANT} + - if [[ "${VARIANT}" != "-gcc" ]] && [[ "${VARIANT}" != "-raster" ]]; then + if [ $(git diff |wc -l) -ne 0 ]; then + git diff; + exit 1; + fi; + ninja dist; fi - - ninja dist + # Make sure that GIMP is testable locally on Debian + # We apply these ugly patches since #6798 isn't fixed yet + # and appstream-cli get confused with our exotic naming and fails + - cd .. + - git apply -v build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch + - git apply -v build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch + - meson configure _build${ARTIFACTS_SUFFIX} -Drelocatable-bundle=yes -Dvector-icons=true + - cd _build${ARTIFACTS_SUFFIX} + - ninja - ninja install + - ccache --show-stats + - cd .. + - bash -x build/linux/appimage/package-gimp-appimage.sh artifacts: + name: "${CI_JOB_NAME}${VARIANT}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" + expose_as: 'Linux appimage' paths: + - build/linux/appimage/_Output/ - _install${ARTIFACTS_SUFFIX}/ - - _build${ARTIFACTS_SUFFIX}/config.h - _build${ARTIFACTS_SUFFIX}/meson-dist/ + - _build${ARTIFACTS_SUFFIX}/config.h - _build${ARTIFACTS_SUFFIX}/devel-docs/ - - _build${ARTIFACTS_SUFFIX}/meson-logs/ reports: junit: "_build${ARTIFACTS_SUFFIX}/meson-logs/testlog.junit.xml" - -gimp-debian-gcc: - extends: .gimp-debian-base - rules: - # Custom builds only (web GUI, API or schedules). - - if: '$GIMP_CI_MESON_GCC != null' - needs: ["deps-debian-gcc"] - variables: - CC: "ccache gcc" - CXX: "ccache gcc" - script: - - meson setup .. -Dprefix="${GIMP_PREFIX}" - - ninja - - ninja test - -gimp-debian-raster-icons: - extends: .gimp-debian-base - rules: - # Custom builds only (web GUI, API or schedules). - - if: '$GIMP_CI_RASTER_ICONS != null' - script: - - meson setup .. -Dprefix="${GIMP_PREFIX}" - -Dvector-icons=false - - ninja - - ninja test + expire_in: 2 days include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml' gimp-flatpak-x64: @@ -351,7 +337,7 @@ gimp-flatpak-x64: image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master' variables: # Replace with your manifest path - MANIFEST_PATH: "build/flatpak/org.gimp.GIMP-nightly.json" + MANIFEST_PATH: "build/linux/flatpak/org.gimp.GIMP-nightly.json" RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" # Replace with your application name, as written in the manifest FLATPAK_MODULE: "gimp" @@ -382,8 +368,8 @@ gimp-flatpak-x64: - flatpak build-init ${GIMP_PREFIX} $APP_ID org.gnome.Sdk org.gnome.Platform - flatpak build ${GIMP_PREFIX} meson setup _build${ARTIFACTS_SUFFIX} || echo "Generated log" - GIMP_APP_VERSION=$(grep 'Project version' _build${ARTIFACTS_SUFFIX}/meson-logs/meson-log.txt | head -1 | sed -e 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/' -e 's/\([0-9]\+\.[0-9]\+\)\..*/\1/') - - cp build/flatpak/org.gimp.GIMP-nightly.json.in build/flatpak/org.gimp.GIMP-nightly.json - - sed -i "s/@GIMP_APP_VERSION@/$GIMP_APP_VERSION/g" build/flatpak/org.gimp.GIMP-nightly.json + - cp build/linux/flatpak/org.gimp.GIMP-nightly.json.in build/linux/flatpak/org.gimp.GIMP-nightly.json + - sed -i "s/@GIMP_APP_VERSION@/$GIMP_APP_VERSION/g" build/linux/flatpak/org.gimp.GIMP-nightly.json # GNOME script to customize the manifest - rewrite-flatpak-manifest ${MANIFEST_PATH} ${FLATPAK_MODULE} ${CONFIG_OPTS} diff --git a/build/linux/appimage/AppRun b/build/linux/appimage/AppRun new file mode 100644 index 0000000000..79bf8ddb0f --- /dev/null +++ b/build/linux/appimage/AppRun @@ -0,0 +1,72 @@ +#!/bin/sh + +# Loosely based on: +# https://appimage-builder.readthedocs.io/en/latest/examples/gimp_path_mapping.html +# https://github.com/aferrero2707/gimp-appimage +# https://github.com/ivan-hc/GIMP-appimage +# https://github.com/sudo-give-me-coffee/PhotoMP/ + +set -e + + +# COMPATIBILITY NOTICE +HERE="$(dirname "$(readlink -f "${0}")")" +LD_LINUX=$(find "$HERE" -name 'ld-*.so.*' | head -n 1) +export DISTRO=$(exec "${LD_LINUX}" --inhibit-cache --library-path "$LD_LIBRARY_PATH" "${HERE}/OPT_PREFIX_WILDbin/uname" "-a") +echo "This is a CI native build of GIMP (please see devel-docs/os-support.txt)." +case "${DISTRO}" in + *Debian*|*debian*) + echo ".js (JavaScript) plug-ins | supported." + echo ".lua (Lua) plug-ins | NOT supported!" + echo ".py (Python) plug-ins | supported." + echo ".scm (ScriptFu) plug-ins | supported." + echo ".vala (Vala) plug-ins | supported." +esac + + +# PATHS MAPPING + +## General paths +export PATH="${HERE}"/OPT_PREFIX_WILDbin/:"${PATH}" +export LD_LIBRARY_PATH="${HERE}"/OPT_PREFIX_WILDlib/:"${HERE}"/OPT_PREFIX_WILDlib/x86_64-linux-gnu/:"${HERE}"/OPT_PREFIX_WILDlib64/:"${LD_LIBRARY_PATH}" +export GI_TYPELIB_PATH="${HERE}"/GI_TYPELIB_PATH_WILD:"${GI_TYPELIB_PATH}" +export XDG_DATA_DIRS="${HERE}"/OPT_PREFIX_WILDshare/:"${XDG_DATA_DIRS}" + +## GIMP-specific paths +export BABL_PATH="${HERE}"/BABL_PATH_WILD +export GEGL_PATH="${HERE}"/GEGL_PATH_WILD +export GIMP3_SYSCONFDIR="${HERE}"/GIMP3_SYSCONFDIR_WILD +export GIMP3_PLUGINDIR="${HERE}"/GIMP3_PLUGINDIR_WILD +export GIMP3_DATADIR="${HERE}"/GIMP3_DATADIR_WILD +export GIMP3_LOCALEDIR="${HERE}"/OPT_PREFIX_WILDshare/locale +if [ -z ${XDG_CONFIG_HOME} ]; then + export GIMP3_DIRECTORY="$HOME/.config/GIMP/GIMP_APP_VERSION" +else + export GIMP3_DIRECTORY="$XDG_CONFIG_HOME/GIMP/GIMP_APP_VERSION" +fi + +## Other paths (base) +export GIO_MODULE_DIR="${HERE}"/GIO_MODULE_DIR_WILD/modules +export GDK_PIXBUF_MODULEDIR="${HERE}"/GDK_PIXBUF_MODULEDIR_WILD/loaders +export GDK_PIXBUF_MODULE_FILE="${HERE}"/GDK_PIXBUF_MODULE_FILE_WILD/loaders.cache +export GTK_PATH="${HERE}"/GTK_PATH_WILD +export GTK_IM_MODULE_FILE="${HERE}"/GTK_IM_MODULE_FILE_WILD/immodules.cache +### For now, we only support "Adwaita-compliant" system themes (e.g. Yaru) +export GTK_THEME=Default +"${LD_LINUX}" --inhibit-cache --library-path "$LD_LIBRARY_PATH" "${HERE}/OPT_PREFIX_WILDbin/find" "." "-name" "libgtk-4*" +if [ $? -eq '0' ]; then + case "${DE}" in + *GNOME*|*gnome*) + export SYSTEM_THEME=$(exec "${LD_LINUX}" --inhibit-cache --library-path "$LD_LIBRARY_PATH" "${HERE}/OPT_PREFIX_WILDbin/gsettings" "get" "org.gnome.desktop.interface" "gtk-theme" | exec "${LD_LINUX}" --inhibit-cache --library-path "$LD_LIBRARY_PATH" "${HERE}/OPT_PREFIX_WILDbin/sed" "s/'//g") + export GTK_THEME=$SYSTEM_THEME + esac +fi + +## Other paths (GIMP related) +export LIBGL_DRIVERS_PATH="${HERE}"/LIBGL_DRIVERS_PATH_WILD +export PYTHONPATH="${HERE}"/PYTHONPATH_WILD + + +# RUN MAIN_BIN +cd "$HERE"/OPT_PREFIX_WILD +exec "${LD_LINUX}" --inhibit-cache --library-path "$LD_LIBRARY_PATH" "${HERE}/OPT_PREFIX_WILDbin/gimp-GIMP_APP_VERSION" "$@" diff --git a/build/linux/appimage/package-gimp-appimage.sh b/build/linux/appimage/package-gimp-appimage.sh new file mode 100644 index 0000000000..7413792988 --- /dev/null +++ b/build/linux/appimage/package-gimp-appimage.sh @@ -0,0 +1,205 @@ +#!/bin/sh + +# Loosely based on: +# https://github.com/AppImage/AppImageSpec/blob/master/draft.md +# https://gitlab.com/inkscape/inkscape/-/commit/b280917568051872793a0c7223b8d3f3928b7d26 + +set -e + + +# AGNOSTIC VARIABLES (only touch them to make even more portable, without casuistry) + +## This script is arch-agnostic. The packager can specify it when calling the script +if [[ -z "$1" ]]; then + export ARCH=$(uname -m) +else + export ARCH=$1 +fi +INSTALL_ARTIF=$(echo _install*) +BUILD_ARTIF=$(echo _build*) + +## This script is "filesystem-agnostic". The packager can quickly choose either +## putting everything in /usr or in AppDir(root) just specifying the 2nd parameter. +GIMP_DISTRIB="$CI_PROJECT_DIR/build/linux/appimage/AppDir" +GIMP_PREFIX="$GIMP_DISTRIB/usr" +if [[ -z "$2" ]] || [[ "$2" == "usr" ]]; then + OPT_PREFIX="${GIMP_PREFIX}" +elif [[ "$2" == "AppDir" ]]; then + OPT_PREFIX="${GIMP_DISTRIB}" +fi + +## This script is distro-agnostic too. +## TODO: take this code from .gitlab-ci.yml +gcc -print-multi-os-directory | grep . && LIB_DIR=$(gcc -print-multi-os-directory | sed 's/\.\.\///g') || LIB_DIR="lib" +gcc -print-multiarch | grep . && LIB_SUBDIR=$(echo $(gcc -print-multiarch)'/') + + +#(MOSTLY) AGNOSTIC FUNCTIONS +prep_pkg () +{ + apt-get install -y --no-install-recommends $1 +} + +find_bin () +{ + find /usr/bin -name ${1} -execdir cp -r '{}' $OPT_PREFIX/bin \; + find /bin -name ${1} -execdir cp -r '{}' $OPT_PREFIX/bin \; +} + +find_lib () +{ + find /usr/${LIB_DIR}/${LIB_SUBDIR} -maxdepth 1 -name ${1} -execdir cp -r '{}' $OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR} \; + find /usr/${LIB_DIR} -maxdepth 1 -name ${1} -execdir cp -r '{}' $OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR} \; + find /${LIB_DIR}/${LIB_SUBDIR} -maxdepth 1 -name ${1} -execdir cp -r '{}' $OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR} \; + find /${LIB_DIR} -maxdepth 1 -name ${1} -execdir cp -r '{}' $OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR} \; +} + +find_dat () +{ + DAT_PATH=$(echo $1) + DAT_PATH=$(sed "s|/usr/||g" <<< $DAT_PATH) + mkdir -p $OPT_PREFIX/$DAT_PATH + cp -r $1/$2 $OPT_PREFIX/$DAT_PATH/$3 +} + +conf_app () +{ + VAR_PATH=$(echo $2/$3) + VAR_PATH=$(sed "s|${2}/||g" <<< $VAR_PATH) + sed -i "s|${1}_WILD|OPT_PREFIX_WILD${VAR_PATH}|" build/linux/appimage/AppRun +} + + +# PREPARE ENVIRONMENT +apt-get install -y --no-install-recommends wget + +## For now, we always use the latest version of go-appimagetool +wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) +mv *.AppImage appimagetool.appimage +go_appimagetool=appimagetool.appimage +chmod +x "$go_appimagetool" + +## go-appimagetool have buggy appstreamcli so we need to use the legacy one +legacy_appimagetool="appimagetool-x86_64.AppImage" +wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/$legacy_appimagetool" +chmod +x "$legacy_appimagetool" + + +# PACKAGE FILES + +## System base (needed to use GIMP or to avoid polluting the terminal output) +### Glib needed files +find_dat "/usr/share/glib-*/schemas" "*" +### Glib commonly required modules +prep_pkg "gvfs" +find_lib "gvfs*" +find_lib "gio*" +conf_app GIO_MODULE_DIR "/usr" "${LIB_DIR}/${LIB_SUBDIR}gio" +### GTK needed files +prep_pkg "gnome-icon-theme" +find_dat "/usr/share/icons/gnome" "*" +find_dat "/usr/share/mime" "*" +conf_app GDK_PIXBUF_MODULEDIR "/usr" "${LIB_DIR}/${LIB_SUBDIR}gdk-pixbuf-*/*.*.*" +conf_app GDK_PIXBUF_MODULE_FILE "/usr" "${LIB_DIR}/${LIB_SUBDIR}gdk-pixbuf-*/*.*.*" +### GTK commonly required modules +prep_pkg "libibus-1.0-5" +find_lib "libibus*" +prep_pkg "ibus-gtk3" +prep_pkg "libcanberra-gtk3-module" +prep_pkg "libxapp-gtk3-module" +conf_app GTK_PATH "/usr" "${LIB_DIR}/${LIB_SUBDIR}gtk-3.0" +conf_app GTK_IM_MODULE_FILE "/usr" "${LIB_DIR}/${LIB_SUBDIR}gtk-3.0/*.*.*" + +## Core features +cp -r $INSTALL_ARTIF/* $OPT_PREFIX +conf_app BABL_PATH "$OPT_PREFIX" "${LIB_DIR}/${LIB_SUBDIR}babl-*" +conf_app GEGL_PATH "$OPT_PREFIX" "${LIB_DIR}/${LIB_SUBDIR}gegl-*" +conf_app GIMP3_SYSCONFDIR "$OPT_PREFIX" "etc/gimp/*" +conf_app GIMP3_DATADIR "$OPT_PREFIX" "share/gimp/*" +### Copy localized language list support +find_dat "/usr/share/xml/iso-codes" "iso_639-2.xml" "iso_639.xml" +### Copy system theme support (TODO: remove when our Default theme is mature) +find_bin "find*" +find_bin "gsettings*" +find_bin "sed*" +### Copy GTK inspector support +find_lib "libEGL*" +find_lib "libGL*" +find_lib "dri*" +conf_app LIBGL_DRIVERS_PATH "$OPT_PREFIX" "${LIB_DIR}/${LIB_SUBDIR}dri" + +## Plug-ins +find_bin "uname*" +conf_app GIMP3_PLUGINDIR "$OPT_PREFIX" "${LIB_DIR}/${LIB_SUBDIR}gimp/*" +conf_app GI_TYPELIB_PATH "$OPT_PREFIX" "${LIB_DIR}/${LIB_SUBDIR}girepository-*" +### Copy JavaScript plug-ins support +find_bin "gjs*" +### Copy Lua plug-ins support (NOT WORKING) +#find_bin "lua*" +#find_lib "liblua*" +### Copy Python plug-ins support +find_bin "python*" +find_lib "python*.*" +conf_app PYTHONPATH "/usr" "${LIB_DIR}/${LIB_SUBDIR}python*.**" + +## Final adjustments +### Auto detect and copy deps of binaries copied above +"./$go_appimagetool" --appimage-extract-and-run -s deploy $OPT_PREFIX/share/applications/org.gimp.GIMP.desktop +### Rearranje babl, GEGL and GIMP (only the needed files) +if [[ -z "$2" ]] || [[ "$2" == "usr" ]]; then + cp -r $GIMP_DISTRIB/etc $GIMP_PREFIX + rm -r $GIMP_DISTRIB/etc + cp -r $GIMP_DISTRIB/lib $GIMP_PREFIX + rm -r $GIMP_DISTRIB/lib + cp -r $GIMP_DISTRIB/lib64 $GIMP_PREFIX + rm -r $GIMP_DISTRIB/lib64 +elif [[ "$2" == "AppDir" ]]; then + cp -r $GIMP_PREFIX/* $GIMP_DISTRIB + rm -r $GIMP_PREFIX +fi +### Remove unnecessary files +rm -r $OPT_PREFIX/include +rm -r $OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR}pkgconfig +rm -r $OPT_PREFIX/share/doc +rm -r $OPT_PREFIX/share/man + +## Sad adjustments (go-appimagetool don't like when this is made before and don't do for us yet) +sed -i "s|\"/usr/|\"|g" "$OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR}gdk-pixbuf-2.0/2.10.0/loaders.cache" +cp -r "/usr/${LIB_DIR}/${LIB_SUBDIR}gtk-3.0/3.0.0/immodules.cache" "$OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR}gtk-3.0/3.0.0" +sed -i "s|\"/usr/|\"|g" "$OPT_PREFIX/${LIB_DIR}/${LIB_SUBDIR}gtk-3.0/3.0.0/immodules.cache" + + +# CONFIGURE APPRUN +cp build/linux/appimage/AppRun $GIMP_DISTRIB + +if [[ -z "$2" ]] || [[ "$2" == "usr" ]]; then + sed -i "s|OPT_PREFIX_WILD|usr/|g" $GIMP_DISTRIB/AppRun +elif [[ "$2" == "AppDir" ]]; then + sed -i "s|OPT_PREFIX_WILD||g" $GIMP_DISTRIB/AppRun +fi + +GIMP_APP_VERSION=$(grep GIMP_APP_VERSION $BUILD_ARTIF/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') +sed -i "s|GIMP_APP_VERSION|${GIMP_APP_VERSION}|" $GIMP_DISTRIB/AppRun + + +# CONFIGURE METADATA +sed -i '/kudo/d' $OPT_PREFIX/share/metainfo/org.gimp.GIMP.appdata.xml +if [[ "$2" == "AppDir" ]]; then + mkdir -p $GIMP_PREFIX/share + cp -r $GIMP_DISTRIB/share/metainfo $GIMP_PREFIX/share + cp -r $GIMP_DISTRIB/share/applications $GIMP_PREFIX/share +fi + + +# CONFIGURE ICON +cp $OPT_PREFIX/share/icons/hicolor/scalable/apps/org.gimp.GIMP.svg $GIMP_DISTRIB/org.gimp.GIMP.svg +if [[ "$2" == "AppDir" ]]; then + cp -r $GIMP_DISTRIB/share/icons/ $GIMP_PREFIX/share +fi + + +# MAKE APPIMAGE +"./$legacy_appimagetool" --appimage-extract-and-run $GIMP_DISTRIB # -u "zsync|https://download.gimp.org/gimp/v${GIMP_APP_VERSION}/GIMP-latest-${ARCH}.AppImage.zsync" +mkdir build/linux/appimage/_Output +GIMP_VERSION=$(grep GIMP_VERSION $BUILD_ARTIF/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') +mv GNU*.AppImage build/linux/appimage/_Output/GIMP-${GIMP_VERSION}-${ARCH}.AppImage diff --git a/build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch b/build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch new file mode 100644 index 0000000000..6f8ce4d87c --- /dev/null +++ b/build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch @@ -0,0 +1,147 @@ +From dc8762b7a11794a3481eced7ff0eaf9202b7799e Mon Sep 17 00:00:00 2001 +From: Bruno Lopes +Date: Sat, 30 Mar 2024 13:53:37 -0300 +Subject: [PATCH] desktop, po: Use reverse DNS naming + +--- + desktop/meson.build | 2 +- + desktop/org.gimp.GIMP.appdata.xml.in.in | 4 ++-- + ...imp.desktop.in.in => org.gimp.GIMP.desktop.in.in} | 2 +- + libgimpwidgets/gimpwidgets-private.c | 12 ++++++------ + po/POTFILES.in | 2 +- + po/POTFILES.skip | 2 +- + 6 files changed, 12 insertions(+), 12 deletions(-) + rename desktop/{gimp.desktop.in.in => org.gimp.GIMP.desktop.in.in} (96%) + +diff --git a/desktop/meson.build b/desktop/meson.build +index bee2e93c48..a517e351ab 100644 +--- a/desktop/meson.build ++++ b/desktop/meson.build +@@ -1,4 +1,4 @@ +-desktopfilename = 'gimp.desktop' ++desktopfilename = 'org.gimp.GIMP.desktop' + + desktop_conf = configuration_data() + desktop_conf.set('GIMP_COMMAND', gimp_command) +diff --git a/desktop/org.gimp.GIMP.appdata.xml.in.in b/desktop/org.gimp.GIMP.appdata.xml.in.in +index fbc01608bf..e934469013 100644 +--- a/desktop/org.gimp.GIMP.appdata.xml.in.in ++++ b/desktop/org.gimp.GIMP.appdata.xml.in.in +@@ -65,12 +65,12 @@ + + gimp20 + +- gimp.desktop ++ org.gimp.GIMP.desktop + + @GIMP_COMMAND@ + +- gimp.desktop ++ org.gimp.GIMP.desktop + + + +diff --git a/desktop/gimp.desktop.in.in b/desktop/org.gimp.GIMP.desktop.in.in +similarity index 96% +rename from desktop/gimp.desktop.in.in +rename to desktop/org.gimp.GIMP.desktop.in.in +index 0ef73561b0..6f460d6db1 100644 +--- a/desktop/gimp.desktop.in.in ++++ b/desktop/org.gimp.GIMP.desktop.in.in +@@ -8,7 +8,7 @@ Comment=Create images and edit photographs + Keywords=GIMP;graphic;design;illustration;painting; + Exec=@GIMP_COMMAND@ %U + TryExec=gimp-@GIMP_APP_VERSION@ +-Icon=gimp ++Icon=org.gimp.GIMP + Terminal=false + Categories=Graphics;2DGraphics;RasterGraphics;GTK; + StartupNotify=true +diff --git a/libgimpwidgets/gimpwidgets-private.c b/libgimpwidgets/gimpwidgets-private.c +index 0ebe7fa7e0..046e737fca 100644 +--- a/libgimpwidgets/gimpwidgets-private.c ++++ b/libgimpwidgets/gimpwidgets-private.c +@@ -110,7 +110,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + * then the application icon is dependant to the theme and for now at + * least, we want the installed icon. + */ +- path = g_build_filename (base_dir, "16x16", cat_dir, "gimp.png", NULL); ++ path = g_build_filename (base_dir, "16x16", cat_dir, "org.gimp.GIMP.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (path, &error); + if (pixbuf) + icons = g_list_prepend (icons, pixbuf); +@@ -119,7 +119,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + g_clear_error (&error); + g_free (path); + +- path = g_build_filename (base_dir, "32x32", cat_dir, "gimp.png", NULL); ++ path = g_build_filename (base_dir, "32x32", cat_dir, "org.gimp.GIMP.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (path, &error); + if (pixbuf) + icons = g_list_prepend (icons, pixbuf); +@@ -128,7 +128,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + g_clear_error (&error); + g_free (path); + +- path = g_build_filename (base_dir, "48x48", cat_dir, "gimp.png", NULL); ++ path = g_build_filename (base_dir, "48x48", cat_dir, "org.gimp.GIMP.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (path, &error); + if (pixbuf) + icons = g_list_prepend (icons, pixbuf); +@@ -137,7 +137,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + g_clear_error (&error); + g_free (path); + +- path = g_build_filename (base_dir, "64x64", cat_dir, "gimp.png", NULL); ++ path = g_build_filename (base_dir, "64x64", cat_dir, "org.gimp.GIMP.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (path, &error); + if (pixbuf) + icons = g_list_prepend (icons, pixbuf); +@@ -146,7 +146,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + g_clear_error (&error); + g_free (path); + +- path = g_build_filename (base_dir, "scalable", cat_dir, "gimp.svg", NULL); ++ path = g_build_filename (base_dir, "scalable", cat_dir, "org.gimp.GIMP.svg", NULL); + pixbuf = gdk_pixbuf_new_from_file_at_size (path, 128, 128, &error); + if (pixbuf) + { +@@ -179,7 +179,7 @@ gimp_widgets_init (GimpHelpFunc standard_help_func, + } + g_free (path); + +- path = g_build_filename (base_dir, "256x256", cat_dir, "gimp.png", NULL); ++ path = g_build_filename (base_dir, "256x256", cat_dir, "org.gimp.GIMP.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (path, &error); + if (pixbuf) + icons = g_list_prepend (icons, pixbuf); +diff --git a/po/POTFILES.in b/po/POTFILES.in +index bb40043cde..130728ca42 100644 +--- a/po/POTFILES.in ++++ b/po/POTFILES.in +@@ -2,7 +2,7 @@ + # marked to allow runtime translation of messages + + desktop/org.gimp.GIMP.appdata.xml.in.in +-desktop/gimp.desktop.in.in ++desktop/org.gimp.GIMP.desktop.in.in + + app/about.h + app/app.c +diff --git a/po/POTFILES.skip b/po/POTFILES.skip +index 7e957d8dd4..00ec4d8961 100644 +--- a/po/POTFILES.skip ++++ b/po/POTFILES.skip +@@ -3,7 +3,7 @@ build/windows/installer/lang/setup.isl.in + data/tags/gimp-tags-default.xml.in + data/tips/gimp-tips.xml.in + desktop/org.gimp.GIMP.appdata.xml.in +-desktop/gimp.desktop.in ++desktop/org.gimp.GIMP.desktop.in + extensions + libgimp + libgimpbase +-- +2.44.0.windows.1 + diff --git a/build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch b/build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch new file mode 100644 index 0000000000..c436337dce --- /dev/null +++ b/build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch @@ -0,0 +1,42 @@ +From f84e5cdc3e671491e45ec839af97f61e2272d78c Mon Sep 17 00:00:00 2001 +From: Bruno Lopes +Date: Sat, 30 Mar 2024 16:13:10 -0300 +Subject: [PATCH] images/logo: Use reverse DNS naming + +--- + gimp-data/images/logo/meson.build | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gimp-data/images/logo/meson.build b/gimp-data/images/logo/meson.build +index bf0a5ea..4ec96a1 100644 +--- a/gimp-data/images/logo/meson.build ++++ b/gimp-data/images/logo/meson.build +@@ -57,21 +57,21 @@ desktop_sizes = [ + foreach size : desktop_sizes + sizedir = size + 'x' + size + installdir = get_option('datadir') / 'icons' / 'hicolor' / sizedir / 'apps' +- app_icon = custom_target('gimp' + sizedir + '.png', ++ app_icon = custom_target('org.gimp.GIMP' + sizedir + '.png', + input : 'gimp-logo.svg', +- output: 'gimp' + sizedir + '.png', ++ output: 'org.gimp.GIMP' + sizedir + '.png', + command: [ + colorsvg2png, '@INPUT@', '@OUTPUT@', size, + ], + build_by_default: true, + install: false) + meson.add_install_script('sh', '-c', +- 'mkdir -p "$MESON_INSTALL_DESTDIR_PREFIX/@1@/" && cp -f "@0@" "$MESON_INSTALL_DESTDIR_PREFIX/@1@/gimp.png"'.format(app_icon.full_path(), installdir)) ++ 'mkdir -p "$MESON_INSTALL_DESTDIR_PREFIX/@1@/" && cp -f "@0@" "$MESON_INSTALL_DESTDIR_PREFIX/@1@/org.gimp.GIMP.png"'.format(app_icon.full_path(), installdir)) + endforeach + + install_data('gimp-logo.svg', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps', +- rename: 'gimp.svg') ++ rename: 'org.gimp.GIMP.svg') + + ## gimp.ico (Windows) ## + +-- +2.44.0.windows.1 + diff --git a/build/flatpak/README.md b/build/linux/flatpak/README.md similarity index 98% rename from build/flatpak/README.md rename to build/linux/flatpak/README.md index f85ad93d0e..8c0006375d 100644 --- a/build/flatpak/README.md +++ b/build/linux/flatpak/README.md @@ -19,7 +19,7 @@ This job will build whatever is on GIMP's repository `master` branch (this branch should be kept buildable and usable at all time, not only for scheduled jobs, but also for all contributors to be able to improve GIMP at all time). -The nightly manifest file is: `build/flatpak/org.gimp.GIMP-nightly.json` +The nightly manifest file is: `build/linux/flatpak/org.gimp.GIMP-nightly.json.in` This file should remain as close as possible to the development manifest (`org.gimp.GIMP.json` file on the `beta` branch of the Flathub repository) which diff --git a/build/flatpak/meson.build b/build/linux/flatpak/meson.build similarity index 100% rename from build/flatpak/meson.build rename to build/linux/flatpak/meson.build diff --git a/build/flatpak/org.gimp.GIMP-nightly.json.in b/build/linux/flatpak/org.gimp.GIMP-nightly.json.in similarity index 100% rename from build/flatpak/org.gimp.GIMP-nightly.json.in rename to build/linux/flatpak/org.gimp.GIMP-nightly.json.in diff --git a/build/flatpak/remove-future-appdata-release.xslt b/build/linux/flatpak/remove-future-appdata-release.xslt similarity index 100% rename from build/flatpak/remove-future-appdata-release.xslt rename to build/linux/flatpak/remove-future-appdata-release.xslt diff --git a/meson.build b/meson.build index 4afe9f24ff..dbd15fe46a 100644 --- a/meson.build +++ b/meson.build @@ -1795,7 +1795,7 @@ meson.add_dist_script('meson_dist_script.sh', rootInclude = include_directories('.') appInclude = include_directories('app') -subdir('build/flatpak') +subdir('build/linux/flatpak') subdir('build/windows') # Tools