summaryrefslogtreecommitdiffstats
path: root/packaging/macos/jhb/usr/bin/bootstrap
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/usr/bin/bootstrap
parentInitial commit. (diff)
downloadinkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.tar.xz
inkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.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/usr/bin/bootstrap')
-rwxr-xr-xpackaging/macos/jhb/usr/bin/bootstrap135
1 files changed, 135 insertions, 0 deletions
diff --git a/packaging/macos/jhb/usr/bin/bootstrap b/packaging/macos/jhb/usr/bin/bootstrap
new file mode 100755
index 0000000..3d46dbb
--- /dev/null
+++ b/packaging/macos/jhb/usr/bin/bootstrap
@@ -0,0 +1,135 @@
+#!/usr/bin/env bash
+#
+# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+### description ################################################################
+
+# This script bootstraps JHBuild so it's ready to build any module.
+
+### shellcheck #################################################################
+
+# Nothing here.
+
+### dependencies ###############################################################
+
+#------------------------------------------------------ source jhb configuration
+
+# You can install a custom configuration file by passing it as first
+# argument. It has to be named '*.conf.sh'.
+
+source "$(dirname "${BASH_SOURCE[0]}")"/../../etc/jhb.conf.sh "$1"
+
+#------------------------------------------- source common functions from bash_d
+
+# bash_d is already available (it's part of jhb configuration)
+
+bash_d_include error
+
+### variables ##################################################################
+
+SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1; pwd)
+
+FORCE_BUILD_FROM_SOURCE=${FORCE_BUILD_FROM_SOURCE:-false}
+
+### functions ##################################################################
+
+function is_release_usable
+{
+ local url=$1
+
+ local partial_download="$TMP_DIR/${FUNCNAME[0]}".tar.xz
+ local rc=1
+
+ # download at least 100 kb of data
+ curl -L "$url" 2>/dev/null | head -c 100000 > "$partial_download"
+ # if we got 100 kb, it's not a "404 file not found"
+ if [ "$(stat -f%z "$partial_download")" -eq 100000 ]; then
+ # look inside: dir needs to match our VER_DIR to be usable
+ local dir
+ dir=$(basename "$(tar -tvJf "$partial_download" 2>/dev/null |
+ head -n 1 | awk '{ print $NF }')")
+ if [ "$dir" = "$(basename "$VER_DIR")" ]; then
+ rc=0
+ fi
+ fi
+
+ rm "$partial_download"
+
+ return $rc
+}
+
+### main #######################################################################
+
+error_trace_enable
+
+#-------------------------------------------------------- print main directories
+
+echo_i "WRK_DIR = $WRK_DIR"
+echo_i "VER_DIR = $VER_DIR"
+
+#--------------------------------------------------------- perform system checks
+
+if sys_wrkdir_is_usable &&
+ sdkroot_exists &&
+ sys_usrlocal_is_clean; then
+
+ # these checks may issue warnings but have have no consequences otherwise
+ sys_macos_is_recommended || true
+ sys_sdk_is_recommended || true
+else
+ exit 1 # cannot continue
+fi
+
+#--------------------------------------------------- initialize directory layout
+
+if [ "$SELF_DIR" = "$USR_DIR"/bin ]; then
+ : # we are already running inside target directory layout
+else
+ # sync repository into target structure, remove everything git-related
+ rsync -a "$SELF_DIR"/../../../jhb/ "$VER_DIR"/
+ find "$VER_DIR" -type f -name ".gitignore" -delete
+ rm -rf "$VER_DIR"/.git
+ rm "$VER_DIR"/.gitmodules
+fi
+
+#------------------------------------------- check if binary release can be used
+
+for URL in "${RELEASE_URLS[@]}"; do
+ if is_release_usable "$URL" && ! $FORCE_BUILD_FROM_SOURCE; then
+ echo_i "using $URL"
+ curl -L "$URL" | tar -C "$WRK_DIR" -xJ
+ exit $? # we can quit here and now, nothing further to do
+ fi
+done
+
+echo_i "building everything from scratch"
+
+#---------------------------------------------------------------- install ccache
+
+ccache_install
+ccache_configure
+
+#------------------------------------------ log relevant versions to release.log
+
+sys_create_log
+
+#------------------------------------------------- install and configure JHBuild
+
+jhbuild_install
+jhbuild_configure
+
+#------------------------------------------------------- run bootstrap procedure
+
+jhbuild bootstrap-gtk-osx
+
+#--------------------------------------------------------- install GNU utilities
+
+# GNU versions of various utilites make life significantly easier on macOS.
+
+jhbuild build coreutils findutils sed tar
+
+#-------------------------------------------------------------- install dmgbuild
+
+dmgbuild_install