summaryrefslogtreecommitdiffstats
path: root/packaging/macos/jhb/etc/jhb.conf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /packaging/macos/jhb/etc/jhb.conf
parentInitial commit. (diff)
downloadinkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz
inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/macos/jhb/etc/jhb.conf')
l---------packaging/macos/jhb/etc/jhb.conf/10.sh1
l---------packaging/macos/jhb/etc/jhb.conf/20.sh1
l---------packaging/macos/jhb/etc/jhb.conf/30.sh1
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/README.md12
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/bash_d.sh30
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/ccache.sh49
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/ci.sh42
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/directories.sh83
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/dmgbuild.sh96
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/home.sh24
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/jhbuild.sh229
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/path.sh23
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/pip.sh26
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/release.sh35
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/sdkroot.sh41
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/sys.sh121
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/temp.sh27
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/version.sh24
-rw-r--r--packaging/macos/jhb/etc/jhb.conf/xdg.sh25
19 files changed, 890 insertions, 0 deletions
diff --git a/packaging/macos/jhb/etc/jhb.conf/10.sh b/packaging/macos/jhb/etc/jhb.conf/10.sh
new file mode 120000
index 0000000..b7ae2b7
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/10.sh
@@ -0,0 +1 @@
+version.sh \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/20.sh b/packaging/macos/jhb/etc/jhb.conf/20.sh
new file mode 120000
index 0000000..96f9d20
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/20.sh
@@ -0,0 +1 @@
+ci.sh \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/30.sh b/packaging/macos/jhb/etc/jhb.conf/30.sh
new file mode 120000
index 0000000..c1d5631
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/30.sh
@@ -0,0 +1 @@
+directories.sh \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/README.md b/packaging/macos/jhb/etc/jhb.conf/README.md
new file mode 100644
index 0000000..c79b3ad
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/README.md
@@ -0,0 +1,12 @@
+# JHB configuration
+
+Files in here are being sourced by `../../usr/bin/run-parts`
+
+- in their lexical order _and_
+- only once in case a symlink exists.
+
+This way we don't have to prefix the filenames themselves to influnce the order of inclusion (a "poor man's dependency management").
+
+The filename is also the prefix for any variable or function name within.
+
+A file is not allowed to depend on any function or variable outside this directory, with the exception of functions included from `bash_d.sh`.
diff --git a/packaging/macos/jhb/etc/jhb.conf/bash_d.sh b/packaging/macos/jhb/etc/jhb.conf/bash_d.sh
new file mode 100644
index 0000000..5ab11b2
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/bash_d.sh
@@ -0,0 +1,30 @@
+# SPDX-FileCopyrightText: 2022 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Enable bash_d usage by providing bash_d_include function.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+
+### dependencies ###############################################################
+
+# shellcheck source=../../usr/src/bash_d/bash_d.sh
+source "$(dirname "${BASH_SOURCE[0]}")"/../../usr/src/bash_d/bash_d.sh
+
+bash_d_include echo
+
+### variables ##################################################################
+
+# Nothing here.
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/ccache.sh b/packaging/macos/jhb/etc/jhb.conf/ccache.sh
new file mode 100644
index 0000000..82a2208
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/ccache.sh
@@ -0,0 +1,49 @@
+# SPDX-FileCopyrightText: 2022 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Settings and functions to setup ccache.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+
+### variables ##################################################################
+
+export CCACHE_DIR=${CCACHE_DIR:-$WRK_DIR/ccache}
+
+# https://ccache.dev
+# https://github.com/ccache/ccache
+# https://gitlab.com/dehesselle/ccache_macos
+CCACHE_VER=4.6.3r1
+CCACHE_URL=https://gitlab.com/api/v4/projects/29039216/packages/generic/\
+ccache_macos/$CCACHE_VER/ccache_$(uname -m).tar.xz
+
+### functions ##################################################################
+
+function ccache_configure
+{
+ mkdir -p "$CCACHE_DIR"
+
+ cat <<EOF > "$CCACHE_DIR/ccache.conf"
+base_dir = $WRK_DIR
+hash_dir = false
+max_size = 3.0G
+temporary_dir = $CCACHE_DIR/tmp
+EOF
+}
+
+function ccache_install
+{
+ curl -L "$CCACHE_URL" | tar -C "$USR_DIR"/bin --exclude="ccache.sha256" -xJ
+
+ for compiler in clang clang++ gcc g++; do
+ ln -sf ccache "$USR_DIR"/bin/$compiler
+ done
+}
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/ci.sh b/packaging/macos/jhb/etc/jhb.conf/ci.sh
new file mode 100644
index 0000000..727cb2a
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/ci.sh
@@ -0,0 +1,42 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# check if running in CI (GitHub or GitLab)
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+if [ -z "$CI" ]; then # both GitHub and GitLab set this
+ CI=false
+ CI_GITHUB=false
+ CI_GITLAB=false
+else
+ CI=true
+
+ if [ -z "$CI_PROJECT_NAME" ]; then # this is a GitLab-only variable
+ CI_GITHUB=true
+ CI_GITLAB=false
+ else
+ CI_GITHUB=false
+ CI_GITLAB=true
+
+ # Since GitLab uses colors in their CI there's no need to disable ours.
+ # shellcheck disable=SC2034 # this is a bash_d setting
+ ANSI_TERM_ONLY=false # use ANSI control characters even if not in terminal
+ fi
+fi
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here. \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/directories.sh b/packaging/macos/jhb/etc/jhb.conf/directories.sh
new file mode 100644
index 0000000..4119456
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/directories.sh
@@ -0,0 +1,83 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# FSH-inspired directory layout
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+#--------------------------------------------------------- main directory layout
+
+# WRK_DIR (/Users/Shared/work)
+# ┃
+# ┣━━ REP_DIR (repo)
+# ┃
+# ┗━━ VER_DIR (jhb-$VERSION)
+# ┃
+# ┣━━ BIN_DIR (bin)
+# ┣━━ ETC_DIR (etc)
+# ┣━━ INC_DIR (include)
+# ┣━━ LIB_DIR (lib)
+# ┣━━ OPT_DIR (opt)
+# ┃
+# ┣━━ TMP_DIR (tmp)
+# ┃
+# ┣━━ USR_DIR (usr)
+# ┃ ┗━━ SRC_DIR (src)
+# ┃
+# ┗━━ VAR_DIR (var)
+# ┣━━ BLD_DIR (build)
+# ┗━━ PKG_DIR (cache/pkg)
+#
+# You can either override a variable directly or use a corresponding
+# "*_TEMPLATE" variable if you want to reference other variables, e.g.
+#
+# VER_DIR_TEMPLATE="\$WRK_DIR/myFoo-\$VERSION"
+
+WRK_DIR=$(eval echo "${WRK_DIR:-${WRK_DIR_TEMPLATE:-/Users/Shared/work}}")
+
+REP_DIR=$(eval echo "${REP_DIR:-${REP_DIR_TEMPLATE:-$WRK_DIR/repo}}")
+
+VER_DIR=$(eval echo "${VER_DIR:-${VER_DIR_TEMPLATE:-$WRK_DIR/jhb-$VERSION}}")
+
+BIN_DIR=$(eval echo "${BIN_DIR:-${BIN_DIR_TEMPLATE:-$VER_DIR/bin}}")
+ETC_DIR=$(eval echo "${ETC_DIR:-${ETC_DIR_TEMPLATE:-$VER_DIR/etc}}")
+INC_DIR=$(eval echo "${INC_DIR:-${INC_DIR_TEMPLATE:-$VER_DIR/include}}")
+LIB_DIR=$(eval echo "${LIB_DIR:-${LIB_DIR_TEMPLATE:-$VER_DIR/lib}}")
+OPT_DIR=$(eval echo "${OPT_DIR:-${OPT_DIR_TEMPLATE:-$VER_DIR/opt}}")
+
+USR_DIR=$(eval echo "${USR_DIR:-${USR_DIR_TEMPLATE:-$VER_DIR/usr}}")
+SRC_DIR=$(eval echo "${SRC_DIR:-${SRC_DIR_TEMPLATE:-$USR_DIR/src}}")
+
+TMP_DIR=$(eval echo "${TMP_DIR:-${TMP_DIR_TEMPLATE:-$VER_DIR/tmp}}")
+
+VAR_DIR=$(eval echo "${VAR_DIR:-${VAR_DIR_TEMPLATE:-$VER_DIR/var}}")
+BLD_DIR=$(eval echo "${BLD_DIR:-${BLD_DIR_TEMPLATE:-$VAR_DIR/build}}")
+PKG_DIR=$(eval echo "${PKG_DIR:-${PKG_DIR_TEMPLATE:-$VAR_DIR/cache/pkg}}")
+
+#------------------------------------------------------------ artifact directory
+
+if [ -z "$ARTIFACT_DIR" ]; then
+ if $CI_GITHUB; then
+ ARTIFACT_DIR=$GITHUB_WORKSPACE
+ elif $CI_GITLAB; then
+ ARTIFACT_DIR=$CI_PROJECT_DIR
+ else
+ ARTIFACT_DIR=$VER_DIR
+ fi
+fi
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here. \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/dmgbuild.sh b/packaging/macos/jhb/etc/jhb.conf/dmgbuild.sh
new file mode 100644
index 0000000..d957703
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/dmgbuild.sh
@@ -0,0 +1,96 @@
+# SPDX-FileCopyrightText: 2022 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# dmgbuild is a Python package that simplifies the process of creating a
+# disk image (dmg) for distribution.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+
+### dependencies ###############################################################
+
+# Nothing here.
+
+### variables ##################################################################
+
+# https://dmgbuild.readthedocs.io/en/latest/
+# https://github.com/al45tair/dmgbuild
+# including optional dependencies:
+# - biplist: binary plist parser/generator
+# - pyobjc-*: framework wrappers
+DMGBUILD_PIP="\
+ biplist==1.0.3\
+ dmgbuild==1.5.2\
+ ds-store==1.3.0\
+ mac-alias==2.2.0\
+ pyobjc-core==8.5.1\
+ pyobjc-framework-Cocoa==8.5.1\
+ pyobjc-framework-Quartz==8.5.1\
+"
+
+### functions ##################################################################
+
+function dmgbuild_install
+{
+ # shellcheck disable=SC2086 # we need word splitting here
+ jhb run $JHBUILD_PYTHON_PIP install --prefix=$USR_DIR wheel $DMGBUILD_PIP
+
+ # dmgbuild has issues with detaching, workaround is to increase max retries
+ gsed -i '$ s/HiDPI)/HiDPI, detach_retries=15)/g' "$USR_DIR"/bin/dmgbuild
+}
+
+function dmgbuild_run
+{
+ local config=$1
+ local plist=$2
+ local dmg=$3 # optional; default is <name>_<version>_<build>_<arch>.dmg
+
+ local app_dir
+ app_dir=$(echo "$ARTIFACT_DIR"/*.app)
+
+ if [ -z "$dmg" ]; then
+ local version
+ version=$(/usr/libexec/PlistBuddy \
+ -c "Print :CFBundleShortVersionString" "$plist")
+ local build
+ build=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$plist")
+
+ dmg=$(basename -s .app "$app_dir")_${version}+${build}_$(uname -m).dmg
+ fi
+
+ # Copy templated version of the file (it contains placeholders) to source
+ # directory. They copy will be modified to contain the actual values.
+ cp "$config" "$SRC_DIR"
+ config=$SRC_DIR/$(basename "$config")
+
+ # set application
+ gsed -i "s|PLACEHOLDERAPPLICATION|$app_dir|" "$config"
+
+ # set disk image icon (if it exists)
+ local icon
+ icon=$SRC_DIR/$(basename -s .py "$config").icns
+ if [ -f "$icon" ]; then
+ gsed -i "s|PLACEHOLDERICON|$icon|" "$config"
+ fi
+
+ # set background image (if it exists)
+ local background
+ background=$SRC_DIR/$(basename -s .py "$config").png
+ if [ -f "$background" ]; then
+ gsed -i "s|PLACEHOLDERBACKGROUND|$background|" "$config"
+ fi
+
+ # Create disk image in temporary location and move to target location
+ # afterwards. This way we can run multiple times without requiring cleanup.
+ dmgbuild -s "$config" "$(basename -s .app "$app_dir")" \
+ "$TMP_DIR"/"$(basename "$dmg")"
+ mv "$TMP_DIR"/"$(basename "$dmg")" "$dmg"
+}
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/home.sh b/packaging/macos/jhb/etc/jhb.conf/home.sh
new file mode 100644
index 0000000..31bf892
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/home.sh
@@ -0,0 +1,24 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Redirect user's home directory.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+export HOME=$VER_DIR/home
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/jhbuild.sh b/packaging/macos/jhb/etc/jhb.conf/jhbuild.sh
new file mode 100644
index 0000000..31df78c
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/jhbuild.sh
@@ -0,0 +1,229 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# This file contains functions to download, install and configure JHBuild.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+
+### dependencies ###############################################################
+
+# Nothing here.
+
+### variables ##################################################################
+
+export JHBUILDRC=$ETC_DIR/jhbuildrc
+export JHBUILDRC_CUSTOM=$JHBUILDRC-custom
+
+JHBUILD_REQUIREMENTS="\
+ certifi==2022.9.24\
+ meson==0.59.2\
+ ninja==1.10.2.3\
+"
+
+# JHBuild build system >3.38.0 (current master as of 08.03.2022)
+# The last stable release (3.38.0) is missing a critical fix (commit
+# a896cbf404461cab979fa3cd1c83ddf158efe83b) so we have to stay on master branch
+# for the time being.
+# https://gitlab.gnome.org/GNOME/jhbuild
+# https://wiki.gnome.org/Projects/Jhbuild/Introduction
+JHBUILD_VER=d1c5316
+JHBUILD_URL=https://gitlab.gnome.org/GNOME/jhbuild/-/archive/$JHBUILD_VER/\
+jhbuild-$JHBUILD_VER.tar.bz2
+
+# A dedicated Python runtime (only) for JHBuild. It is installed and kept
+# separately from the rest of the system. It won't interfere with a Python
+# that might get installed as part of building modules with JHBuild.
+JHBUILD_PYTHON_VER_MAJOR=3
+JHBUILD_PYTHON_VER_MINOR=8
+JHBUILD_PYTHON_VER=$JHBUILD_PYTHON_VER_MAJOR.$JHBUILD_PYTHON_VER_MINOR
+JHBUILD_PYTHON_URL="https://gitlab.com/api/v4/projects/26780227/packages/\
+generic/python_macos/15/python_${JHBUILD_PYTHON_VER/./}_$(uname -m).tar.xz"
+JHBUILD_PYTHON_DIR=$OPT_DIR/Python.framework/Versions/$JHBUILD_PYTHON_VER
+JHBUILD_PYTHON_BIN_DIR=$JHBUILD_PYTHON_DIR/bin
+
+export JHBUILD_PYTHON_BIN=$JHBUILD_PYTHON_BIN_DIR/python$JHBUILD_PYTHON_VER
+export JHBUILD_PYTHON_PIP=$JHBUILD_PYTHON_BIN_DIR/pip$JHBUILD_PYTHON_VER
+
+### functions ##################################################################
+
+function jhbuild_install_python
+{
+ # Download and extract Python.framework to OPT_DIR.
+ curl -L "$JHBUILD_PYTHON_URL" | tar -C "$OPT_DIR" -x
+
+ # Create a pkg-config configuration to match our installation location.
+ # Note: sed changes the prefix and exec_prefix lines!
+ find "$JHBUILD_PYTHON_DIR"/lib/pkgconfig/*.pc \
+ -type f \
+ -exec sed -i "" "s|prefix=.*|prefix=$JHBUILD_PYTHON_DIR|" {} \;
+
+ jhbuild_set_python_interpreter
+
+ # add to PYTHONPATH
+ echo "../../../../../../../usr/lib/python$JHBUILD_PYTHON_VER/site-packages"\
+ > "$OPT_DIR"/Python.framework/Versions/$JHBUILD_PYTHON_VER/lib/\
+python$JHBUILD_PYTHON_VER/site-packages/jhb.pth
+}
+
+function jhbuild_set_python_interpreter
+{
+ # Symlink binaries to USR_DIR/bin.
+ if command -v gln 1>/dev/null; then
+ local gnu=g # necessary for union mount
+ fi
+ ${gnu}ln -sf "$JHBUILD_PYTHON_BIN" "$USR_DIR"/bin
+ ${gnu}ln -sf "$JHBUILD_PYTHON_PIP" "$USR_DIR"/bin
+
+ # Set interpreter to the one in USR_DIR/bin.
+ while IFS= read -r -d '' file; do
+ local file_type
+ file_type=$(file "$file")
+ if [[ $file_type = *"Python script"* ]]; then
+ sed -i "" "1 s|.*|#!$USR_DIR/bin/python$JHBUILD_PYTHON_VER|" "$file"
+ fi
+ done < <(find "$USR_DIR"/bin/ -maxdepth 1 -type f -print0)
+}
+
+function jhbuild_install
+{
+ # We use our own custom Python.
+ jhbuild_install_python
+
+ # Install dependencies.
+ # shellcheck disable=SC2086 # we need word splitting for requirements
+ $JHBUILD_PYTHON_PIP install --prefix=$USR_DIR $JHBUILD_REQUIREMENTS
+
+ function pem_remove_expired
+ {
+ local pem_bundle=$1
+
+ # BSD's csplit does not support '{*}' (it's a GNU extension)
+ csplit -n 3 -k -f "$TMP_DIR"/pem- "$pem_bundle" \
+ '/END CERTIFICATE/+1' '{999}' >/dev/null 2>&1 || true
+
+ for pem in "$TMP_DIR"/pem-*; do
+ if [ "$(stat -f%z "$pem")" -eq 0 ]; then
+ rm "$pem" # the csplit command above created one superfluous empty file
+ elif ! openssl x509 -checkend 0 -noout -in "$pem"; then
+ echo_d "removing $pem: $(openssl x509 -enddate -noout -in "$pem")"
+ rm "$pem"
+ fi
+ done
+
+ cat "$TMP_DIR"/pem-??? > "$pem_bundle"
+ }
+
+ local cacert="$USR_DIR"/lib/python$JHBUILD_PYTHON_VER/site-packages/certifi/\
+cacert.pem
+
+ pem_remove_expired "$cacert"
+
+ # Download JHBuild. Setting CURL_CA_BUNDLE is required on older macOS, e.g.
+ # High Sierra.
+ local archive
+ archive=$PKG_DIR/$(basename $JHBUILD_URL)
+ CURL_CA_BUNDLE=$cacert curl -o "$archive" -L "$JHBUILD_URL"
+ tar -C "$SRC_DIR" -xf "$archive"
+
+ ( # Install JHBuild.
+ cd "$SRC_DIR"/jhbuild-$JHBUILD_VER || exit 1
+ ./autogen.sh \
+ --prefix="$USR_DIR" \
+ --with-python="$JHBUILD_PYTHON_BIN"
+ make
+ make install
+ )
+}
+
+function jhbuild_configure
+{
+ local moduleset=$1
+
+ moduleset=${moduleset:-jhb.modules}
+ local suffix
+ suffix=$(basename -s .modules "$moduleset")
+
+ # install custom moduleset
+ if [ "$suffix" != "jhb" ]; then
+ local moduleset_dir
+ moduleset_dir=$(dirname "$(greadlink -f "$moduleset")")
+ rsync -a --delete "$moduleset_dir"/ "$ETC_DIR/modulesets/$suffix/"
+ fi
+
+ local target
+ target=$(/usr/libexec/PlistBuddy -c "Print \
+ :DefaultProperties:MACOSX_DEPLOYMENT_TARGET" "$SDKROOT"/SDKSettings.plist)
+
+ # create custom jhbuildrc configuration
+ {
+ echo "# -*- mode: python -*-"
+
+ # moduleset
+ echo "modulesets_dir = '$ETC_DIR/modulesets/$suffix'"
+ echo "moduleset = '$(basename "$moduleset")'"
+ echo "use_local_modulesets = True"
+
+ # basic directory layout
+ echo "buildroot = '$BLD_DIR'"
+ echo "checkoutroot = '$SRC_DIR'"
+ echo "prefix = '$VER_DIR'"
+ echo "tarballdir = '$PKG_DIR'"
+ echo "top_builddir = '$VAR_DIR/jhbuild'"
+
+ # setup macOS SDK
+ echo "setup_sdk(target=\"$target\")"
+
+ # set release build
+ echo "setup_release()"
+
+ # Use compiler binaries from our own USR_DIR/bin if present, the intention
+ # being that these are symlinks pointing to ccache if that has been
+ # installed (see ccache.sh for details).
+ if [ -x "$USR_DIR/bin/gcc" ]; then
+ echo "os.environ[\"CC\"] = \"$USR_DIR/bin/gcc\""
+ echo "os.environ[\"OBJC\"] = \"$USR_DIR/bin/gcc\""
+ fi
+ if [ -x "$USR_DIR/bin/g++" ]; then
+ echo "os.environ[\"CXX\"] = \"$USR_DIR/bin/g++\""
+ fi
+
+ # certificates for https
+ echo "os.environ[\"SSL_CERT_FILE\"] = \
+ \"$USR_DIR/lib/python$JHBUILD_PYTHON_VER/site-packages/certifi/cacert.pem\""
+ echo "os.environ[\"REQUESTS_CA_BUNDLE\"] = \
+ \"$USR_DIR/lib/python$JHBUILD_PYTHON_VER/site-packages/certifi/cacert.pem\""
+
+ # user home directory
+ echo "os.environ[\"HOME\"] = \"$HOME\""
+
+ # less noise on the terminal if not CI
+ if ! $CI; then
+ echo "quiet_mode = True"
+ echo "progress_bar = True"
+ fi
+
+ # add moduleset-specific settings if exist
+ local moduleset_rc=$ETC_DIR/modulesets/$suffix/jhbuildrc
+ if [ -f "$moduleset_rc" ]; then
+ cat "$moduleset_rc"
+ fi
+
+ } > "$JHBUILDRC-$suffix"
+
+ if command -v gln 1>/dev/null; then
+ local gnu=g # necessary for union mount
+ fi
+ ${gnu}ln -sf "$(basename "$JHBUILDRC-$suffix")" "$JHBUILDRC_CUSTOM"
+
+ # Update the paths to Python.
+ jhbuild_set_python_interpreter
+}
+
+### main #######################################################################
+
+# Nothing here. \ No newline at end of file
diff --git a/packaging/macos/jhb/etc/jhb.conf/path.sh b/packaging/macos/jhb/etc/jhb.conf/path.sh
new file mode 100644
index 0000000..07e7adc
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/path.sh
@@ -0,0 +1,23 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Set PATH.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+
+### variables ##################################################################
+
+export PATH=$BIN_DIR:$USR_DIR/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/pip.sh b/packaging/macos/jhb/etc/jhb.conf/pip.sh
new file mode 100644
index 0000000..5804468
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/pip.sh
@@ -0,0 +1,26 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Redirect pip cache directories.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+export PIP_CACHE_DIR=$VAR_DIR/cache/pip # instead ~/Library/Caches/pip
+export PIPENV_CACHE_DIR=$VAR_DIR/cache/pipenv # instead ~/Library/Caches/pipenv
+export PYTHONPYCACHEPREFIX=$VAR_DIR/cache/pycache
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/release.sh b/packaging/macos/jhb/etc/jhb.conf/release.sh
new file mode 100644
index 0000000..6fe8708
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/release.sh
@@ -0,0 +1,35 @@
+# SPDX-FileCopyrightText: 2022 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Release artifact.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+RELEASE_ARCHIVE=${RELEASE_ARCHIVE:-$(basename "$VER_DIR")_$(uname -m).tar.xz}
+
+# GitHub and GitLab
+# shellcheck disable=2206 # we need expansion for the array to work
+RELEASE_URLS=(${RELEASE_URLS[@]:-
+ "https://github.com/dehesselle/jhb/releases/download/\
+v$VERSION/$RELEASE_ARCHIVE"
+ "https://gitlab.com/api/v4/projects/35965804/packages/generic/jhb/\
+$VERSION/$RELEASE_ARCHIVE"
+})
+
+RELEASE_OVERLAY=overlay
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/sdkroot.sh b/packaging/macos/jhb/etc/jhb.conf/sdkroot.sh
new file mode 100644
index 0000000..deda692
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/sdkroot.sh
@@ -0,0 +1,41 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# If SDKROOT is set, use that. If it is not set, use whatever SDK is available.
+# This might still end up being invalid if neither Xcode nor CLT have been
+# installed, and that's what sdkroot_exists is for.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+if [ -z "$SDKROOT" ]; then
+ if xcodebuild --help 2>/dev/null; then
+ SDKROOT=$(xcodebuild -version -sdk macosx Path)
+ else
+ SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+ fi
+fi
+export SDKROOT
+
+### functions ##################################################################
+
+function sdkroot_exists
+{
+ if [ -d "$SDKROOT" ]; then
+ return 0 # SDK found
+ else
+ echo_e "SDK not found: $SDKROOT"
+ return 1
+ fi
+}
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/sys.sh b/packaging/macos/jhb/etc/jhb.conf/sys.sh
new file mode 100644
index 0000000..1871b21
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/sys.sh
@@ -0,0 +1,121 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# System and version checks.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### dependencies ###############################################################
+
+# Nothing here.
+
+### variables ##################################################################
+
+SYS_ARCH=$(uname -m | tr '[:lower:]' '[:upper:]')
+
+if [ "$SYS_USRLOCAL_IGNORE" != "true" ]; then
+ SYS_USRLOCAL_IGNORE=false
+fi
+
+SYS_MACOS_VER=$(sw_vers -productVersion)
+
+# descending order on purpose: most recent platform first
+# shellcheck disable=2206 # we need expansion for the array to work
+SYS_MACOS_VER_RECOMMENDED=(${SYS_MACOS_VER_RECOMMENDED:-
+ 12.6.1
+ 12.6
+ 11.7
+})
+
+SYS_SDK_VER="$(/usr/libexec/PlistBuddy -c \
+ "Print :DefaultProperties:MACOSX_DEPLOYMENT_TARGET" \
+ "$SDKROOT"/SDKSettings.plist)"
+
+SYS_SDK_VER_RECOMMENDED_X86_64=${SYS_SDK_VER_RECOMMENDED_X86_64:-10.13}
+SYS_SDK_VER_RECOMMENDED_ARM64=${SYS_SDK_VER_RECOMMENDED_ARM64:-11.3}
+SYS_SDK_VER_RECOMMENDED=$(eval echo \$SYS_SDK_VER_RECOMMENDED_"$SYS_ARCH")
+
+### functions ##################################################################
+
+function sys_create_log
+{
+ # Create jhb.log file.
+
+ mkdir -p "$VAR_DIR"/log
+
+ for var in SYS_MACOS_VER SYS_SDK_VER VERSION VER_DIR WRK_DIR; do
+ echo "$var = $(eval echo \$$var)" >> "$VAR_DIR"/log/jhb.log
+ done
+}
+
+function sys_macos_is_recommended
+{
+ for version in "${SYS_MACOS_VER_RECOMMENDED[@]}"; do
+ if [ "$version" = "$SYS_MACOS_VER" ]; then
+ return 0
+ fi
+ done
+
+ echo_w "using macOS $SYS_MACOS_VER (recommended: \
+${SYS_MACOS_VER_RECOMMENDED[0]})"
+ return 1
+}
+
+function sys_sdk_is_recommended
+{
+ if [ "$SYS_SDK_VER_RECOMMENDED" = "$SYS_SDK_VER" ]; then
+ return 0
+ fi
+
+ echo_w "using SDK $SYS_SDK_VER (recommended: $SYS_SDK_VER_RECOMMENDED)"
+ return 1
+}
+
+function sys_usrlocal_is_clean
+{
+ local count=0
+
+ # Based on GitHub CI experience, it appears to be enough to make sure
+ # the following folders do not contain files.
+ for dir in include lib share; do
+ count=$(( count + \
+ $(find /usr/local/$dir -type f 2>/dev/null | wc -l | awk '{ print $1 }')\
+ ))
+ done
+
+ if [ "$count" -ne 0 ]; then
+ if $SYS_USRLOCAL_IGNORE; then
+ echo_w "Found files in '/usr/local/[include|lib|share]'."
+ else
+ echo_e "Found files in '/usr/local/[include|lib|share]'!"
+ echo_e "This is known to cause trouble, but you can downgrade this error"
+ echo_e "to a warning at your own risk:"
+ echo_e " "
+ echo_e " export SYS_USRLOCAL_IGNORE=true"
+ return 1
+ fi
+ fi
+
+ return 0
+}
+
+function sys_wrkdir_is_usable
+{
+ if mkdir -p "$WRK_DIR" 2>/dev/null &&
+ [ -w "$WRK_DIR" ] ; then
+ return 0 # WRK_DIR has been created or was already there and is writable
+ else
+ echo_e "WRK_DIR not usable: $WRK_DIR"
+ return 1
+ fi
+}
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/temp.sh b/packaging/macos/jhb/etc/jhb.conf/temp.sh
new file mode 100644
index 0000000..5de20a7
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/temp.sh
@@ -0,0 +1,27 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Redirect temporary locations.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+# shellcheck disable=SC2153 # this is no misspelling
+export TMP=$TMP_DIR
+export TEMP=$TMP_DIR
+export TMPDIR=$TMP_DIR # TMPDIR is the common macOS default
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/version.sh b/packaging/macos/jhb/etc/jhb.conf/version.sh
new file mode 100644
index 0000000..edd851b
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/version.sh
@@ -0,0 +1,24 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# The main version number.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+VERSION=${VERSION:-0.22}
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.
diff --git a/packaging/macos/jhb/etc/jhb.conf/xdg.sh b/packaging/macos/jhb/etc/jhb.conf/xdg.sh
new file mode 100644
index 0000000..28a786e
--- /dev/null
+++ b/packaging/macos/jhb/etc/jhb.conf/xdg.sh
@@ -0,0 +1,25 @@
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# Redirect some XDG directories.
+
+### shellcheck #################################################################
+
+# shellcheck shell=bash # no shebang as this file is intended to be sourced
+# shellcheck disable=SC2034 # we only use exports if we really need them
+
+### variables ##################################################################
+
+export XDG_CACHE_HOME=$VAR_DIR/cache # instead ~/.cache
+export XDG_CONFIG_HOME=$ETC_DIR # instead ~/.config
+
+### functions ##################################################################
+
+# Nothing here.
+
+### main #######################################################################
+
+# Nothing here.