forked from flathub/org.gimp.GIMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-flatpak.sh
executable file
·50 lines (32 loc) · 1.67 KB
/
build-flatpak.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# This script sets up a flatpak build. and install of GIMP from a manifest file
# An identifier, different build storage folders can be created per app version
export VERSION="Source"
# create a log file
exec > >(tee -a "$HOME/build-flatpak-script.log") 2>&1
# get the absolute path to the directory for the Flatpak Repo
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# change to the script directory, so that files are downloaded to here
echo "Changing to script directory: ${SCRIPT_DIR}"
cd "${SCRIPT_DIR}"
# build options for the flatpak builder
export BUILD_OPTIONS="--system --ccache --keep-build-dirs --force-clean"
# architectures supported with GIMP flatpak are one of 'x86_64' or 'aarch64'
export ARCH="x86_64"
# install folder where flatpak files are stored after being built
export FLATPAKDIR="${SCRIPT_DIR}/flatpak-install/${ARCH}/${VERSION}"
# manifest file location, it controls the flatpak process
export MANIFEST="${SCRIPT_DIR}/org.gimp.GIMP.json"
echo -e "\n************* FLATPAK BUILD STARTED *****************\n"
# build a flatpak version of GIMP, using source code specified by the manifest
sudo flatpak-builder $BUILD_OPTIONS --arch="$ARCH" "${FLATPAKDIR}" \
"${MANIFEST}" 2>&1 \
| tee "$HOME/GIMP-flatpak.log"
if [ $? -ne 0 ]; then
echo "Error: Flatpak build failed. Check the log for details."
exit 1
fi
echo -e "\n************* FLATPAK BUILD FINISHED *****************\n"
# Install a flatpak version of GIMP to 'system, from the pre-built flatpak
sudo flatpak-builder --system --install --force-clean "${FLATPAKDIR}" "${MANIFEST}"
echo -e "\n************* INSTALL FINISHED *****************\n"