gitlab-ci, build: Make 'aarch64' AppImage too

Partially reverts e01973b9

This makes the AppImage .sh script multiarch aware and
make Debian pipeline a GL 'matrix' for easier maintenance.

As consequence, making an arm64 .appimage is pretty easy now,
so let's make one since this arch is not that rare in Linux.
This commit is contained in:
Bruno 2024-12-20 18:49:42 -03:00
parent 461d5db07e
commit 46f716a0a3
No known key found for this signature in database
3 changed files with 223 additions and 134 deletions

View file

@ -82,17 +82,6 @@ workflow:
key: ${CI_JOB_NAME}${VARIANT}
paths:
- _ccache/
# Universal variables (works in all POSIX OSes and archs)
before_script:
- echo -e "\e[0Ksection_start:`date +%s`:environ[collapsed=true]\r\e[0KPreparing build environment"
- export PATH="$GIMP_PREFIX/bin:$PATH"
- gcc -print-multi-os-directory 2>/dev/null | grep ./ && export LIB_DIR=$(gcc -print-multi-os-directory | sed 's/\.\.\///g') || export LIB_DIR="lib"
- gcc -print-multiarch 2>/dev/null | grep . && export LIB_SUBDIR=$(echo $(gcc -print-multiarch)'/')
- export PKG_CONFIG_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
- export LD_LIBRARY_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
- export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
- export GI_TYPELIB_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
- echo -e "\e[0Ksection_end:`date +%s`:environ\r\e[0K"
# Common artifacts behavior
artifacts:
name: "${CI_JOB_NAME}${VARIANT}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
@ -102,8 +91,6 @@ variables:
# Common cloning procedure
GIT_DEPTH: "1"
GIT_SUBMODULE_STRATEGY: none
# CI-wide Debian variables
GIMP_PREFIX: "${CI_PROJECT_DIR}/_install"
# Enable colorful output when supported (e.g. ninja, cppcheck)
CLICOLOR_FORCE: "1"
@ -118,6 +105,31 @@ stages:
## prepare build-oriented Docker images ##
.debian:
extends: .default
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. AppImage package.*/'
interruptible: true
- if: '$GIMP_CI_APPIMAGE != null'
parallel:
matrix:
- RUNNER: [aarch64, x86_64_v2]
tags:
- $RUNNER
image: $CI_REGISTRY_IMAGE:build-debian-latest-${RUNNER}
before_script:
- export GIMP_PREFIX="${CI_PROJECT_DIR}/_install-${RUNNER}"
- echo -e "\e[0Ksection_start:`date +%s`:environ[collapsed=true]\r\e[0KPreparing build environment"
- export PATH="$GIMP_PREFIX/bin:$PATH"
- gcc -print-multi-os-directory 2>/dev/null | grep ./ && export LIB_DIR=$(gcc -print-multi-os-directory | sed 's/\.\.\///g') || export LIB_DIR="lib"
- gcc -print-multiarch 2>/dev/null | grep . && export LIB_SUBDIR=$(echo $(gcc -print-multiarch)'/')
- export PKG_CONFIG_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
- export LD_LIBRARY_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
- export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
- export GI_TYPELIB_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
- echo -e "\e[0Ksection_end:`date +%s`:environ\r\e[0K"
.debian-x64:
extends: .debian
rules:
- <<: *CI_MERGE
- <<: *CI_COMMIT
@ -135,11 +147,14 @@ stages:
MESON_OPTIONS: "-Dvector-icons=false"
VARIANT: "-raster"
- if: '$GIMP_CI_CROSSROAD_WIN64 != null'
- if: '$GIMP_CI_APPIMAGE != null'
- if: '$GIMP_CI_SOURCES != null'
- <<: *CI_RELEASE
parallel:
matrix:
- RUNNER: x86_64_v2
image-debian-x64:
image-debian:
extends: .debian
rules:
- !reference [.debian, rules]
stage: prepare
@ -148,7 +163,8 @@ image-debian-x64:
entrypoint: [""]
variables:
GIT_STRATEGY: none
cache: {}
cache: []
before_script: []
script:
- export container=docker
- mkdir -p /kaniko/.docker
@ -226,17 +242,29 @@ image-debian-x64:
xvfb
xz-utils
yelp-tools" >> Dockerfile
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:build-debian-latest --cache=true --cache-ttl=120h
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:build-debian-latest-${RUNNER} --cache=true --cache-ttl=120h
image-debian-x64:
extends: .debian-x64
rules:
- !reference [.debian-x64, rules]
stage: !reference [image-debian, stage]
image: !reference [image-debian, image]
variables: !reference [image-debian, variables]
cache: !reference [image-debian, cache]
before_script:
- !reference [image-debian, before_script]
script:
- !reference [image-debian, script]
## GNU/Linux 64-bit CIs (Debian bookworm) ##
deps-debian-x64:
extends: .default
deps-debian:
extends: .debian
rules:
- !reference [.debian, rules]
needs: ["image-debian-x64"]
needs: ["image-debian"]
stage: dependencies
image: $CI_REGISTRY_IMAGE:build-debian-latest
variables:
GIT_STRATEGY: none
script:
@ -251,8 +279,8 @@ deps-debian-x64:
fi
- git clone $babl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git
- cd babl
- meson setup _build -Dprefix="${GIMP_PREFIX}"
- cd _build
- meson setup _build-${RUNNER} -Dprefix="${GIMP_PREFIX}"
- cd _build-${RUNNER}
- ninja
- ninja install
- ccache --show-stats
@ -269,40 +297,75 @@ deps-debian-x64:
fi
- git clone $gegl_branch --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git
- cd gegl
- meson setup _build -Dprefix="${GIMP_PREFIX}" -Dworkshop=true
- cd _build
- meson setup _build-${RUNNER} -Dprefix="${GIMP_PREFIX}" -Dworkshop=true
- cd _build-${RUNNER}
- ninja
- ninja install
- ccache --show-stats
- echo -e "\e[0Ksection_end:`date +%s`:gegl_build\r\e[0K"
artifacts:
paths:
- _install/
- babl/_build/meson-logs/meson-log.txt
- babl/_build/config.h
- gegl/_build/meson-logs/meson-log.txt
- gegl/_build/config.h
- _install-${RUNNER}/
- babl/_build-${RUNNER}/meson-logs/meson-log.txt
- babl/_build-${RUNNER}/config.h
- gegl/_build-${RUNNER}/meson-logs/meson-log.txt
- gegl/_build-${RUNNER}/config.h
expire_in: 2 hours
gimp-debian-x64:
extends: .default
gimp-debian:
extends: .debian
rules:
- !reference [.debian, rules]
needs: ["deps-debian-x64"]
needs: ["deps-debian"]
stage: gimp
image: $CI_REGISTRY_IMAGE:build-debian-latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
# Build GIMP
- echo -e "\e[0Ksection_start:`date +%s`:gimp_build[collapsed=true]\r\e[0KBuilding GIMP"
- meson setup _build-${RUNNER} -Dprefix="${GIMP_PREFIX}"
-Drelocatable-bundle=yes
- cd _build-${RUNNER}
- ninja
- echo -e "\e[0Ksection_end:`date +%s`:gimp_build\r\e[0K"
# Create bundle
- echo -e "\e[0Ksection_start:`date +%s`:gimp_bundle[collapsed=true]\r\e[0KCreating bundle"
- ninja install &> ninja_install.log || cat ninja_install.log
- cd ..
- bash build/linux/appimage/3_dist-gimp-goappimage.sh --bundle-only &> goappimage.log || cat goappimage.log
- echo -e "\e[0Ksection_end:`date +%s`:gimp_bundle\r\e[0K"
artifacts:
paths:
- AppDir*/
- appimageignore*
- _build-${RUNNER}/config.h
expire_in: 2 days
deps-debian-x64:
extends: .debian-x64
rules:
- !reference [.debian-x64, rules]
needs: ["image-debian-x64"]
stage: !reference [deps-debian, stage]
variables: !reference [deps-debian, variables]
script:
- !reference [deps-debian, script]
artifacts: !reference [deps-debian, artifacts]
gimp-debian-x64:
extends: .debian-x64
rules:
- !reference [.debian-x64, rules]
needs: ["deps-debian-x64"]
stage: !reference [gimp-debian, stage]
variables: !reference [gimp-debian, variables]
script:
# Check building
- echo -e "\e[0Ksection_start:`date +%s`:gimp_build[collapsed=true]\r\e[0KBuilding GIMP"
- mkdir -p _build && cd _build
- meson setup .. -Dprefix="${GIMP_PREFIX}"
-Dgi-docgen=enabled
-Dg-ir-doc=true
-Drelocatable-bundle=no
-Denable-default-bin=enabled
$MESON_OPTIONS
- meson setup _build-${RUNNER} -Dprefix="${GIMP_PREFIX}"
-Dg-ir-doc=true
$MESON_OPTIONS
- cd _build-${RUNNER}
- ninja
- echo -e "\e[0Ksection_end:`date +%s`:gimp_build\r\e[0K"
# Check execution
@ -326,31 +389,16 @@ gimp-debian-x64:
- echo -e "\e[0Ksection_end:`date +%s`:gimp_install\r\e[0K"
artifacts:
paths:
- _install/
- _build/
- _install-${RUNNER}/
- _build-${RUNNER}/meson-logs/meson-log.txt
- _build-${RUNNER}/meson-dist/
- _build-${RUNNER}/config.h
- _build-${RUNNER}/devel-docs/
reports:
junit: "_build/meson-logs/testlog.junit.xml"
junit: "_build-${RUNNER}/meson-logs/testlog.junit.xml"
expire_in: 2 days
dist-appimage-weekly:
extends: .default
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. AppImage package.*/'
interruptible: true
- if: '$GIMP_CI_APPIMAGE != null'
needs: ["gimp-debian-x64"]
stage: distribution
image: $CI_REGISTRY_IMAGE:build-debian-latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- bash build/linux/appimage/3_dist-gimp-goappimage.sh
artifacts:
expose_as: 'Linux appimage'
paths:
- build/linux/appimage/_Output/
- appimagetool.log
expire_in: 8 days
## Flatpak CI ##
.flatpak-x64:
extends: .default
@ -361,7 +409,8 @@ dist-appimage-weekly:
tags:
- flatpak
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
before_script: []
before_script:
- export GIMP_PREFIX="${CI_PROJECT_DIR}/_install"
deps-flatpak-x64:
extends: .flatpak-x64
@ -413,14 +462,13 @@ gimp-flatpak-x64:
## WINDOWS 64-bit CI (cross-build crossroad) ##
.win-cross:
extends: .default
extends: .debian-x64
rules:
- <<: *CI_MERGE
when: never
- <<: *CI_COMMIT
when: never
- if: '$GIMP_CI_CROSSROAD_WIN64 != null'
image: $CI_REGISTRY_IMAGE:build-debian-latest
deps-win-x64-cross:
extends: .win-cross
@ -495,7 +543,6 @@ gimp-win-x64-cross:
variables:
INSTALLER_OPTION: '-Dwindows-installer=true'
STORE_OPTION: '-Dms-store=true'
# We don't use the universal variables since we use PS
before_script:
# MSYS2 config
- $MSYS2_PREFIX = 'C:/msys64'
@ -652,14 +699,13 @@ gimp-win-x86:
file-plug-in-tests:
# FIXME: Do we need another job testing this under Windows? MSYS2 usually has
# the latest deps. It might be a good idea to test that too, maybe weekly?
extends: .default
extends: .debian-x64
rules:
# Don't run on release since the plug-in doesn't get installed in releases
- <<: *CI_MERGE
- <<: *CI_COMMIT
needs: ["deps-debian-x64", "gimp-debian-x64"]
stage: analysis
image: $CI_REGISTRY_IMAGE:build-debian-latest
variables:
GIT_STRATEGY: none
GIMP_TESTS_DATA_FOLDER: "$CI_PROJECT_DIR/_data/gimp-test-images/"
@ -670,8 +716,8 @@ file-plug-in-tests:
paths:
- _data
script:
- API_VER=$(grep GIMP_PKGCONFIG_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
- APP_VER=$(grep GIMP_APP_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
- API_VER=$(grep GIMP_PKGCONFIG_VERSION _build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
- APP_VER=$(grep GIMP_APP_VERSION _build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
- pkg-config --variable=gimplibdir gimp-${API_VER} 2>/dev/null | grep . && PLUG_IN_DIR=$(echo $(pkg-config --variable=gimplibdir gimp-${API_VER})'/plug-ins/')
- export PYTHONPATH="${PLUG_IN_DIR}test-file-plug-ins"
- export GIMP_TESTS_CONFIG_FILE="${PLUG_IN_DIR}test-file-plug-ins/tests/batch-config.ini"
@ -747,7 +793,7 @@ sources-debian:
variables:
GIT_STRATEGY: none
script:
- mv _build/meson-dist/gimp-*.tar.xz .
- mv _build*/meson-dist/gimp-*.tar.xz .
- FILENAME=`ls gimp-*.tar.xz` &&
sha256sum gimp-*.tar.xz > ${FILENAME}.SHA256SUMS &&
sha512sum gimp-*.tar.xz > ${FILENAME}.SHA512SUMS
@ -772,8 +818,9 @@ dev-docs:
script:
- apt-get update
- apt-get install -y xz-utils
- BABL_VER=$(grep BABL_VERSION babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
BABL_API_VER=$(grep BABL_API_VERSION babl/_build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
- export GIMP_PREFIX=$(echo $PWD/_install*)
- BABL_VER=$(grep BABL_VERSION babl/_build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
BABL_API_VER=$(grep BABL_API_VERSION babl/_build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
DIR_NAME=babl-api-docs-$BABL_VER &&
mkdir $DIR_NAME &&
mv "${GIMP_PREFIX}/share/doc/babl-$BABL_API_VER" $DIR_NAME/ &&
@ -781,9 +828,9 @@ dev-docs:
tar --dereference -cJf ${TAR_NAME} $DIR_NAME &&
sha256sum $TAR_NAME > ${TAR_NAME}.SHA256SUMS &&
sha512sum $TAR_NAME > ${TAR_NAME}.SHA512SUMS
- GEGL_MAJ_VER=$(grep GEGL_MAJOR_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIN_VER=$(grep GEGL_MINOR_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIC_VER=$(grep GEGL_MICRO_VERSION gegl/_build/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
- GEGL_MAJ_VER=$(grep GEGL_MAJOR_VERSION gegl/_build*/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIN_VER=$(grep GEGL_MINOR_VERSION gegl/_build*/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_MIC_VER=$(grep GEGL_MICRO_VERSION gegl/_build*/config.h |head -1 |sed 's/^[^0-9]*\([0-9]*\).*$/\1/') &&
GEGL_VER="$GEGL_MAJ_VER.$GEGL_MIN_VER.$GEGL_MIC_VER" &&
GEGL_API_VER="$GEGL_MAJ_VER.$GEGL_MIN_VER" &&
DIR_NAME=gegl-api-docs-$GEGL_VER &&
@ -793,15 +840,15 @@ dev-docs:
tar --dereference -cJf ${TAR_NAME} $DIR_NAME &&
sha256sum $TAR_NAME > ${TAR_NAME}.SHA256SUMS &&
sha512sum $TAR_NAME > ${TAR_NAME}.SHA512SUMS
- GIMP_VER=$(grep GIMP_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
APP_VER=$(echo $GIMP_VER | sed 's/\([0-9]\+\.[0-9]\+\)\..*/\1/') &&
DIR_NAME=gimp-api-docs-$GIMP_VER &&
mkdir $DIR_NAME &&
mv "${GIMP_PREFIX}/share/doc/gimp-$APP_VER" $DIR_NAME/reference &&
mv _build/devel-docs/g-ir-docs $DIR_NAME/ &&
TAR_NAME="$DIR_NAME.tar.xz" &&
tar --dereference -cJf ${TAR_NAME} $DIR_NAME &&
sha256sum $TAR_NAME > ${TAR_NAME}.SHA256SUMS &&
- GIMP_VER=$(grep GIMP_VERSION _build*/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') &&
APP_VER=$(echo $GIMP_VER | sed 's/\([0-9]\+\.[0-9]\+\)\..*/\1/') &&
DIR_NAME=gimp-api-docs-$GIMP_VER &&
mkdir $DIR_NAME &&
mv "${GIMP_PREFIX}/share/doc/gimp-$APP_VER" $DIR_NAME/reference &&
mv _build*/devel-docs/g-ir-docs $DIR_NAME/ &&
TAR_NAME="$DIR_NAME.tar.xz" &&
tar --dereference -cJf ${TAR_NAME} $DIR_NAME &&
sha256sum $TAR_NAME > ${TAR_NAME}.SHA256SUMS &&
sha512sum $TAR_NAME > ${TAR_NAME}.SHA512SUMS
artifacts:
paths:
@ -816,6 +863,21 @@ dev-docs:
- gimp-api-docs-*.tar.xz.SHA512SUMS
expire_in: 2 days
dist-appimage-weekly:
extends: .default
rules:
- !reference [.debian, rules]
needs: ["gimp-debian"]
stage: distribution
cache: []
script:
- bash build/linux/appimage/3_dist-gimp-goappimage.sh _build-x86_64_v2
artifacts:
expose_as: 'Linux appimage'
paths:
- build/linux/appimage/_Output/
expire_in: 8 days
include: 'https://raw.githubusercontent.com/GNOME/citemplates/master/flatpak/flatpak_ci_initiative.yml'
dist-flatpak-weekly:
extends:

View file

@ -23,14 +23,15 @@ if [ -f "*appimagetool*.AppImage" ]; then
rm *appimagetool*.AppImage
fi
if [ "$GITLAB_CI" ]; then
apt-get install -y --no-install-recommends wget >/dev/null 2>&1
apt-get update >/dev/null 2>&1
apt-get install -y --no-install-recommends ca-certificates wget >/dev/null 2>&1
fi
export ARCH=$(uname -m)
export HOST_ARCH=$(uname -m)
export APPIMAGE_EXTRACT_AND_RUN=1
## For now, we always use the latest go-appimagetool for bundling. See: https://github.com/probonopd/go-appimage/issues/275
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-${ARCH}.AppImage" | head -n 1 | cut -d '"' -f 2) >/dev/null 2>&1
echo "(INFO): Downloaded go-appimagetool: $(echo appimagetool-*.AppImage | sed -e 's/appimagetool-//' -e "s/-${ARCH}.AppImage//")"
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-${HOST_ARCH}.AppImage" | head -n 1 | cut -d '"' -f 2) >/dev/null 2>&1
echo "(INFO): Downloaded go-appimagetool: $(echo appimagetool-*.AppImage | sed -e 's/appimagetool-//' -e "s/-${HOST_ARCH}.AppImage//")"
go_appimagetool='go-appimagetool.AppImage'
mv appimagetool-*.AppImage $go_appimagetool
chmod +x "$go_appimagetool"
@ -41,7 +42,10 @@ if [ "$GITLAB_CI" ]; then
fi
## standard appimagetool is needed for squashing the .appimage file. See: https://github.com/probonopd/go-appimage/issues/86
wget "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage" >/dev/null 2>&1
if [ "$GITLAB_CI" ]; then
apt-get install -y --no-install-recommends file zsync >/dev/null 2>&1
fi
wget "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${HOST_ARCH}.AppImage" >/dev/null 2>&1
standard_appimagetool='legacy-appimagetool.AppImage'
mv appimagetool-*.AppImage $standard_appimagetool
chmod +x "$standard_appimagetool"
@ -50,10 +54,10 @@ echo -e "\e[0Ksection_end:`date +%s`:apmg_tlkt\r\e[0K"
# 2. GET GLOBAL VARIABLES
echo -e "\e[0Ksection_start:`date +%s`:apmg_info\r\e[0KGetting AppImage global info"
if [ "$1" ]; then
if [ "$1" != '' ] && [[ ! "$1" =~ "--" ]]; then
export BUILD_DIR="$1"
else
export BUILD_DIR="$PWD/_build"
export BUILD_DIR=$(echo $PWD/_build*$RUNNER)
fi
## Get info about GIMP version
@ -66,21 +70,12 @@ else
fi
export APP_ID="org.gimp.GIMP.$CHANNEL"
echo "(INFO): App ID: $APP_ID | Version: $GIMP_VERSION"
## Prefixes to get files to copy
UNIX_PREFIX='/usr'
if [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then
export GIMP_PREFIX="$PWD/../_install"
fi
## Paths to receive copied files
APP_DIR="$PWD/AppDir"
USR_DIR="$APP_DIR/usr"
echo -e "\e[0Ksection_end:`date +%s`:apmg_info\r\e[0K"
# 3. GIMP FILES
echo -e "\e[0Ksection_start:`date +%s`:apmg_files[collapsed=true]\r\e[0KPreparing GIMP files in AppDir/usr"
if [ "$(ls -dq ./AppDir* 2>/dev/null | wc -l)" != '2' ]; then
echo -e "\e[0Ksection_start:`date +%s`:apmg_files[collapsed=true]\r\e[0KPreparing GIMP files in AppDir-$HOST_ARCH/usr"
## 3.1. Special re-building (only if needed)
@ -111,6 +106,17 @@ fi
## 3.2. Bundle files
#Prefixes to get files to copy
UNIX_PREFIX='/usr'
if [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then
export GIMP_PREFIX="$PWD/../_install"
fi
#Paths to receive copied files
APP_DIR="$PWD/AppDir-$HOST_ARCH"
USR_DIR="$APP_DIR/usr"
prep_pkg ()
{
if [ "$GITLAB_CI" ]; then
@ -202,8 +208,12 @@ wipe_usr ()
## Prepare AppDir
mkdir -p $APP_DIR
bund_usr "$UNIX_PREFIX" "lib64/ld-*.so.*" --go
conf_app LD_LINUX "lib64/ld-*.so.*"
bund_usr "$UNIX_PREFIX" "lib*/ld-*.so.*" --go
if [ "$HOST_ARCH" = 'aarch64' ]; then
conf_app LD_LINUX "lib/ld-*.so.*"
else
conf_app LD_LINUX "lib64/ld-*.so.*"
fi
## Bundle base (bare minimum to run GTK apps)
### Glib needed files (to be able to use file dialogs)
@ -306,9 +316,14 @@ bund_usr "$GIMP_PREFIX" "share/applications/*.desktop" --rename $APP_ID.desktop
"./$go_appimagetool" -s deploy $USR_DIR/share/applications/$APP_ID.desktop &> appimagetool.log || cat appimagetool.log
## Manual adjustments (go-appimagetool don't handle Linux FHS gracefully yet)
### Undo the mess which breaks babl and GEGL. See: https://github.com/probonopd/go-appimage/issues/315
cp -r $APP_DIR/lib/* $USR_DIR/${LIB_DIR}
rm -r $APP_DIR/lib
### Ensure that LD is in right dir. See: https://github.com/probonopd/go-appimage/issues/49
cp -r $APP_DIR/lib64 $USR_DIR
rm -r $APP_DIR/lib64
if [ "$HOST_ARCH" = 'x86_64' ]; then
cp -r $APP_DIR/lib64 $USR_DIR
rm -r $APP_DIR/lib64
fi
chmod +x "$APP_DIR/$LD_LINUX"
exec_array=($(find "$USR_DIR/bin" "$USR_DIR/$LIB_DIR" ! -iname "*.so*" -type f -exec head -c 4 {} \; -exec echo " {}" \; | grep ^.ELF))
for exec in "${exec_array[@]}"; do
@ -316,41 +331,45 @@ for exec in "${exec_array[@]}"; do
patchelf --set-interpreter "./$LD_LINUX" "$exec" >/dev/null 2>&1 || continue
fi
done
### Undo the mess which breaks babl and GEGL. See: https://github.com/probonopd/go-appimage/issues/315
cp -r $APP_DIR/lib/* $USR_DIR/${LIB_DIR}
rm -r $APP_DIR/lib
## Unnecessary files bundled by go-appimagetool
## Unnecessary files created or bundled by go-appimagetool
mv build/linux/appimage/AppRun $APP_DIR
mv build/linux/appimage/AppRun.bak build/linux/appimage/AppRun
echo "usr/${LIB_DIR}/${LIB_SUBDIR}gconv
usr/${LIB_DIR}/${LIB_SUBDIR}gdk-pixbuf-*/gdk-pixbuf-query-loaders
usr/share/doc
usr/share/themes
etc" > .appimageignore
etc" > appimageignore-$HOST_ARCH
echo -e "\e[0Ksection_end:`date +%s`:apmg_files\r\e[0K"
fi
if [ "$1" = '--bundle-only' ] || [ "$2" = '--bundle-only' ]; then
exit 0
fi
# 4. PREPARE .APPIMAGE-SPECIFIC "SOURCE"
echo -e "\e[0Ksection_start:`date +%s`:apmg_source[collapsed=true]\r\e[0KMaking AppImage assets"
appdir_array=($(find . -maxdepth 1 -iname "AppDir*"))
for APP_DIR in "${appdir_array[@]}"; do
export ARCH=$(echo $APP_DIR | sed -e 's|AppDir-||' -e 's|./||')
echo -e "\e[0Ksection_start:`date +%s`:${ARCH}_source[collapsed=true]\r\e[0KMaking AppImage assets for $ARCH"
export USR_DIR="$APP_DIR/usr"
## 4.1. Finish AppRun configuration
echo '(INFO): copying configured AppRun'
sed -i '/_WILD/d' build/linux/appimage/AppRun
sed -i "s/APP_ID/$APP_ID/" build/linux/appimage/AppRun
mv build/linux/appimage/AppRun $APP_DIR
echo '(INFO): finishing AppRun configuration'
sed -i '/_WILD/d' "$APP_DIR/AppRun"
sed -i "s/APP_ID/$APP_ID/" "$APP_DIR/AppRun"
chmod +x $APP_DIR/AppRun
mv build/linux/appimage/AppRun.bak build/linux/appimage/AppRun
## 4.2. Copy icon assets (similarly to flatpaks's 'rename-icon')
echo "(INFO): copying $APP_ID.svg asset to AppDir"
find "$USR_DIR/share/icons/hicolor" -iname *.svg -execdir ln -s "{}" $APP_ID.svg \;
find "$USR_DIR/share/icons/hicolor" -iname *.png -execdir ln -s "{}" $APP_ID.png \;
find "$USR_DIR/share/icons/hicolor" -iname *.svg -execdir ln -sf "{}" $APP_ID.svg \;
find "$USR_DIR/share/icons/hicolor" -iname *.png -execdir ln -sf "{}" $APP_ID.png \;
cp -L "$USR_DIR/share/icons/hicolor/scalable/apps/$APP_ID.svg" $APP_DIR
## 4.3. Configure .desktop asset (similarly to flatpaks's 'rename-desktop-file')
echo "(INFO): configuring $APP_ID.desktop"
sed -i "s/Icon=gimp/Icon=$APP_ID/g" "$USR_DIR/share/applications/${APP_ID}.desktop"
gimp_app_version=$(grep GIMP_APP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
ln -s -r "$USR_DIR/bin/gimp-$gimp_app_version" "$USR_DIR/bin/$APP_ID"
ln -sfr "$USR_DIR/bin/gimp-$gimp_app_version" "$USR_DIR/bin/$APP_ID"
sed -i "s/gimp-$gimp_app_version/$APP_ID/g" "$USR_DIR/share/applications/${APP_ID}.desktop"
cp "$USR_DIR/share/applications/${APP_ID}.desktop" $APP_DIR
@ -358,18 +377,21 @@ cp "$USR_DIR/share/applications/${APP_ID}.desktop" $APP_DIR
echo "(INFO): configuring $APP_ID.appdata.xml"
sed -i "s/org.gimp.GIMP/${APP_ID}/g" "$USR_DIR/share/metainfo/${APP_ID}.appdata.xml"
sed -i "s/gimp.desktop/${APP_ID}.desktop/g" "$USR_DIR/share/metainfo/${APP_ID}.appdata.xml"
echo -e "\e[0Ksection_end:`date +%s`:apmg_source\r\e[0K"
echo -e "\e[0Ksection_end:`date +%s`:${ARCH}_source\r\e[0K"
# 5. CONSTRUCT .APPIMAGE
APPIMAGETOOL_APP_NAME="GIMP-${CHANNEL}-${ARCH}.AppImage"
echo -e "\e[0Ksection_start:`date +%s`:apmg_making[collapsed=true]\r\e[0KSquashing $APPIMAGETOOL_APP_NAME"
"./$standard_appimagetool" -n $APP_DIR $APPIMAGETOOL_APP_NAME -u "zsync|https://gitlab.gnome.org/GNOME/gimp/-/jobs/artifacts/master/raw/build/linux/appimage/_Output/${APPIMAGETOOL_APP_NAME}.zsync?job=dist-appimage-weekly"
rm -r $APP_DIR
echo -e "\e[0Ksection_start:`date +%s`:${ARCH}_making[collapsed=true]\r\e[0KSquashing $APPIMAGETOOL_APP_NAME"
"./$standard_appimagetool" -n $APP_DIR $APPIMAGETOOL_APP_NAME --exclude-file appimageignore-$ARCH #-u "zsync|https://gitlab.gnome.org/GNOME/gimp/-/jobs/artifacts/master/raw/build/linux/appimage/_Output/${APPIMAGETOOL_APP_NAME}.zsync?job=dist-appimage-weekly"
file "./$APPIMAGETOOL_APP_NAME"
#standard appimagetool does not output runtime version at squashing. See: https://github.com/AppImage/appimagetool/issues/80
chmod +x "./$APPIMAGETOOL_APP_NAME"
"./$APPIMAGETOOL_APP_NAME" --appimage-version
echo -e "\e[0Ksection_end:`date +%s`:apmg_making\r\e[0K"
if [ "$ARCH" = "$HOST_ARCH" ]; then
"./$APPIMAGETOOL_APP_NAME" --appimage-version
fi
echo -e "\e[0Ksection_end:`date +%s`:${ARCH}_making\r\e[0K"
done
if [ "$GITLAB_CI" ]; then
mkdir -p build/linux/appimage/_Output/

View file

@ -22,20 +22,25 @@ fi
# FIXME: We need native/Linux gimp-console.
# https://gitlab.gnome.org/GNOME/gimp/-/issues/6393
if [ "$1" ]; then
export BUILD_DIR="$1"
else
export BUILD_DIR=$(echo _build*$RUNNER)
fi
if [ ! -d "$BUILD_DIR" ]; then
echo -e "\033[31m(ERROR)\033[0m: Before running this script, first build GIMP natively in $BUILD_DIR"
fi
if [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then
export GIMP_PREFIX="$PWD/../_install"
fi
if [ ! -d '_build' ]; then
echo -e '\033[31m(ERROR)\033[0m: Before running this script, first build GIMP natively in _build'
fi
if [ ! -d "$GIMP_PREFIX" ]; then
echo -e "\033[31m(ERROR)\033[0m: Before running this script, first install GIMP natively in $GIMP_PREFIX"
fi
if [ ! -d '_build' ] || [ ! -d "$GIMP_PREFIX" ]; then
if [ ! -d "$BUILD_DIR" ] || [ ! -d "$GIMP_PREFIX" ]; then
echo 'Patches are very welcome: https://gitlab.gnome.org/GNOME/gimp/-/issues/6393'
exit 1
fi
GIMP_APP_VERSION=$(grep GIMP_APP_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
GIMP_APP_VERSION=$(grep GIMP_APP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
GIMP_CONSOLE_PATH=$PWD/${PARENT_DIR}.local/bin/gimp-console-$GIMP_APP_VERSION
echo "#!/bin/sh" > $GIMP_CONSOLE_PATH
IFS=$'\n' VAR_ARRAY=($(cat .gitlab-ci.yml | sed -n '/export PATH=/,/GI_TYPELIB_PATH}\"/p' | sed 's/ - //'))