From ab482654696a3b6b5adfae95fffe45291199712d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20de=20Hesselle?= Date: Mon, 22 Apr 2019 20:45:50 +0200 Subject: Update macOS build pipeline Highlights: - fixes open/save crashes - fixes localization - bundles Python 3, enabling extensions Also lots of internal improvements and refactoring. --- packaging/macos/010-defaults.sh | 31 +++++++ packaging/macos/010-vars.sh | 75 ---------------- packaging/macos/020-funcs.sh | 100 --------------------- packaging/macos/020-vars.sh | 150 +++++++++++++++++++++++++++++++ packaging/macos/030-funcs.sh | 121 +++++++++++++++++++++++++ packaging/macos/110-jhbuild-bootstrap.sh | 66 -------------- packaging/macos/110-jhbuild-install.sh | 63 +++++++++++++ packaging/macos/120-jhbuild-bootstrap.sh | 16 ++++ packaging/macos/120-jhbuild-python2.sh | 33 ------- packaging/macos/130-jhbuild-gtk3.sh | 23 ----- packaging/macos/130-jhbuild-python.sh | 60 +++++++++++++ packaging/macos/140-jhbuild-gtk3.sh | 25 ++++++ packaging/macos/140-jhbuild-inkdeps.sh | 64 ------------- packaging/macos/150-jhbuild-inkdeps.sh | 65 ++++++++++++++ packaging/macos/210-inkscape-build.sh | 40 +++++++++ packaging/macos/210-inkscape.sh | 86 ------------------ packaging/macos/220-inkscape-package.sh | 102 +++++++++++++++++++++ packaging/macos/230-inkscape-distrib.sh | 23 +++++ packaging/macos/README.md | 31 +++---- packaging/macos/build_all.sh | 20 +++++ packaging/macos/build_inkscape.sh | 20 +++++ packaging/macos/build_toolset.sh | 30 +++++++ packaging/macos/create_buildenv.sh | 10 --- packaging/macos/inkscape.bundle | 17 +++- 24 files changed, 791 insertions(+), 480 deletions(-) create mode 100644 packaging/macos/010-defaults.sh delete mode 100755 packaging/macos/010-vars.sh delete mode 100755 packaging/macos/020-funcs.sh create mode 100644 packaging/macos/020-vars.sh create mode 100644 packaging/macos/030-funcs.sh delete mode 100755 packaging/macos/110-jhbuild-bootstrap.sh create mode 100755 packaging/macos/110-jhbuild-install.sh create mode 100755 packaging/macos/120-jhbuild-bootstrap.sh delete mode 100755 packaging/macos/120-jhbuild-python2.sh delete mode 100755 packaging/macos/130-jhbuild-gtk3.sh create mode 100755 packaging/macos/130-jhbuild-python.sh create mode 100755 packaging/macos/140-jhbuild-gtk3.sh delete mode 100755 packaging/macos/140-jhbuild-inkdeps.sh create mode 100755 packaging/macos/150-jhbuild-inkdeps.sh create mode 100755 packaging/macos/210-inkscape-build.sh delete mode 100755 packaging/macos/210-inkscape.sh create mode 100755 packaging/macos/220-inkscape-package.sh create mode 100755 packaging/macos/230-inkscape-distrib.sh create mode 100755 packaging/macos/build_all.sh create mode 100755 packaging/macos/build_inkscape.sh create mode 100755 packaging/macos/build_toolset.sh delete mode 100755 packaging/macos/create_buildenv.sh (limited to 'packaging/macos') diff --git a/packaging/macos/010-defaults.sh b/packaging/macos/010-defaults.sh new file mode 100644 index 000000000..95efff69f --- /dev/null +++ b/packaging/macos/010-defaults.sh @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 010-defaults.sh ### +# This file contains a few default values that YOU ARE NOT SUPPOSED TO CHANGE +# and are for this reason only in '010-defaults.sh' and not in '020-vars.sh'. +# There are certain checks and dependencies that are out of your control +# and the other scripts blindly trust that the defaults set in this file +# are "the truth". (I you continue to read, you'll hopefully see that +# this has not been done out of malicious intent but for good reasons.) +# You have been warned. + +[ -z $DEFAULTS_INCLUDED ] && DEFAULTS_INCLUDED=true || return # include guard + +### path for pre-built build environment ####################################### + +# This is the path the pre-built build environment has been built in. Therefore, +# all binaries and libraries have hard-coded library locations relative to this +# path. If you decide to not build the build environment yourself and want to +# use the pre-built one, it is essential that the $WRK_DIR you are using is the +# same as $DEFAULT_SYSTEM_WRK_DIR, otherwise it doesn't work. +# The scripts will make their decision if the pre-built build environment can be +# used based on comparing values between $WRK_DIR and $DEFAULT_SYSTEM_WRK_DIR. + +DEFAULT_SYSTEM_WRK_DIR=/work + +# If using $DEFAULT_SYSTEM_WRK_DIR is not on option, use there is a default +# user-based location. + +DEFAULT_USER_WRK_DIR=$HOME/work diff --git a/packaging/macos/010-vars.sh b/packaging/macos/010-vars.sh deleted file mode 100755 index b54b11efe..000000000 --- a/packaging/macos/010-vars.sh +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 010-vars.sh ### -# This file contains all the global variables (as in: configuration for the -# build pipeline) and gets sourced by all the other scripts. -# If you want to override settings, the suggested way is that you create a -# `0nn-custom.sh` file and put them there. All files named '0nn-*.sh' get -# sourced in order of appearance. - -[ -z $VARS_INCLUDED ] && VARS_INCLUDED=true || return # include guard - -### source .profile ############################################################ - -# This is necessary on the first run and after changing directory settings. -# So, we're better safe than sorry and source it. - -source $HOME/.profile - -### general settings ########################################################### - -CORES=$(sysctl -n hw.ncpu) # use all available cores -export MAKEFLAGS="-j $CORES" - -XZ_OPT=-T0 # use all available cores - -### workspace/build environment paths ########################################## - -WRK_DIR=$HOME/work -OPT_DIR=$WRK_DIR/opt -BIN_DIR=$OPT_DIR/bin -TMP_DIR=$OPT_DIR/tmp -SRC_DIR=$OPT_DIR/src -LIB_DIR=$OPT_DIR/lib - -RAMDISK_ENABLE=true # mount ramdisk to $WRK_DIR -RAMDISK_SIZE=10 # unit is GiB - -### application bundle paths ################################################### - -APP_DIR=$WRK_DIR/Inkscape.app # keep in sync with 'inkscape.bundle' -APP_RES_DIR=$APP_DIR/Contents/Resources -APP_LIB_DIR=$APP_RES_DIR/lib -APP_BIN_DIR=$APP_RES_DIR/bin -APP_EXE_DIR=$APP_DIR/Contents/MacOS -APP_PLIST=$APP_DIR/Contents/Info.plist - -### downlad URLs ############################################################### - -URL_BOOST=https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2 -URL_DOUBLE_CONVERSION=https://github.com/google/double-conversion/archive/v3.1.4.tar.gz -URL_FREETYPE=https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2 -URL_GC=https://github.com/ivmai/bdwgc/releases/download/v8.0.4/gc-8.0.4.tar.gz -URL_GDL=https://github.com/GNOME/gdl/archive/GDL_3_28_0.tar.gz -URL_GSL=http://ftp.fau.de/gnu/gsl/gsl-2.5.tar.gz -URL_GTK_MAC_BUNDLER=https://gitlab.gnome.org/GNOME/gtk-mac-bundler/-/archive/727793cfae08dec0e1e2621078d53a02ec5f7fb3.tar.gz -URL_GTK_OSX=https://raw.githubusercontent.com/dehesselle/gtk-osx/inkscape -URL_GTK_OSX_BUILD_SETUP=$URL_GTK_OSX/gtk-osx-build-setup.sh -URL_GTK_OSX_MODULESET=$URL_GTK_OSX/modulesets-stable/gtk-osx.modules -URL_LIBPSL=https://github.com/rockdaboot/libpsl/releases/download/libpsl-0.20.2/libpsl-0.20.2.tar.gz -URL_LIBSOUP=https://ftp.gnome.org/pub/GNOME/sources/libsoup/2.65/libsoup-2.65.92.tar.xz -URL_OPENJPEG=https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz -URL_OPENSSL=https://www.openssl.org/source/openssl-1.1.1b.tar.gz -URL_POPPLER=https://gitlab.freedesktop.org/poppler/poppler/-/archive/poppler-0.74.0/poppler-poppler-0.74.0.tar.gz -# Inkscape Git -URL_INKSCAPE=https://gitlab.com/inkscape/inkscape -# TODO icon in icns format -# This is the only binary file in the build pipeline and it's roughly 1 MiB in -# size. I do not want to merge that to Inkscape because it's a temporary -# workarond: a future version of the build pipeline will generate the icns from -# an already present png file on-the-fly. But until that's been implemented, -# download the icns from the original "macOS Inkscape build and package" -# repository. -URL_INKSCAPE_ICNS=https://github.com/dehesselle/mibap/raw/master/inkscape.icns diff --git a/packaging/macos/020-funcs.sh b/packaging/macos/020-funcs.sh deleted file mode 100755 index 124938cd4..000000000 --- a/packaging/macos/020-funcs.sh +++ /dev/null @@ -1,100 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 020-vars.sh ### -# This file contains all the functions used by the other scripts. It helps -# modularizing functionalities and keeping the scripts that do the real work -# as clean as possible. - -[ -z $FUNCS_INCLUDED ] && FUNCS_INCLUDED=true || return # include guard - -SELF_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd -P) -source $SELF_DIR/010-vars.sh - -### get repository version string ############################################## - -function get_repo_version -{ - local repo=$1 - #echo $(git -C $repo describe --tags --dirty) - echo $(git -C $repo log --pretty=format:'%h' -n 1) -} - -### get compression flag by filename extension ################################# - -function get_comp_flag -{ - local file=$1 - - local extension=${file##*.} - - case $extension in - gz) echo "z" ;; - bz2) echo "j" ;; - xz) echo "J" ;; - *) echo "ERROR unknown extension $extension" - esac -} - -### download and extract source tarball ######################################## - -function get_source -{ - local url=$1 - local log=$TMP_DIR/$FUNCNAME.log - - cd $SRC_DIR - - # This downloads a file and pipes it directly into tar (file is not saved - # to disk) to extract it. Output is saved temporarily to determine - # the directory the files have been extracted to. - curl -L $url | tar xv$(get_comp_flag $url) 2>$log - cd $(head -1 $log | awk '{ print $2 }') - rm $log -} - -### make, make install in jhbuild environment ################################## - -function make_makeinstall -{ - jhbuild run make - jhbuild run make install -} - -### configure, make, make install in jhbuild environment ####################### - -function configure_make_makeinstall -{ - local flags="$*" - - jhbuild run ./configure --prefix=$OPT_DIR $flags - make_makeinstall -} - -### cmake, make, make install in jhbuild environment ########################### - -function cmake_make_makeinstall -{ - local flags="$*" - - mkdir builddir - cd builddir - jhbuild run cmake -DCMAKE_INSTALL_PREFIX=$OPT_DIR $flags .. - make_makeinstall -} - -### create and mount ramdisk ################################################### - -function create_ramdisk -{ - local dir=$1 # mountpoint - local size=$2 # unit is GiB - - if [ $(mount | grep $dir | wc -l) -eq 0 ]; then - local device=$(hdiutil attach -nomount ram://$(expr $size \* 1024 \* 2048)) - newfs_hfs -v "RAMDISK" $device - mount -o noatime,nobrowse -t hfs $device $dir - fi -} - diff --git a/packaging/macos/020-vars.sh b/packaging/macos/020-vars.sh new file mode 100644 index 000000000..5a3711c0c --- /dev/null +++ b/packaging/macos/020-vars.sh @@ -0,0 +1,150 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 020-vars.sh ### +# This file contains all the global variables (as in: configuration for the +# build pipeline) and gets sourced by all the other scripts. +# If you want to override settings, the suggested way is that you create a +# `0nn-custom.sh` file and put them there. All files named '0nn-*.sh' get +# sourced in numerical order. + +[ -z $VARS_INCLUDED ] && VARS_INCLUDED=true || return # include guard + +### source .profile ############################################################ + +# This is necessary on the first run and after changing directory settings. +# So, we're better safe than sorry and source it. + +[ -f $HOME/.profile ] && source $HOME/.profile + +### name ####################################################################### + +SELF_NAME=$(basename $0) + +### multithreading ############################################################# + +CORES=$(sysctl -n hw.ncpu) # use all available cores +export MAKEFLAGS="-j $CORES" + +### ramdisk #################################################################### + +RAMDISK_ENABLE=true # mount ramdisk to $WRK_DIR +RAMDISK_SIZE=10 # unit is GiB + +### try to use pre-built toolset ############################################### + +# In order to just download and extract a pre-built toolset +# - it has to be enabled ('TOOLSET_CACHE_ENABLE=true') +# - you have to use $DEFAULT_SYSTEM_WRK_DIR as your $WRK_DIR +# (see commentary in the section below for explanation) +# +# It does not hurt to have it enabled by default, because if it cannot be +# used, it won't be used and doesn't cause errors. + +TOOLSET_CACHE_ENABLE=true + +### workspace/build environment paths ########################################## + +# The current behavior of selecting a $WRK_DIR: +# 1. If there IS a pre-existing value (user configuration), use that. +# a. If it IS NOT writable, exit with error. +# 2. If there IS NOT a pre-existing value, try to use $DEFAULT_SYSTEM_WRK_DIR. +# a. If it DOES exist and IS writable, continue using that. +# b. If it DOES exist and IS NOT writable, exit with error. +# c. If it DOES NOT exist, use $DEFAULT_USER_WRK_DIR. +# +# The reasoning behind this: +# In regards to (1), if the user configured a directory, it has to be used. If +# it can't be used, exit with error (as a user would expect). +# In regards to (2), using an arbitrary system-level location like +# $DEFAULT_SYSTEM_WRK_DIR is considered optional as in "you have to opt-in" +# (and not mandatory at all). You can tell us that you "opted-in" by creating +# that directory beforehand and ensuring it's writable (2a). Than it's going to +# be used. (I don't like writing scripts that write to arbitrary locations on +# their own. Also, that would require 'sudo' permission.) +# If $DEFAULT_SYSTEM_WRK_DIR does not exist, it means that you did not +# "opt-in" (2c) and we're going to use the user-based default location, +# $DEFAULT_USER_WRK_DIR. If $DEFAULT_SYSTEM_WRK_DIR does exist but is not +# writable, the situation is unclear and we exit in error (2b). +# +# But why bother with a $DEFAULT_SYSTEM_WRK_DIR at all? Because that's the only +# way a pre-built build environment can be used (hard-coded library locations). + +if [ -z $WRK_DIR ]; then # no pre-existing value + WRK_DIR=$DEFAULT_SYSTEM_WRK_DIR # try default first + + if [ -d $WRK_DIR ]; then # needs to exist and + if [ ! -w $WRK_DIR ]; then # must be writable + echo "directory exists but not writable: $WRK_DIR" + exit 1 + fi + else # use work directory below user's home (writable for sure) + WRK_DIR=$DEFAULT_USER_WRK_DIR + fi +fi + +if [ $(mkdir -p $WRK_DIR 2>/dev/null; echo $?) -eq 0 ] && + [ -w $WRK_DIR ]; then + echo "using build directory: $WRK_DIR" +else + echo "directory not writable: $WRK_DIR" + exit 1 +fi + +OPT_DIR=$WRK_DIR/opt +BIN_DIR=$OPT_DIR/bin +LIB_DIR=$OPT_DIR/lib +SRC_DIR=$OPT_DIR/src +TMP_DIR=$OPT_DIR/tmp + +### artifact path ############################################################## + +# This is the location where the final product - like application bundle or +# diskimage (no intermediate programs/libraries/...) - is created in. + +ARTIFACT_DIR=$WRK_DIR/artifacts + +### application bundle paths ################################################### + +APP_DIR=$ARTIFACT_DIR/Inkscape.app +APP_CON_DIR=$APP_DIR/Contents +APP_RES_DIR=$APP_CON_DIR/Resources +APP_BIN_DIR=$APP_RES_DIR/bin +APP_EXE_DIR=$APP_CON_DIR/MacOS +APP_LIB_DIR=$APP_RES_DIR/lib +APP_PLIST=$APP_CON_DIR/Info.plist + +### downlad URLs ############################################################### + +# These are the versioned URLs of Inkscape dependencies that are not part of +# any JHBuild moduleset. (They are candidates for a custom Inkscape moduleset.) + +URL_BOOST=https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2 +URL_DOUBLE_CONVERSION=https://github.com/google/double-conversion/archive/v3.1.4.tar.gz +URL_FREETYPE=https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2 +URL_GC=https://github.com/ivmai/bdwgc/releases/download/v8.0.4/gc-8.0.4.tar.gz +URL_GDL=https://github.com/GNOME/gdl/archive/GDL_3_28_0.tar.gz +URL_GSL=http://ftp.fau.de/gnu/gsl/gsl-2.5.tar.gz +URL_GTK_MAC_BUNDLER=https://gitlab.gnome.org/GNOME/gtk-mac-bundler/-/archive/727793cfae08dec0e1e2621078d53a02ec5f7fb3.tar.gz +URL_GTK_OSX=https://raw.githubusercontent.com/dehesselle/gtk-osx/inkscape +URL_GTK_OSX_BUILD_SETUP=$URL_GTK_OSX/gtk-osx-build-setup.sh +URL_GTK_OSX_MODULESET=$URL_GTK_OSX/modulesets-stable/gtk-osx.modules +# Inkscape Git repository +URL_INKSCAPE=https://gitlab.com/inkscape/inkscape +# TODO icon in icns format +# This is the only binary file in the build pipeline and it's roughly 1 MiB in +# size. I do not want to merge that to Inkscape because it's a temporary +# workarond: a future version of the build pipeline will generate the icns from +# an already present png file on-the-fly. But until that's been implemented, +# download the icns from the original "macOS Inkscape build and package" +# repository. +URL_INKSCAPE_ICNS=https://github.com/dehesselle/mibap/raw/master/inkscape.icns +URL_LIBPSL=https://github.com/rockdaboot/libpsl/releases/download/libpsl-0.20.2/libpsl-0.20.2.tar.gz +URL_LIBSOUP=https://ftp.gnome.org/pub/GNOME/sources/libsoup/2.65/libsoup-2.65.92.tar.xz +URL_OPENJPEG=https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz +URL_OPENSSL=https://www.openssl.org/source/openssl-1.1.1b.tar.gz +URL_POPPLER=https://gitlab.freedesktop.org/poppler/poppler/-/archive/poppler-0.74.0/poppler-poppler-0.74.0.tar.gz +# A pre-built version of the complete toolset. +URL_TOOLSET_CACHE=https://github.com/dehesselle/mibap/releases/download/v0.7/mibap_v0.7.tar.xz + diff --git a/packaging/macos/030-funcs.sh b/packaging/macos/030-funcs.sh new file mode 100644 index 000000000..841c26f29 --- /dev/null +++ b/packaging/macos/030-funcs.sh @@ -0,0 +1,121 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 030-funcs.sh ### +# This file contains all the functions used by the other scripts. It helps +# modularizing functionalities and keeping the scripts that do the real work +# as clean as possible. +# This file does not include the "vars" files it requires itself (on purpose, +# for flexibility reasons), the script that wants to use these functions +# needs to do that. The suggest way is to always source all the "0nn-*.sh" +# files in order. + +[ -z $FUNCS_INCLUDED ] && FUNCS_INCLUDED=true || return # include guard + +### get repository version string ############################################## + +function get_repo_version +{ + local repo=$1 + #echo $(git -C $repo describe --tags --dirty) + echo $(git -C $repo log --pretty=format:'%h' -n 1) +} + +### get compression flag by filename extension ################################# + +function get_comp_flag +{ + local file=$1 + + local extension=${file##*.} + + case $extension in + gz) echo "z" ;; + bz2) echo "j" ;; + xz) echo "J" ;; + *) echo "ERROR unknown extension $extension" + esac +} + +### download and extract source tarball ######################################## + +function get_source +{ + local url=$1 + local target_dir=$2 # optional argument, defaults to $SRC_DIR + + [ ! -d $TMP_DIR ] && mkdir -p $TMP_DIR + local log=$(mktemp $TMP_DIR/$FUNCNAME.XXXX) + [ -z $target_dir ] && target_dir=$SRC_DIR + + cd $target_dir + + # This downloads a file and pipes it directly into tar (file is not saved + # to disk) to extract it. Output is saved temporarily to determine + # the directory the files have been extracted to. + curl -L $url | tar xv$(get_comp_flag $url) 2>$log + cd $(head -1 $log | awk '{ print $2 }') + rm $log +} + +### make, make install in jhbuild environment ################################## + +function make_makeinstall +{ + jhbuild run make + jhbuild run make install +} + +### configure, make, make install in jhbuild environment ####################### + +function configure_make_makeinstall +{ + local flags="$*" + + jhbuild run ./configure --prefix=$OPT_DIR $flags + make_makeinstall +} + +### cmake, make, make install in jhbuild environment ########################### + +function cmake_make_makeinstall +{ + local flags="$*" + + mkdir builddir + cd builddir + jhbuild run cmake -DCMAKE_INSTALL_PREFIX=$OPT_DIR $flags .. + make_makeinstall +} + +### create and mount ramdisk ################################################### + +function create_ramdisk +{ + local dir=$1 # mountpoint + local size=$2 # unit is GiB + + if [ $(mount | grep $dir | wc -l) -eq 0 ]; then + local device=$(hdiutil attach -nomount ram://$(expr $size \* 1024 \* 2048)) + newfs_hfs -v "RAMDISK" $device + mount -o noatime,nobrowse -t hfs $device $dir + fi +} + +### insert line into a textfile ################################################ + +# insert_before [filename] '[insert before this pattern]' '[line to insert]' + +function insert_before +{ + local file=$1 + local pattern=$2 + local line=$3 + + local file_tmp=$(mktemp) + awk "/${pattern}/{print \"$line\"}1" $file > $file_tmp + cat $file_tmp > $file # we don't 'mv' to preserve permissions + rm $file_tmp +} + diff --git a/packaging/macos/110-jhbuild-bootstrap.sh b/packaging/macos/110-jhbuild-bootstrap.sh deleted file mode 100755 index d5368cc1b..000000000 --- a/packaging/macos/110-jhbuild-bootstrap.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 110-jhbuild-bootstrap.sh ### -# Bootstrap the jhbuild environment. - -SELF_DIR=$(cd $(dirname "$0"); pwd -P) -for script in $SELF_DIR/0??-*.sh; do source $script; done - -### create our work directory ################################################## - -[ ! -d $WRK_DIR ] && mkdir -p $WRK_DIR - -# Use a ramdisk to speed up things. -if $RAMDISK_ENABLE; then - create_ramdisk $WRK_DIR $RAMDISK_SIZE -fi - -### setup path ################################################################# - -# WARNING: Operations like this are the reason that you're supposed to use -# a dedicated machine for building. This script does not care for your -# data. -echo "export PATH=$BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin" > ~/.profile -source ~/.profile - -### setup directories for jhbuild ############################################## - -mkdir -p $TMP_DIR -mkdir -p $SRC_DIR/checkout # extracted tarballs -mkdir -p $SRC_DIR/download # downloaded tarballs - -# WARNING: Operations like this are the reason that you're supposed to use -# a dedicated machine for building. This script does not care for your -# data. -rm -rf ~/.cache ~/.local ~/Source # remove remnants of previous run -ln -sf $TMP_DIR ~/.cache # link to our workspace -ln -sf $OPT_DIR ~/.local # link to our workspace -ln -sf $SRC_DIR ~/Source # link to our workspace - -### install and configure jhbuild ############################################## - -cd $WRK_DIR -bash <(curl -s $URL_GTK_OSX_BUILD_SETUP) # run jhbuild setup script - -JHBUILDRC=$HOME/.jhbuildrc-custom -if [ -f $JHBUILDRC ]; then # remove previous configuration from end of file - LINE_NO=$(grep -n "# And more..." $JHBUILDRC | awk -F ":" '{ print $1 }') - head -n +$LINE_NO $JHBUILDRC >$JHBUILDRC.clean - mv $JHBUILDRC.clean $JHBUILDRC - unset LINE_NO -fi - -# configure jhbuild -echo "checkoutroot = '$SRC_DIR/checkout'" >> $JHBUILDRC -echo "prefix = '$OPT_DIR'" >> $JHBUILDRC -echo "tarballdir = '$SRC_DIR/download'" >> $JHBUILDRC -echo "quiet_mode = True" >> $JHBUILDRC # suppress all build output -echo "progress_bar = True" >> $JHBUILDRC -echo "moduleset = '$URL_GTK_OSX_MODULESET'" >> $JHBUILDRC - -### bootstrap jhbuild environment ############################################## - -jhbuild bootstrap diff --git a/packaging/macos/110-jhbuild-install.sh b/packaging/macos/110-jhbuild-install.sh new file mode 100755 index 000000000..cf6cdaea0 --- /dev/null +++ b/packaging/macos/110-jhbuild-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 110-jhbuild-install.sh ### +# Install the JHBuild tool. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +### create our work directory ################################################## + +[ ! -d $WRK_DIR ] && mkdir -p $WRK_DIR + +# Use a ramdisk to speed up things. +if $RAMDISK_ENABLE; then + create_ramdisk $WRK_DIR $RAMDISK_SIZE +fi + +### setup path ################################################################# + +# WARNING: Operations like this are the reason that you're supposed to use +# a dedicated machine for building. This script does not care for your +# data. +echo "export PATH=$BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin" > $HOME/.profile +source $HOME/.profile + +### setup directories for jhbuild ############################################## + +mkdir -p $TMP_DIR +mkdir -p $SRC_DIR/checkout # extracted tarballs +mkdir -p $SRC_DIR/download # downloaded tarballs + +# WARNING: Operations like this are the reason that you're supposed to use +# a dedicated machine for building. This script does not care for your +# data. +rm -rf $HOME/.cache +rm -rf $HOME/.local +ln -sf $TMP_DIR $HOME/.cache # link to our workspace +ln -sf $OPT_DIR $HOME/.local # link to our workspace + +### install and configure jhbuild ############################################## + +# remove configuration files from a previous installation +rm $HOME/.jhbuild* + +# install jhbuild +cd $WRK_DIR +export SRC_DIR # used as '$SOURCE' inside jhbuild +bash <(curl -s $URL_GTK_OSX_BUILD_SETUP) # run jhbuild setup script + +# configure jhbuild +JHBUILDRC=$HOME/.jhbuildrc-custom +echo "checkoutroot = '$SRC_DIR/checkout'" >> $JHBUILDRC +echo "prefix = '$OPT_DIR'" >> $JHBUILDRC +echo "tarballdir = '$SRC_DIR/download'" >> $JHBUILDRC +echo "quiet_mode = True" >> $JHBUILDRC # suppress output +echo "progress_bar = True" >> $JHBUILDRC +echo "moduleset = '$URL_GTK_OSX_MODULESET'" >> $JHBUILDRC # custom moduleset + diff --git a/packaging/macos/120-jhbuild-bootstrap.sh b/packaging/macos/120-jhbuild-bootstrap.sh new file mode 100755 index 000000000..199148c6b --- /dev/null +++ b/packaging/macos/120-jhbuild-bootstrap.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 120-jhbuild-bootstrap.sh ### +# Bootstrap the JHBuild environment. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +### bootstrap jhbuild environment ############################################## + +jhbuild bootstrap diff --git a/packaging/macos/120-jhbuild-python2.sh b/packaging/macos/120-jhbuild-python2.sh deleted file mode 100755 index aa91b0a7a..000000000 --- a/packaging/macos/120-jhbuild-python2.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 120-jhbuild-python2.sh ### -# Install a current complete release of Python 2 w/SSL. - -SELF_DIR=$(cd $(dirname "$0"); pwd -P) -for script in $SELF_DIR/0??-*.sh; do source $script; done - -### install OpenSSL ############################################################ - -# Build OpenSSL as dedicated step because we need to link our system -# configuration and certs (/etc/ssl) to it. Otherwise https downloads -# will fail with certification validation issues. - -jhbuild build openssl -mkdir -p $OPT_DIR/etc -ln -sf /etc/ssl $OPT_DIR/etc # link system config to our OpenSSL - -### install Python 2 ########################################################### - -# Some packages complain about non-exiting development headers when you rely -# solely on the macOS-provided Python installation. This also enables -# system-wide installations of packages without permission issues. - -jhbuild build python - -cd $SRC_DIR -curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py -jhbuild run python get-pip.py -jhbuild run pip install six # required for a package in meta-gtk-osx-bootstrap diff --git a/packaging/macos/130-jhbuild-gtk3.sh b/packaging/macos/130-jhbuild-gtk3.sh deleted file mode 100755 index 78b184955..000000000 --- a/packaging/macos/130-jhbuild-gtk3.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 130-jhbuild-gtk3.sh ### -# Install GTK3 libraries. - -SELF_DIR=$(cd $(dirname "$0"); pwd -P) -for script in $SELF_DIR/0??-*.sh; do source $script; done - -### install GTK3 libraries ##################################################### - -# meta-gtk-osx-freetype is included to fix a breakage in meta-gtk-osx-gtk3 -# due to missing headers. -# source: - -jhbuild build \ - meta-gtk-osx-bootstrap \ - meta-gtk-osx-freetype \ - meta-gtk-osx-gtk3 \ - meta-gtk-osx-gtkmm3 - diff --git a/packaging/macos/130-jhbuild-python.sh b/packaging/macos/130-jhbuild-python.sh new file mode 100755 index 000000000..b488633b6 --- /dev/null +++ b/packaging/macos/130-jhbuild-python.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 130-jhbuild-python.sh ### +# Install Python 2 and 3. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +### install OpenSSL ############################################################ + +# Build OpenSSL as dedicated step because we need to link our system +# configuration and certs (/etc/ssl) to it. Otherwise https downloads +# will fail with certification validation issues. + +jhbuild build openssl +mkdir -p $OPT_DIR/etc +ln -sf /etc/ssl $OPT_DIR/etc # link system config to our OpenSSL + +### install Python 2 ########################################################### + +# Some packages complain about non-exiting development headers when you rely +# solely on the macOS-provided Python installation. This also enables +# system-wide installations of packages without permission issues. + +jhbuild build python + +cd $SRC_DIR +curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +jhbuild run python get-pip.py +jhbuild run pip install six # required for a package in meta-gtk-osx-bootstrap + +### install Python 3 ########################################################### + +# Since enabling the Framework build ('--enable-framework'), 'install' fails +# on multi-threaded build ('$MAKEFLAGS') + +unset MAKEFLAGS # 'install' step would fail otherwise + +jhbuild build python3 + +# make library link paths relative +install_name_tool -change $OPT_DIR/Frameworks/Python.framework/Versions/3.6/Python @executable_path/../../../Versions/3.6/Python $OPT_DIR/Frameworks/Python.framework/Versions/3.6/bin/python3.6 +install_name_tool -change $OPT_DIR/Frameworks/Python.framework/Versions/3.6/Python @executable_path/../../../Versions/3.6/Python $OPT_DIR/Frameworks/Python.framework/Versions/3.6/bin/python3.6m +install_name_tool -change $OPT_DIR/Frameworks/Python.framework/Versions/3.6/Python @executable_path/../../../../Python $OPT_DIR/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python + +# replace hard-coded interpreter path in shebang with an environment lookup +PYTHON_BIN_DIR=$OPT_DIR/Frameworks/Python.framework/Versions/3.6/bin +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/2to3-3.6 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/easy_install-3.6 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/idle3.6 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/pip3 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/pip3.6 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/pydoc3.6 +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/python3.6m-config +sed -i "" "1s/.*/#!\/usr\/bin\/env python3.6/" $PYTHON_BIN_DIR/pyvenv-3.6 diff --git a/packaging/macos/140-jhbuild-gtk3.sh b/packaging/macos/140-jhbuild-gtk3.sh new file mode 100755 index 000000000..adb561ce0 --- /dev/null +++ b/packaging/macos/140-jhbuild-gtk3.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 140-jhbuild-gtk3.sh ### +# Install GTK3 libraries. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +### install GTK3 libraries ##################################################### + +# meta-gtk-osx-freetype is included to fix a breakage in meta-gtk-osx-gtk3 +# due to missing headers. +# source: + +jhbuild build \ + meta-gtk-osx-bootstrap \ + meta-gtk-osx-freetype \ + meta-gtk-osx-gtk3 \ + meta-gtk-osx-gtkmm3 + diff --git a/packaging/macos/140-jhbuild-inkdeps.sh b/packaging/macos/140-jhbuild-inkdeps.sh deleted file mode 100755 index a2bdd9871..000000000 --- a/packaging/macos/140-jhbuild-inkdeps.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 140-jhbuild-inkdeps.sh ### -# Install additional dependencies into our jhbuild environment required for -# building Inkscape. - -SELF_DIR=$(cd $(dirname "$0"); pwd -P) -for script in $SELF_DIR/0??-*.sh; do source $script; done - -### install GNU Scientific Library ############################################# - -get_source $URL_GSL -configure_make_makeinstall - -### install additional GNOME libraries ######################################### - -# libsoup - GNOME http client/server library -# adwaita-icon-theme - icons used by Inkscape/GTK - -jhbuild build adwaita-icon-theme libsoup - -### install Garbage Collector for C/C++ ######################################## - -get_source $URL_GC -configure_make_makeinstall - -### install GNOME Docking Library ############################################## - -get_source $URL_GDL -jhbuild run ./autogen.sh -configure_make_makeinstall - -### install boost ############################################################## - -get_source $URL_BOOST -jhbuild run ./bootstrap.sh --prefix=$OPT_DIR -jhbuild run ./b2 -j$CORES install - -### install OpenJPEG ########################################################### - -get_source $URL_OPENJPEG -cmake_make_makeinstall - -### install Poppler ############################################################ - -get_source $URL_POPPLER -cmake_make_makeinstall -DENABLE_UNSTABLE_API_ABI_HEADERS=ON - -### install gtk-mac-bundler #################################################### - -get_source $URL_GTK_MAC_BUNDLER -make install -cp $SRC_DIR/gtk-mac-bundler*/examples/gtk3-launcher.sh $SELF_DIR - -### install double-conversion ################################################## - -# Required by lib2geom. - -get_source $URL_DOUBLE_CONVERSION -cmake_make_makeinstall - diff --git a/packaging/macos/150-jhbuild-inkdeps.sh b/packaging/macos/150-jhbuild-inkdeps.sh new file mode 100755 index 000000000..8078a425a --- /dev/null +++ b/packaging/macos/150-jhbuild-inkdeps.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 150-jhbuild-inkdeps.sh ### +# Install additional dependencies into our jhbuild environment required for +# building Inkscape. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +### install GNU Scientific Library ############################################# + +get_source $URL_GSL +configure_make_makeinstall + +### install additional GNOME libraries ######################################### + +# libsoup - GNOME http client/server library +# adwaita-icon-theme - icons used by Inkscape/GTK + +jhbuild build adwaita-icon-theme libsoup + +### install Garbage Collector for C/C++ ######################################## + +get_source $URL_GC +configure_make_makeinstall + +### install GNOME Docking Library ############################################## + +get_source $URL_GDL +jhbuild run ./autogen.sh +configure_make_makeinstall + +### install boost ############################################################## + +get_source $URL_BOOST +jhbuild run ./bootstrap.sh --prefix=$OPT_DIR +jhbuild run ./b2 -j$CORES install + +### install OpenJPEG ########################################################### + +get_source $URL_OPENJPEG +cmake_make_makeinstall + +### install Poppler ############################################################ + +get_source $URL_POPPLER +cmake_make_makeinstall -DENABLE_UNSTABLE_API_ABI_HEADERS=ON + +### install gtk-mac-bundler #################################################### + +get_source $URL_GTK_MAC_BUNDLER +make install + +### install double-conversion ################################################## + +# Required by lib2geom. + +get_source $URL_DOUBLE_CONVERSION +cmake_make_makeinstall + diff --git a/packaging/macos/210-inkscape-build.sh b/packaging/macos/210-inkscape-build.sh new file mode 100755 index 000000000..a0ab93624 --- /dev/null +++ b/packaging/macos/210-inkscape-build.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 210-inkscape-build.sh ### +# Build Inscape. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### build Inkscape ############################################################# + +if [ -z $CI_JOB_ID ]; then # running standalone + cd $SRC_DIR + git clone --recurse-submodules --depth 10 $URL_INKSCAPE + #git clone --recurse-submodules $URL_INKSCAPE # this is a >1.6 GiB download + mkdir inkscape_build + cd inkscape_build + cmake -DCMAKE_PREFIX_PATH=$OPT_DIR -DCMAKE_INSTALL_PREFIX=$OPT_DIR -DWITH_OPENMP=OFF ../inkscape +else # running as CI job + if [ -d $SELF_DIR/../../build ]; then # cleanup previous run + rm -rf $SELF_DIR/../../build + fi + mkdir $SELF_DIR/../../build + cd $SELF_DIR/../../build + cmake -DCMAKE_PREFIX_PATH=$OPT_DIR -DCMAKE_INSTALL_PREFIX=$OPT_DIR -DWITH_OPENMP=OFF .. +fi + +make +make install + +# patch library locations before packaging +install_name_tool -change @rpath/libpoppler.85.dylib $LIB_DIR/libpoppler.85.dylib $BIN_DIR/inkscape +install_name_tool -change @rpath/libpoppler-glib.8.dylib $LIB_DIR/libpoppler-glib.8.dylib $BIN_DIR/inkscape + diff --git a/packaging/macos/210-inkscape.sh b/packaging/macos/210-inkscape.sh deleted file mode 100755 index 38a47c691..000000000 --- a/packaging/macos/210-inkscape.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later -# -# This file is part of the build pipeline for Inkscape on macOS. -# -# ### 210-inkscape.sh ### -# Build Inscape and create an application bundle. - -SELF_DIR=$(cd $(dirname "$0"); pwd -P) -for script in $SELF_DIR/0??-*.sh; do source $script; done - -### build Inkscape ############################################################# - -if [ -z $CI_JOB_ID ]; then # running standalone - cd $SRC_DIR - git clone --depth 1 $URL_INKSCAPE - #git clone $URL_INKSCAPE # this is a >1.6 GiB download - mkdir inkscape_build - cd inkscape_build - cmake -DCMAKE_PREFIX_PATH=$OPT_DIR -DCMAKE_INSTALL_PREFIX=$OPT_DIR -DWITH_OPENMP=OFF ../inkscape -else # running as CI job - if [ -d $SELF_DIR/../../build ]; then # cleanup previous run - rm -rf $SELF_DIR/../../build - fi - mkdir $SELF_DIR/../../build - cd $SELF_DIR/../../build - cmake -DCMAKE_PREFIX_PATH=$OPT_DIR -DCMAKE_INSTALL_PREFIX=$OPT_DIR -DWITH_OPENMP=OFF .. -fi - -make -make install - -# patch library locations before packaging -install_name_tool -change @rpath/libpoppler.85.dylib $LIB_DIR/libpoppler.85.dylib $BIN_DIR/inkscape -install_name_tool -change @rpath/libpoppler-glib.8.dylib $LIB_DIR/libpoppler-glib.8.dylib $BIN_DIR/inkscape - -### package Inkscape ########################################################### - -if [ ! -z $CI_JOB_ID ]; then # running as CI job - # $SELF_DIR is different between "standalone" and "CI job" - cp $SRC_DIR/gtk-mac-bundler*/examples/gtk3-launcher.sh $SELF_DIR -fi - -cd $SELF_DIR -jhbuild run gtk-mac-bundler inkscape.bundle - -# patch library locations -install_name_tool -change @rpath/libinkscape_base.dylib @executable_path/../Resources/lib/inkscape/libinkscape_base.dylib $APP_EXE_DIR/Inkscape-bin -install_name_tool -change @rpath/libpoppler.85.dylib @executable_path/../Resources/lib/libpoppler.85.dylib $APP_LIB_DIR/libpoppler-glib.8.dylib -install_name_tool -change @rpath/libpoppler.85.dylib @executable_path/../Resources/lib/libpoppler.85.dylib $APP_LIB_DIR/inkscape/libinkscape_base.dylib -install_name_tool -change @rpath/libpoppler-glib.8.dylib @executable_path/../Resources/lib/libpoppler-glib.8.dylib $APP_LIB_DIR/inkscape/libinkscape_base.dylib - -# add INKSCAPE_DATADIR to launch script -# TODO -# - instead of deleting and re-inserting, insert with "sed before" pattern -# - As follow-up to https://gitlab.com/inkscape/inkscape/merge_requests/612, -# it should not be necessary to rely on $INKSCAPE_DATADIR. Paths in -# 'path-prefix.h' are supposed to work. Needs to be looked into with @ede123. -sed -i '' -e '$d' $APP_EXE_DIR/Inkscape -sed -i '' -e '$d' $APP_EXE_DIR/Inkscape -echo 'export INKSCAPE_DATADIR=$bundle_data' >> $APP_EXE_DIR/Inkscape -echo '$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS' >> $APP_EXE_DIR/Inkscape - -# add icon -curl -L -o $APP_RES_DIR/inkscape.icns $URL_INKSCAPE_ICNS - -set -e # TODO kind of cheap, need better error handling - -if [ -z $CI_JOB_ID ]; then # running standalone - # update version information - /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString '1.0alpha-g$(get_repo_version $SRC_DIR/inkscape)'" $APP_PLIST - /usr/libexec/PlistBuddy -c "Set CFBundleVersion '1.0alpha-g$(get_repo_version $SRC_DIR/inkscape)'" $APP_PLIST -else # running as CI job - # update version information - /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString '1.0alpha-g$(get_repo_version $SELF_DIR)'" $APP_PLIST - /usr/libexec/PlistBuddy -c "Set CFBundleVersion '1.0alpha-g$(get_repo_version $SELF_DIR)'" $APP_PLIST -fi - -### create disk image for distribution ######################################### - -# TODO - -if [ ! -z $CI_JOB_ID ]; then # create build artifcat for CI job - cd $WRK_DIR - tar c $(basename $APP_DIR) | xz > $SELF_DIR/../../build/Inkscape.tar.xz -fi diff --git a/packaging/macos/220-inkscape-package.sh b/packaging/macos/220-inkscape-package.sh new file mode 100755 index 000000000..ceff8e04d --- /dev/null +++ b/packaging/macos/220-inkscape-package.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 220-inkscape-package.sh ### +# Create Inkscape application bundle. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### package Inkscape ########################################################### + +mkdir -p $ARTIFACT_DIR +export ARTIFACT_DIR # referenced in 'inkscape.bundle' + +cp $SRC_DIR/gtk-mac-bundler*/examples/gtk3-launcher.sh $SELF_DIR +cd $SELF_DIR +jhbuild run gtk-mac-bundler inkscape.bundle + +# patch library locations +install_name_tool -change @rpath/libinkscape_base.dylib @executable_path/../Resources/lib/inkscape/libinkscape_base.dylib $APP_EXE_DIR/Inkscape-bin +install_name_tool -change @rpath/libpoppler.85.dylib @executable_path/../Resources/lib/libpoppler.85.dylib $APP_LIB_DIR/libpoppler-glib.8.dylib +install_name_tool -change @rpath/libpoppler.85.dylib @executable_path/../Resources/lib/libpoppler.85.dylib $APP_LIB_DIR/inkscape/libinkscape_base.dylib +install_name_tool -change @rpath/libpoppler-glib.8.dylib @executable_path/../Resources/lib/libpoppler-glib.8.dylib $APP_LIB_DIR/inkscape/libinkscape_base.dylib + +install_name_tool -change @executable_path/../Resources/lib/libcrypto.1.1.dylib @loader_path/libcrypto.1.1.dylib $APP_LIB_DIR/libssl.1.1.dylib + + +# patch the launch script +# TODO: as follow-up to https://gitlab.com/inkscape/inkscape/merge_requests/612, +# it should not be necessary to rely on $INKSCAPE_DATADIR. Paths in +# 'path-prefix.h' are supposed to work. Needs to be looked into with @ede123. + +insert_before $APP_EXE_DIR/Inkscape '\$EXEC' 'export INKSCAPE_DATADIR=$bundle_data' +insert_before $APP_EXE_DIR/Inkscape '\$EXEC' 'export INKSCAPE_LOCALEDIR=$bundle_data/locale' + +# add XDG paths to use native locations on macOS +insert_before $APP_EXE_DIR/Inkscape 'export XDG_CONFIG_DIRS' '\ +export XDG_DATA_HOME=\"$HOME/Library/Application Support/Inkscape/data\"\ +export XDG_CONFIG_HOME=\"$HOME/Library/Application Support/Inkscape/config\"\ +export XDG_CACHE_HOME=\"$HOME/Library/Application Support/Inkscape/cache\"\ +mkdir -p $XDG_DATA_HOME\ +mkdir -p $XDG_CONFIG_HOME\ +mkdir -p $XDG_CACHE_HOME\ +' + +# add icon +# TODO: create from Inkscape assets on-the-fly +curl -L -o $APP_RES_DIR/inkscape.icns $URL_INKSCAPE_ICNS + +if [ -z $CI_JOB_ID ]; then # running standalone + # update version information + /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString '1.0alpha-g$(get_repo_version $SRC_DIR/inkscape)'" $APP_PLIST + /usr/libexec/PlistBuddy -c "Set CFBundleVersion '1.0alpha-g$(get_repo_version $SRC_DIR/inkscape)'" $APP_PLIST +else # running as CI job + # update version information + /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString '1.0alpha-g$(get_repo_version $SELF_DIR)'" $APP_PLIST + /usr/libexec/PlistBuddy -c "Set CFBundleVersion '1.0alpha-g$(get_repo_version $SELF_DIR)'" $APP_PLIST +fi + +### copy Python.framework ###################################################### + +# This section deals with bundling Python.framework into the application +# and making it portable. + +# Link Python executable version-less for the extensions to find it. +# This will shadow the system's Python interpreter for Inkscape. +mkdir -p $APP_BIN_DIR +cd $APP_BIN_DIR +ln -s ../../Frameworks/Python.framework/Versions/3.6/bin/python3.6 python +# add '$APP_BIN_DIR' to paths +insert_before $APP_EXE_DIR/Inkscape '\$EXEC' 'export PATH=$bundle_bin:$PATH' + +# Copy Python framework to app bundle +rsync -a $OPT_DIR/Frameworks $APP_CON_DIR + +P36_DIR=$APP_CON_DIR/Frameworks/Python.framework/Versions/3.6 + +# patch various binaries and libraries to use relative library locations +# main library +chmod 644 $APP_CON_DIR/Frameworks/Python.framework/Versions/3.6/Python +install_name_tool -change $LIB_DIR/libintl.9.dylib @loader_path/../../../../Resources/lib/libintl.9.dylib $P36_DIR/Python +# Python.app inside the framework +install_name_tool -change $LIB_DIR/libintl.9.dylib @executable_path/../../../../../../../../Resources/lib/libintl.9.dylib $APP_CON_DIR/Frameworks/Python.framework/Resources/Python.app/Contents/MacOS/Python +# dynamic loader for SSL libraries +install_name_tool -change $LIB_DIR/libssl.1.1.dylib @loader_path/../../../../../../../Resources/lib/libssl.1.1.dylib $P36_DIR/lib/python3.6/lib-dynload/_ssl*.so +install_name_tool -change $LIB_DIR/libcrypto.1.1.dylib @loader_path/../../../../../../../Resources/lib/libcrypto.1.1.dylib $P36_DIR/lib/python3.6/lib-dynload/_ssl*.so + +### install Python packages #################################################### + +# Install Python packages required by default Inkscape extensions. + +export PATH=$P36_DIR/bin:$PATH # use Python interpreter from inside the app + +$P36_DIR/bin/pip3 install lxml +$P36_DIR/bin/pip3 install numpy + diff --git a/packaging/macos/230-inkscape-distrib.sh b/packaging/macos/230-inkscape-distrib.sh new file mode 100755 index 000000000..f1388afec --- /dev/null +++ b/packaging/macos/230-inkscape-distrib.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### 230-inkscape-distrib.sh ### +# Get application ready for distribution. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### create disk image for distribution ######################################### + +# TODO: *.dmg, signing, notarization, ... + +if [ ! -z $CI_JOB_ID ]; then # create build artifcat for CI job + cd $WRK_DIR + mv $ARTIFACT_DIR $SELF_DIR/../../build +fi diff --git a/packaging/macos/README.md b/packaging/macos/README.md index 4d2bf133d..866e88d79 100644 --- a/packaging/macos/README.md +++ b/packaging/macos/README.md @@ -4,26 +4,27 @@ This folder contains the scripts that make up the build pipeline for Inkscape on ## Requirements +_It would've been more fair if this section was called "recommandations" instead, but that would only encourage carelessness._ + - Use a __dedicated, clean macOS installation__ as build machine. "clean" as in "freshly installed + Xcode CLI tools". Nothing more, nothing less. - Especially no MacPorts, no Fink, no Homebrew, ... because they could interfere with the build system we're using. - macOS 10.13.6 with Xcode 10.1. - - Other versions might work but haven't been tested. + - These scripts are being developed and used using said versions. + - Newer versions might work but haven't been tested. - A full Xcode installation won't hurt, but is not required. - - __Use a dedicated user account__ unless you're prepared that these scripts will delete and overwrite your data in the following locations: _(comments based on default configuration)_ ```bash - $HOME/.cache # will be symlinked to $HOME/work/tmp - $HOME/.local # will be symlinked to $HOME/work/opt + $HOME/.cache # will be symlinked to $WRK_DIR/tmp + $HOME/.local # will be symlinked to $WRK_DIR/opt $HOME/.profile # will be overwritten - $HOME/Source # will be symlinked to $HOME/work/opt/src ``` - __16 GiB RAM__, since we're using a 10 GiB ramdisk to build everything. - Using a ramdisk speeds up the process significantly and avoids wearing out your ssd. - - You can choose to not use a ramdisk by overriding `RAMDISK_ENABLE=false` in a e.g. `011-custom.sh` file. - - The build environment takes up ~6.5 GiB of disk space, the Inkscape Git repository ~1.8 GiB. Subject to change and YMMV. + - You can choose to not use a ramdisk by overriding `RAMDISK_ENABLE=false` in a e.g. `021-custom.sh` file. + - The build environment takes up ~6.1 GiB of disk space, the Inkscape Git repository ~1.6 GiB. Subject to change and YMMV. - somewhat decent __internet connection__ for all the downloads ## Usage @@ -42,16 +43,6 @@ This will run all the `nnn-*.sh` scripts consecutively. ### GitLab CI -#### manual task: setup build environment - -For now, the CI pipeline is designed to be run on a persistent machine since it does not setup the required build environment itself. This is a manual task you have to perform beforehand by running - -```bash -./create_buildenv.sh -```` - -This will setup the build environment in `$HOME/work` as a ramdisk. - #### configuration example `.gitlab-runner/config.toml` ```toml @@ -68,10 +59,12 @@ This will setup the build environment in `$HOME/work` as a ramdisk. ```yaml buildmacos: + before_script: + - packaging/macos/build_toolset.sh script: - - packaging/macos/210-inkscape.sh + - packaging/macos/build_inkscape.sh ``` ## Status -This is still a work in progress and actively being worked on. Use at your own risk. +This is still a work in progress and actively being worked on. diff --git a/packaging/macos/build_all.sh b/packaging/macos/build_all.sh new file mode 100755 index 000000000..5ccf4ebc6 --- /dev/null +++ b/packaging/macos/build_all.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### build_all.sh ### +# "from nothing to Inkscape.app" + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### main ####################################################################### + +$SELF_DIR/build_toolset.sh +$SELF_DIR/build_inkscape.sh + diff --git a/packaging/macos/build_inkscape.sh b/packaging/macos/build_inkscape.sh new file mode 100755 index 000000000..65f430271 --- /dev/null +++ b/packaging/macos/build_inkscape.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### build_inkscape.sh ### +# Compile and package Inkscape. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### run scripts to compile and build Inkscape ################################## + +for script in $SELF_DIR/2??-*.sh; do + $script +done diff --git a/packaging/macos/build_toolset.sh b/packaging/macos/build_toolset.sh new file mode 100755 index 000000000..b4acededd --- /dev/null +++ b/packaging/macos/build_toolset.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This file is part of the build pipeline for Inkscape on macOS. +# +# ### build_toolset.sh ### +# Create JHBuild toolset with all dependencies for Inkscape. + +### load settings and functions ################################################ + +SELF_DIR=$(cd $(dirname "$0"); pwd -P) +for script in $SELF_DIR/0??-*.sh; do source $script; done + +set -e + +### download pre-built build environment or build from scratch ################# + +if [ -d $OPT_DIR ]; then + echo "$SELF_NAME: $OPT_DIR exists - not doing anything" +else + if $TOOLSET_CACHE_ENABLE && + [ "$WRK_DIR" = "$DEFAULT_SYSTEM_WRK_DIR" ]; then # we're good to download + $SELF_DIR/110-jhbuild-install.sh + get_source $URL_TOOLSET_CACHE $WRK_DIR + else # we need to build from scratch + for script in $SELF_DIR/1??-*.sh; do + $script + done + fi +fi diff --git a/packaging/macos/create_buildenv.sh b/packaging/macos/create_buildenv.sh deleted file mode 100755 index 5e9ac9db6..000000000 --- a/packaging/macos/create_buildenv.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -# create_buildenv.sh -# https://github.com/dehesselle/mibap -# -# create jhbuild environment for Inkscape - -for script in 1??-*.sh; do - ./$script -done - diff --git a/packaging/macos/inkscape.bundle b/packaging/macos/inkscape.bundle index 147e8a778..59d6deecd 100644 --- a/packaging/macos/inkscape.bundle +++ b/packaging/macos/inkscape.bundle @@ -18,7 +18,7 @@ app. If you leave out the path, the current directory is used. Note the usage of an environment variable here again. --> - ${env:HOME}/work + ${env:ARTIFACT_DIR} @@ -77,7 +77,9 @@ ${prefix}/lib/inkscape/libinkscape_base.dylib - + + ${prefix}/lib/libssl.1.1.dylib +