diff --git a/packaging/macos/010-init.sh b/packaging/macos/010-init.sh index 728288d77379ae869f41c6aeafcf8fc2a64787dd..a5de35c1605174ae177e87b1f0174d59eb78677b 100644 --- a/packaging/macos/010-init.sh +++ b/packaging/macos/010-init.sh @@ -34,7 +34,7 @@ bash_d_include sed #--------------------------------------------------------------- toolset version -VERSION=0.54 +VERSION=0.55 #-------------------------------------------------------------- target OS by SDK diff --git a/packaging/macos/210-inkscape_build.sh b/packaging/macos/210-inkscape_build.sh index 81080a46302b7468e07b547eeed75889f8fc72c9..16d5d0d81d809db282b03ea3896893806ce30c8a 100755 --- a/packaging/macos/210-inkscape_build.sh +++ b/packaging/macos/210-inkscape_build.sh @@ -50,13 +50,8 @@ jhbuild_configure if ! $CI_GITLAB; then # not running GitLab CI - if [ -d "$INK_DIR"/.git ]; then # Already cloned? - # Special treatment 1/2 for local builds: Leave it up to the - # user if they need a fresh clone. This way we enable making changes - # to the code and running the build again. - echo_w "using existing repository in $INK_DIR" - echo_w "Do 'rm -rf $INK_DIR' if you want a fresh clone." - sleep 5 + if [ -d "$INK_DIR" ]; then # Sourcecode directory already there? + echo_i "using existing source $INK_DIR" else git clone \ --branch "$INK_BRANCH" \ @@ -66,9 +61,9 @@ if ! $CI_GITLAB; then # not running GitLab CI "$INK_URL" "$INK_DIR" fi - if ! $CI && [ -d "$INK_BLD_DIR" ]; then # Running locally and build exists? - # Special treatment 2/2 for local builds: remove the build directory - # to ensure clean builds. + # Remove files from a previous build if they exist. This is to ensure clean + # builds when running locally or on non-ephemeral runners. + if [ -d "$INK_BLD_DIR" ]; then rm -rf "$INK_BLD_DIR" fi fi @@ -92,7 +87,7 @@ ninja tests # Most libraries are linked to with their fully qualified paths, a few have been # linked to using '@rpath'. The Inkscape binary only provides an LC_RPATH -# setting for its own library path (LIB_DIR/inkscape) at this point, so we need -# to add LIB_DIR to make it work. +# setting for its custom library path 'lib/inkscape' at this point, so we need +# to add the common library path 'lib'. -lib_add_rpath @loader_path/../lib $BIN_DIR/inkscape +lib_add_rpath @loader_path/../lib "$BIN_DIR"/inkscape diff --git a/packaging/macos/220-inkscape_package.sh b/packaging/macos/220-inkscape_package.sh index 41bdcef4ef23239202cd7c0921870e7e473b72be..6876ca7d46bf7f2f84b51ae23a13d770b5b9b7b6 100755 --- a/packaging/macos/220-inkscape_package.sh +++ b/packaging/macos/220-inkscape_package.sh @@ -105,8 +105,9 @@ fi #----------------------------------------------------- generate application icon -svg2icns "$INK_DIR"/share/branding/inkscape-mac.svg \ - "$INK_APP_RES_DIR"/inkscape.icns +svg2icns \ + "$INK_DIR"/share/branding/inkscape-mac.svg \ + "$INK_APP_RES_DIR"/inkscape.icns #----------------------------------------------------------- add file type icons @@ -125,22 +126,37 @@ lib_add_rpath @executable_path/../../../../../../../../Resources/lib \ "$INK_APP_FRA_DIR"/Python.framework/Versions/Current/Resources/\ Python.app/Contents/MacOS/Python -# Exteract the externally built wheels (if present). -if [ -f "$INK_WHEELS_DIR"/wheels.tar.xz ]; then - tar -C "$TMP_DIR" -xf "$INK_WHEELS_DIR"/wheels.tar.xz - INK_WHEELS_DIR=$TMP_DIR +# Exteract the externally built wheels if present. Wheels in TMP_DIR +# will take precedence over the ones in PKG_DIR. +if [ -f "$PKG_DIR"/wheels.tar.xz ]; then + tar -C "$TMP_DIR" -xf "$PKG_DIR"/wheels.tar.xz else echo_w "not using externally built wheels" fi # Install wheels. +ink_pipinstall_appdirs # extension manager +ink_pipinstall_beautifulsoup4 # extension manager +ink_pipinstall_cachecontrol # extension manager ink_pipinstall_cssselect +ink_pipinstall_gtkme # extension manager ink_pipinstall_lxml ink_pipinstall_numpy ink_pipinstall_pygobject ink_pipinstall_pyserial ink_pipinstall_scour -ink_pipinstall_urllib3 + +#---------------------------------------------------------- generate Python icon + +curl \ + -o "$TMP_DIR/$(basename "$INK_PYTHON_ICON_URL")" \ + -L "$INK_PYTHON_ICON_URL" + +svg2icns \ + "$TMP_DIR/$(basename "$INK_PYTHON_ICON_URL")" \ + "$INK_APP_FRA_DIR/Python.framework/Resources/Python.app/Contents/\ +Resources/PythonInterpreter.icns" \ + 8 #----------------------------------------------------- remove Python cache files diff --git a/packaging/macos/packages/ink.sh b/packaging/macos/packages/ink.sh index 49b63b405075d9c6f2cde70c85621cfb975a79a2..1fbf98acc95ec7673ad64726cd0450e1605886be 100644 --- a/packaging/macos/packages/ink.sh +++ b/packaging/macos/packages/ink.sh @@ -9,6 +9,7 @@ ### shellcheck ################################################################# # shellcheck shell=bash # no shebang as this file is intended to be sourced +# shellcheck disable=SC2034 # multipe vars only used outside this script ### dependencies ############################################################### @@ -18,15 +19,24 @@ #----------------------------------------------- source directory and git branch -# If we're running inside Inkscape's official CI, the repository is already -# there and we adjust INK_DIR accordingly. -# If not, check if a custom repository location and/or branch has been -# specified in the environment. +# There are 3 possible scenarios: +# +# 1. We're running inside GitLab CI: +# The repository has already been cloned, set INK_DIR accordingly. +# +# 2. We're not running inside GitLab CI and INK_DIR has been set: +# Use INK_DIR provided as-is, we expect the source to be there. +# +# 3. We're not running inside GitLab CI and INK_DIR has not been set: +# Set INK_DIR to our default location, we'll clone the repo there. if $CI_GITLAB; then # running GitLab CI INK_DIR=$SELF_DIR/../.. else # not running GitLab CI - INK_DIR=$SRC_DIR/inkscape + # Use default directory if not provided. + if [ -z "$INK_DIR" ]; then + INK_DIR=$SRC_DIR/inkscape + fi # Allow using a custom Inkscape repository and branch. if [ -z "$INK_URL" ]; then @@ -52,38 +62,69 @@ INK_PYTHON_VER_MINOR=8 INK_PYTHON_VER=$INK_PYTHON_VER_MAJOR.$INK_PYTHON_VER_MINOR INK_PYTHON_URL="https://gitlab.com/api/v4/projects/26780227/packages/generic/\ python_macos/1/python_${INK_PYTHON_VER/./}_$(uname -p)_inkscape.tar.xz" - -INK_WHEELS_DIR=$PKG_DIR +INK_PYTHON_ICON_URL="https://gitlab.com/inkscape/vectors/content/-/raw/\ +5f4f4cdf/branding/projects/extensions_c1.svg" #----------------------------------- Python packages to be bundled with Inkscape +# https://pypi.org/project/appdirs/ +INK_PYTHON_PKG_APPDIRS=appdirs==1.4.4 + +# https://pypi.org/project/beautifulsoup4/ +# https://pypi.org/project/soupsieve/ +INK_PYTHON_PKG_BEAUTIFULSOUP4="\ + beautifulsoup4==4.10.0\ + soupsieve==2.2.1\ +" + +# https://pypi.org/project/CacheControl/ +# https://pypi.org/project/certifi/ +# https://pypi.org/project/charset-normalizer/ +# https://pypi.org/project/idna/ +# https://pypi.org/project/lockfile/ +# https://pypi.org/project/msgpack/ +# https://pypi.org/project/requests/ +# https://pypi.org/project/urllib3/ +INK_PYTHON_PKG_CACHECONTROL="\ + CacheControl==0.12.6\ + certifi==2021.10.8\ + charset_normalizer==2.0.7\ + idna==3.3\ + lockfile==0.12.2\ + msgpack==1.0.2\ + requests==2.26.0\ + urllib3==1.26.7\ +" + # https://pypi.org/project/cssselect/ -INK_PYTHON_CSSSELECT=cssselect==1.1.0 +INK_PYTHON_PKG_CSSSELECT=cssselect==1.1.0 + +# https://pypi.org/project/gtkme/ +INK_PYTHON_PKG_GTKME=gtkme==1.5.3 # https://pypi.org/project/lxml/ -INK_PYTHON_LXML=lxml==4.6.3 +INK_PYTHON_PKG_LXML=lxml==4.6.3 # https://pypi.org/project/numpy/ -INK_PYTHON_NUMPY=numpy==1.20.3 +INK_PYTHON_PKG_NUMPY=numpy==1.21.2 +# https://pypi.org/project/pycairo/ # https://pypi.org/project/PyGObject/ -INK_PYTHON_PYGOBJECT="\ - PyGObject==3.40.1\ - pycairo==1.20.0\ +INK_PYTHON_PKG_PYGOBJECT="\ + PyGObject==3.42.0\ + pycairo==1.20.1\ " # https://pypi.org/project/pyserial/ -INK_PYTHON_PYSERIAL=pyserial==3.5 +INK_PYTHON_PKG_PYSERIAL=pyserial==3.5 # https://pypi.org/project/scour/ -INK_PYTHON_SCOUR="\ +# https://pypi.org/project/six/ +INK_PYTHON_PKG_SCOUR="\ scour==0.38.2\ six==1.16.0\ " -# https://pypi.org/project/urllib3 -INK_PYTHON_URLLIB3=urllib3==1.26.5 - #------------------------------------------- application bundle directory layout INK_APP_DIR=$ARTIFACT_DIR/Inkscape.app @@ -95,8 +136,7 @@ INK_APP_BIN_DIR=$INK_APP_RES_DIR/bin INK_APP_ETC_DIR=$INK_APP_RES_DIR/etc INK_APP_EXE_DIR=$INK_APP_CON_DIR/MacOS INK_APP_LIB_DIR=$INK_APP_RES_DIR/lib - -INK_APP_SITEPKG_DIR=$INK_APP_LIB_DIR/python$INK_PYTHON_VER/site-packages +INK_APP_SPK_DIR=$INK_APP_LIB_DIR/python$INK_PYTHON_VER/site-packages ### functions ################################################################## @@ -104,19 +144,22 @@ function ink_get_version { local file=$INK_DIR/CMakeLists.txt local ver_major - ver_major=$(grep INKSCAPE_VERSION_MAJOR "$file" | head -n 1 | awk '{ print $2+0 }') + ver_major=$(grep INKSCAPE_VERSION_MAJOR "$file" | head -n 1 | + awk '{ print $2+0 }') local ver_minor - ver_minor=$(grep INKSCAPE_VERSION_MINOR "$file" | head -n 1 | awk '{ print $2+0 }') + ver_minor=$(grep INKSCAPE_VERSION_MINOR "$file" | head -n 1 | + awk '{ print $2+0 }') local ver_patch - ver_patch=$(grep INKSCAPE_VERSION_PATCH "$file" | head -n 1 | awk '{ print $2+0 }') + ver_patch=$(grep INKSCAPE_VERSION_PATCH "$file" | head -n 1 | + awk '{ print $2+0 }') local ver_suffix - ver_suffix=$(grep INKSCAPE_VERSION_SUFFIX "$file" | head -n 1 | awk '{ print $2 }') + ver_suffix=$(grep INKSCAPE_VERSION_SUFFIX "$file" | head -n 1 | + awk '{ print $2 }') - ver_suffix=${ver_suffix%\"*} # remove "double quote and everything after" from end + ver_suffix=${ver_suffix%\"*} # remove "double quotes and all" from end ver_suffix=${ver_suffix#\"} # remove "double quote" from beginning - # shellcheck disable=SC2086 # they are integers - echo $ver_major.$ver_minor.$ver_patch"$ver_suffix" + echo "$ver_major.$ver_minor.$ver_patch$ver_suffix" } function ink_get_repo_shorthash @@ -127,13 +170,26 @@ function ink_get_repo_shorthash function ink_pipinstall { - local packages=$1 + local packages=$1 # list of packages or function name ink_pipinstall_* local options=$2 # optional + # resolve function name into list of packages + if [[ $packages = ${FUNCNAME[0]}* ]]; then + packages=$(tr "[:lower:]" "[:upper:]" <<< "${packages/${FUNCNAME[0]}_/}") + packages=$(eval echo \$INK_PYTHON_PKG_"$packages") + fi + # turn package names into filenames of our wheels local wheels for package in $packages; do - wheels="$wheels $(eval echo "$INK_WHEELS_DIR"/"${package%==*}"*.whl)" + package=$(eval echo "${package%==*}"*.whl) + # If present in TMP_DIR, use that. This is how the externally built + # packages can be fed into this. + if [ -f "$TMP_DIR/$package" ]; then + wheels="$wheels $TMP_DIR/$package" + else + wheels="$wheels $PKG_DIR/$package" + fi done local PATH_ORIGINAL=$PATH @@ -149,25 +205,45 @@ function ink_pipinstall export PATH=$PATH_ORIGINAL } +function ink_pipinstall_appdirs +{ + ink_pipinstall "${FUNCNAME[0]}" +} + +function ink_pipinstall_beautifulsoup4 +{ + ink_pipinstall "${FUNCNAME[0]}" +} + +function ink_pipinstall_cachecontrol +{ + ink_pipinstall "${FUNCNAME[0]}" +} + function ink_pipinstall_cssselect { - ink_pipinstall "$INK_PYTHON_CSSSELECT" + ink_pipinstall "${FUNCNAME[0]}" +} + +function ink_pipinstall_gtkme +{ + ink_pipinstall "${FUNCNAME[0]}" } function ink_pipinstall_lxml { - ink_pipinstall "$INK_PYTHON_LXML" + ink_pipinstall "${FUNCNAME[0]}" lib_change_paths \ @loader_path/../../.. \ "$INK_APP_LIB_DIR" \ - "$INK_APP_SITEPKG_DIR"/lxml/etree.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ - "$INK_APP_SITEPKG_DIR"/lxml/objectify.cpython-"${INK_PYTHON_VER/./}"-darwin.so + "$INK_APP_SPK_DIR"/lxml/etree.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ + "$INK_APP_SPK_DIR"/lxml/objectify.cpython-"${INK_PYTHON_VER/./}"-darwin.so } function ink_pipinstall_numpy { - ink_pipinstall "$INK_PYTHON_NUMPY" + ink_pipinstall "${FUNCNAME[0]}" sed -i '' '1s/.*/#!\/usr\/bin\/env python'"$INK_PYTHON_VER_MAJOR"'/' \ "$INK_APP_BIN_DIR"/f2py @@ -179,37 +255,33 @@ function ink_pipinstall_numpy function ink_pipinstall_pygobject { - ink_pipinstall "$INK_PYTHON_PYGOBJECT" + ink_pipinstall "${FUNCNAME[0]}" lib_change_paths \ @loader_path/../../.. \ "$INK_APP_LIB_DIR" \ - "$INK_APP_SITEPKG_DIR"/gi/_gi.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ - "$INK_APP_SITEPKG_DIR"/gi/_gi_cairo.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ - "$INK_APP_SITEPKG_DIR"/cairo/_cairo.cpython-"${INK_PYTHON_VER/./}"-darwin.so + "$INK_APP_SPK_DIR"/gi/_gi.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ + "$INK_APP_SPK_DIR"/gi/_gi_cairo.cpython-"${INK_PYTHON_VER/./}"-darwin.so \ + "$INK_APP_SPK_DIR"/cairo/_cairo.cpython-"${INK_PYTHON_VER/./}"-darwin.so } function ink_pipinstall_pyserial { - ink_pipinstall "$INK_PYTHON_PYSERIAL" + ink_pipinstall "${FUNCNAME[0]}" - find "$INK_APP_SITEPKG_DIR"/serial -type f -name "*.pyc" -exec rm {} \; - sed -i '' '1s/.*/#!\/usr\/bin\/env python3/' "$INK_APP_BIN_DIR"/pyserial-miniterm + find "$INK_APP_SPK_DIR"/serial -type f -name "*.pyc" -exec rm {} \; + sed -i '' '1s/.*/#!\/usr\/bin\/env python3/' \ + "$INK_APP_BIN_DIR"/pyserial-miniterm sed -i '' '1s/.*/#!\/usr\/bin\/env python3/' "$INK_APP_BIN_DIR"/pyserial-ports } function ink_pipinstall_scour { - ink_pipinstall "$INK_PYTHON_SCOUR" + ink_pipinstall "${FUNCNAME[0]}" sed -i '' '1s/.*/#!\/usr\/bin\/env python3/' "$INK_APP_BIN_DIR"/scour } -function ink_pipinstall_urllib3 -{ - ink_pipinstall "$INK_PYTHON_URLLIB3" -} - function ink_download_python { curl -o "$PKG_DIR"/"$(basename "${INK_PYTHON_URL%\?*}")" -L "$INK_PYTHON_URL" @@ -233,17 +305,13 @@ python$INK_PYTHON_VER_MAJOR "$INK_APP_BIN_DIR" python$INK_PYTHON_VER/site-packages/inkscape.pth } -# shellcheck disable=SC2086 # we need word splitting here function ink_build_wheels { jhbuild run pip3 install wheel - jhbuild run pip3 wheel $INK_PYTHON_CSSSELECT -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel --no-binary :all: $INK_PYTHON_LXML -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel $INK_PYTHON_NUMPY -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel $INK_PYTHON_PYGOBJECT -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel $INK_PYTHON_PYSERIAL -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel $INK_PYTHON_SCOUR -w "$INK_WHEELS_DIR" - jhbuild run pip3 wheel $INK_PYTHON_URLLIB3 -w "$INK_WHEELS_DIR" + for pkg in ${!INK_PYTHON_PKG_*}; do + # shellcheck disable=SC2046 # we need word splitting here + jhbuild run pip3 wheel --no-binary :all: $(eval echo \$"$pkg") -w "$PKG_DIR" + done } ### main ####################################################################### diff --git a/packaging/macos/packages/jhbuild.sh b/packaging/macos/packages/jhbuild.sh index ad93966e6ae76b5b437fff9daa3f64dc7f0b3ab8..d287f3014bc0933673c6d91e5431e7a69a099939 100644 --- a/packaging/macos/packages/jhbuild.sh +++ b/packaging/macos/packages/jhbuild.sh @@ -20,10 +20,10 @@ export JHBUILDRC=$ETC_DIR/jhbuildrc export JHBUILDRC_CUSTOM=$JHBUILDRC-custom JHBUILD_REQUIREMENTS="\ - certifi==2021.5.30\ - meson==0.57.1\ - ninja==1.10.0.post2\ - pygments==2.8.1\ + certifi==2021.10.8\ + meson==0.59.2\ + ninja==1.10.2.2\ + pygments==2.10.0\ " # JHBuild build system 3.38.0+ (a896cbf404461cab979fa3cd1c83ddf158efe83b) diff --git a/packaging/macos/packages/svg2icns.sh b/packaging/macos/packages/svg2icns.sh index 6a680ea5c30cbdb2a851b0fffaedc5e6b0f9083b..a9c72322b8fd96714373e2fabedc17ac16d5d265 100644 --- a/packaging/macos/packages/svg2icns.sh +++ b/packaging/macos/packages/svg2icns.sh @@ -31,12 +31,17 @@ function svg2icns { local svg_file=$1 local icns_file=$2 + local scale=$3 # optional + + if [ -z "$scale" ]; then + scale=1 + fi local png_file png_file=$TMP_DIR/$(basename -s .svg "$svg_file").png # svg to png - jhbuild run cairosvg -f png -s 1 -o "$png_file" "$svg_file" + jhbuild run cairosvg -f png -s $scale -o "$png_file" "$svg_file" # png to icns cd "$TMP_DIR" || exit 1 # png2icns.sh outputs to current directory diff --git a/packaging/macos/resources/image-vnd.sk1.icns b/packaging/macos/resources/image-vnd.sk1.icns deleted file mode 100644 index 887cd1a8f7243d95a650bd1b5673acc048a3ea6f..0000000000000000000000000000000000000000 Binary files a/packaging/macos/resources/image-vnd.sk1.icns and /dev/null differ