summaryrefslogtreecommitdiffstats
path: root/packaging/macos
diff options
context:
space:
mode:
authorRené de Hesselle <dehesselle@web.de>2019-08-11 17:04:07 +0000
committerRené de Hesselle <dehesselle@web.de>2019-08-12 18:52:55 +0000
commitcb40c66693d0023b15bfcea9e6ac113a566ae6a0 (patch)
tree34db0a70d586b1641258c247fdee0b47b9b0cfc7 /packaging/macos
parentFix quoting (again) (diff)
downloadinkscape-cb40c66693d0023b15bfcea9e6ac113a566ae6a0.tar.gz
inkscape-cb40c66693d0023b15bfcea9e6ac113a566ae6a0.zip
Update macOS build pipeline
Use dmgbuild (Python package) instead of create-dmg. This speeds up the process and also is lot less error-prone. Run gtk-mac-bundler and dmgbuild through Terminal.app. This is an attempt to fix the instability when running non-interactively in CI. Update a few Python packages to their newest versions.
Diffstat (limited to 'packaging/macos')
-rw-r--r--packaging/macos/020-vars.sh12
-rw-r--r--packaging/macos/030-funcs.sh54
-rwxr-xr-xpackaging/macos/160-jhbuild-other.sh19
-rwxr-xr-xpackaging/macos/220-inkscape-package.sh31
-rwxr-xr-xpackaging/macos/230-inkscape-distrib.sh28
-rw-r--r--packaging/macos/inkscape_dmg.py246
6 files changed, 356 insertions, 34 deletions
diff --git a/packaging/macos/020-vars.sh b/packaging/macos/020-vars.sh
index eeae31afb..b59532303 100644
--- a/packaging/macos/020-vars.sh
+++ b/packaging/macos/020-vars.sh
@@ -165,7 +165,6 @@ APP_PLIST=$APP_CON_DIR/Info.plist
URL_BOOST=https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2
URL_CPPUNIT=https://dev-www.libreoffice.org/src/cppunit-1.14.0.tar.gz
-URL_CREATEDMG=https://github.com/andreyvit/create-dmg/archive/v1.0.0.5.tar.gz
URL_DOUBLE_CONVERSION=https://github.com/google/double-conversion/archive/v3.1.4.tar.gz
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
@@ -175,8 +174,8 @@ URL_GTK_OSX=https://raw.githubusercontent.com/dehesselle/gtk-osx/inkscape
URL_GTK_OSX_SETUP=$URL_GTK_OSX/gtk-osx-setup.sh
URL_GTK_OSX_MODULESET=$URL_GTK_OSX/modulesets-stable/gtk-osx.modules
URL_IMAGEMAGICK=https://github.com/ImageMagick/ImageMagick6/archive/6.9.7-10.tar.gz
-# Inkscape Git repository
URL_INKSCAPE=https://gitlab.com/inkscape/inkscape
+URL_INKSCAPE_DMG_ICNS=https://github.com/dehesselle/mibap/raw/master/inkscape_dmg.icns
URL_LCMS2=https://netcologne.dl.sourceforge.net/project/lcms/lcms/2.9/lcms2-2.9.tar.gz
URL_LIBCDR=https://github.com/LibreOffice/libcdr/archive/libcdr-0.1.5.tar.gz
URL_LIBREVENGE=https://ayera.dl.sourceforge.net/project/libwpd/librevenge/librevenge-0.0.4/librevenge-0.0.4.tar.gz
@@ -193,16 +192,17 @@ URL_PYTHON3_BIN=https://github.com/dehesselle/py3framework/releases/download/py3
# 'Plist' class got removed in 'plistlib' and 'gtk-mac-bundler' needs that.
URL_PYTHON3_SRC=https://github.com/dehesselle/py3framework/archive/py369.2.tar.gz
# A pre-built version of the complete toolset.
-URL_TOOLSET_CACHE=https://github.com/dehesselle/mibap/releases/download/v0.16/mibap_v0.16.tar.xz
+URL_TOOLSET_CACHE=https://github.com/dehesselle/mibap/releases/download/v0.17/mibap_v0.17.tar.xz
### Python packages ############################################################
PYTHON_CAIROSVG=cairosvg==2.4.0
PYTHON_CAIROCFFI=cairocffi==1.0.2
-PYTHON_LXML=lxml==4.3.3
-PYTHON_NUMPY=numpy==1.16.4
+PYTHON_DMGBUILD=dmgbuild==1.3.2
+PYTHON_LXML=lxml==4.4.0
+PYTHON_NUMPY=numpy==1.16.4 # 1.17.0 breaks (no investigation yet)
PYTHON_PYCAIRO=pycairo==1.18.1
-PYTHON_PYGOBJECT=PyGObject==3.32.1
+PYTHON_PYGOBJECT=PyGObject==3.32.2
PYTHON_SCOUR=scour==0.37
PYTHON_PYSERIAL=pyserial==3.4
diff --git a/packaging/macos/030-funcs.sh b/packaging/macos/030-funcs.sh
index b7892e6a5..59d936e70 100644
--- a/packaging/macos/030-funcs.sh
+++ b/packaging/macos/030-funcs.sh
@@ -233,3 +233,57 @@ SELF_DIR='$SELF_DIR'\
exit $?
}
+### create disk image ##########################################################
+
+function create_dmg
+{
+ local app=$1
+ local dmg=$2
+ local cfg=$3
+
+ # set application
+ sed "s/PLACEHOLDERAPPLICATION/${app//\//\\/}/" $SELF_DIR/$(basename $cfg) > $cfg
+
+ # set disk image icon (if it exists)
+ local icon=$SRC_DIR/$(basename -s .py $cfg).icns
+ if [ -f $icon ]; then
+ sed -i '' "s/PLACEHOLDERICON/${icon//\//\\/}/" $cfg
+ fi
+
+ # set background image (if it exists)
+ local background=$SRC_DIR/$(basename -s .py $cfg).png
+ if [ -f $background ]; then
+ sed -i '' "s/PLACEHOLDERBACKGROUND/${background//\//\\/}/" $cfg
+ fi
+
+ # create disk image
+ dmgbuild -s $cfg "$(basename -s .app $app)" $dmg
+}
+
+### run script via Terminal.app ################################################
+
+# This is for commands that otherwise don't behave when running in CI.
+# It requires a running desktop session (i.e. logged in user) and special
+# permissions on newer macOS versions.
+# Adapted from: https://stackoverflow.com/a/27970527
+# https://gist.github.com/masci/ff51d9cf40a87a80094c
+
+function run_in_terminal
+{
+ local command=$1
+
+ #local window_id=$(uuidgen) # this would be really unique but...
+ local window_id=$(date +%s) # ...seconds would help more with debugging
+
+ osascript <<EOF
+tell application "Terminal"
+ set _tab to do script "echo -n -e \"\\\033]0;$window_id\\\007\"; $command; exit"
+ delay 1
+ repeat while _tab is busy
+ delay 1
+ end repeat
+ close (every window whose name contains "$window_id")
+end tell
+EOF
+}
+
diff --git a/packaging/macos/160-jhbuild-other.sh b/packaging/macos/160-jhbuild-other.sh
index 2c6a658fc..3178e3141 100755
--- a/packaging/macos/160-jhbuild-other.sh
+++ b/packaging/macos/160-jhbuild-other.sh
@@ -14,16 +14,24 @@ for script in $SELF_DIR/0??-*.sh; do source $script; done
run_annotated
-### install create-dmg #########################################################
+### install disk image creator #################################################
-get_source $URL_CREATEDMG
+jhbuild run pip3 install $PYTHON_DMGBUILD
+
+### download icon for disk image ###############################################
+
+# dmgbuild offers to generate a badged version of the disk image icon, but
+# it doesn't work and I have not investigated yet. We use a pre-made image
+# for now.
+
+save_file $URL_INKSCAPE_DMG_ICNS
### install gtk-mac-bundler ####################################################
get_source $URL_GTK_MAC_BUNDLER
-make install
+jhbuild run make install
-### install svg to pgn convertor ###############################################
+### install svg to png convertor ###############################################
jhbuild run pip3 install $PYTHON_CAIROSVG
jhbuild run pip3 install $PYTHON_CAIROCFFI
@@ -41,7 +49,8 @@ save_file $URL_PYTHON3_BIN
### copy a charset.alias to lib for gtk-mac-bundler ############################
-# TODO this wasn't necessary before, why is this necessary now?
+# This wasn't necessary before, but since recent gtk-osx upstream updates,
+# whatever package did install the file in LIB_DIR, isn't doing it any longer.
cp $TMP_DIR/jhbuild/build/pkg-config-0.29.2/glib/glib/libcharset/charset.alias $LIB_DIR
diff --git a/packaging/macos/220-inkscape-package.sh b/packaging/macos/220-inkscape-package.sh
index 4529703f3..ce3dbdb78 100755
--- a/packaging/macos/220-inkscape-package.sh
+++ b/packaging/macos/220-inkscape-package.sh
@@ -15,23 +15,36 @@ set -e
run_annotated
-### package Inkscape ###########################################################
+### create application bundle ##################################################
mkdir -p $ARTIFACT_DIR
-export ARTIFACT_DIR # referenced in 'inkscape.bundle'
+( # use subshell to fence temporary variables
-BUILD_DIR=$SRC_DIR/gtk-mac-bundler.build
-mkdir -p $BUILD_DIR
+ BUILD_DIR=$SRC_DIR/gtk-mac-bundler.build
+ mkdir -p $BUILD_DIR
-cp $SRC_DIR/gtk-mac-bundler*/examples/gtk3-launcher.sh $BUILD_DIR
-cp $SELF_DIR/inkscape.bundle $BUILD_DIR
-cp $SELF_DIR/inkscape.plist $BUILD_DIR
-cd $BUILD_DIR
+ cp $SRC_DIR/gtk-mac-bundler*/examples/gtk3-launcher.sh $BUILD_DIR
+ cp $SELF_DIR/inkscape.bundle $BUILD_DIR
+ cp $SELF_DIR/inkscape.plist $BUILD_DIR
+
+ # Due to an undiagnosed instability that only occurs during CI runs (not when
+ # run interactively from the terminal), the following code will be put into
+ # a separate script and be executed via Terminal.app.
+ cat <<EOF >$SRC_DIR/run_gtk-mac-bundler.sh
+#!/usr/bin/env bash
+export ARTIFACT_DIR=$ARTIFACT_DIR
+cd $BUILD_DIR
jhbuild run gtk-mac-bundler inkscape.bundle
+EOF
+)
+
+chmod 755 $SRC_DIR/run_gtk-mac-bundler.sh
+run_in_terminal $SRC_DIR/run_gtk-mac-bundler.sh
+
+# Patch library link paths.
-# patch library locations
relocate_dependency @executable_path/../Resources/lib/inkscape/libinkscape_base.dylib $APP_EXE_DIR/Inkscape-bin
relocate_dependency @loader_path/../libpoppler.85.dylib $APP_LIB_DIR/inkscape/libinkscape_base.dylib
diff --git a/packaging/macos/230-inkscape-distrib.sh b/packaging/macos/230-inkscape-distrib.sh
index eef455666..053f542ef 100755
--- a/packaging/macos/230-inkscape-distrib.sh
+++ b/packaging/macos/230-inkscape-distrib.sh
@@ -32,20 +32,20 @@ convert -size 560x400 xc:transparent \
# create the disk image
-# A few things to note:
-# - For this script to work, there must be a running desktop session.
-# - There have been reports of troubles with the Applescript portions
-# of this script, requiring additional privileges on newer macOS versions.
-# - The background image in the '.dmg' does not show in OS X El Capitan
-# (10.11), it has something to do with how the '.DS_Store' is generated.
-
-cd $SRC_DIR/create-dmg*
-./create-dmg \
- --volname Inkscape \
- --background $SRC_DIR/inkscape_dmg.png \
- --icon "Inkscape.app" 390 240 \
- --icon-size 64 \
- $TMP_DIR/Inkscape.dmg $ARTIFACT_DIR
+# Due to an undiagnosed instability that only occurs during CI runs (not when
+# run interactively from the terminal), the following code will be put into
+# a separate script and be executed via Terminal.app.
+# See: https://github.com/al45tair/dmgbuild/pull/11
+
+cat <<EOF >$SRC_DIR/run_dmgbuild.sh
+#!/usr/bin/env bash
+SELF_DIR=$SELF_DIR
+for script in $SELF_DIR/0??-*.sh; do source \$script; done
+create_dmg $ARTIFACT_DIR/Inkscape.app $TMP_DIR/Inkscape.dmg $SRC_DIR/inkscape_dmg.py
+EOF
+
+chmod 755 $SRC_DIR/run_dmgbuild.sh
+run_in_terminal $SRC_DIR/run_dmgbuild.sh
rm -rf $APP_DIR
mv $TMP_DIR/Inkscape.dmg $ARTIFACT_DIR
diff --git a/packaging/macos/inkscape_dmg.py b/packaging/macos/inkscape_dmg.py
new file mode 100644
index 000000000..266e27b31
--- /dev/null
+++ b/packaging/macos/inkscape_dmg.py
@@ -0,0 +1,246 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import biplist
+import os.path
+
+#
+# Example settings file for dmgbuild
+#
+
+# Use like this: dmgbuild -s settings.py "Test Volume" test.dmg
+
+# You can actually use this file for your own application (not just TextEdit)
+# by doing e.g.
+#
+# dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg
+
+# .. Useful stuff ..............................................................
+
+application = defines.get('app', 'PLACEHOLDERAPPLICATION')
+appname = os.path.basename(application)
+
+def icon_from_app(app_path):
+ plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
+ plist = biplist.readPlist(plist_path)
+ icon_name = plist['CFBundleIconFile']
+ icon_root,icon_ext = os.path.splitext(icon_name)
+ if not icon_ext:
+ icon_ext = '.icns'
+ icon_name = icon_root + icon_ext
+ return os.path.join(app_path, 'Contents', 'Resources', icon_name)
+
+# .. Basics ....................................................................
+
+# Uncomment to override the output filename
+# filename = 'test.dmg'
+
+# Uncomment to override the output volume name
+# volume_name = 'Test'
+
+# Volume format (see hdiutil create -help)
+format = defines.get('format', 'UDBZ')
+
+# Volume size
+size = defines.get('size', None)
+
+# Files to include
+files = [ application ]
+
+# Symlinks to create
+#symlinks = { 'Applications': '/Applications' }
+
+# Volume icon
+#
+# You can either define icon, in which case that icon file will be copied to the
+# image, *or* you can define badge_icon, in which case the icon file you specify
+# will be used to badge the system's Removable Disk icon
+#
+icon = 'PLACEHOLDERICON'
+#badge_icon = icon_from_app(application)
+
+# Where to put the icons
+icon_locations = {
+ appname: (390, 240),
+# 'Applications': (500, 120)
+ }
+
+# .. Window configuration ......................................................
+
+# Background
+#
+# This is a STRING containing any of the following:
+#
+# #3344ff - web-style RGB color
+# #34f - web-style RGB color, short form (#34f == #3344ff)
+# rgb(1,0,0) - RGB color, each value is between 0 and 1
+# hsl(120,1,.5) - HSL (hue saturation lightness) color
+# hwb(300,0,0) - HWB (hue whiteness blackness) color
+# cmyk(0,1,0,0) - CMYK color
+# goldenrod - X11/SVG named color
+# builtin-arrow - A simple built-in background with a blue arrow
+# /foo/bar/baz.png - The path to an image file
+#
+# The hue component in hsl() and hwb() may include a unit; it defaults to
+# degrees ('deg'), but also supports radians ('rad') and gradians ('grad'
+# or 'gon').
+#
+# Other color components may be expressed either in the range 0 to 1, or
+# as percentages (e.g. 60% is equivalent to 0.6).
+background = 'PLACEHOLDERBACKGROUND'
+
+show_status_bar = False
+show_tab_view = False
+show_toolbar = False
+show_pathbar = False
+show_sidebar = False
+sidebar_width = 180
+
+# Window position in ((x, y), (w, h)) format
+window_rect = ((100, 100), (500, 380))
+
+# Select the default view; must be one of
+#
+# 'icon-view'
+# 'list-view'
+# 'column-view'
+# 'coverflow'
+#
+default_view = 'icon-view'
+
+# General view configuration
+show_icon_preview = False
+
+# Set these to True to force inclusion of icon/list view settings (otherwise
+# we only include settings for the default view)
+include_icon_view_settings = 'auto'
+include_list_view_settings = 'auto'
+
+# .. Icon view configuration ...................................................
+
+arrange_by = None
+grid_offset = (0, 0)
+grid_spacing = 100
+scroll_position = (0, 0)
+label_pos = 'bottom' # or 'right'
+text_size = 12
+icon_size = 64
+
+# .. List view configuration ...................................................
+
+# Column names are as follows:
+#
+# name
+# date-modified
+# date-created
+# date-added
+# date-last-opened
+# size
+# kind
+# label
+# version
+# comments
+#
+list_icon_size = 16
+list_text_size = 12
+list_scroll_position = (0, 0)
+list_sort_by = 'name'
+list_use_relative_dates = True
+list_calculate_all_sizes = False,
+list_columns = ('name', 'date-modified', 'size', 'kind', 'date-added')
+list_column_widths = {
+ 'name': 300,
+ 'date-modified': 181,
+ 'date-created': 181,
+ 'date-added': 181,
+ 'date-last-opened': 181,
+ 'size': 97,
+ 'kind': 115,
+ 'label': 100,
+ 'version': 75,
+ 'comments': 300,
+ }
+list_column_sort_directions = {
+ 'name': 'ascending',
+ 'date-modified': 'descending',
+ 'date-created': 'descending',
+ 'date-added': 'descending',
+ 'date-last-opened': 'descending',
+ 'size': 'descending',
+ 'kind': 'ascending',
+ 'label': 'ascending',
+ 'version': 'ascending',
+ 'comments': 'ascending',
+ }
+
+# .. License configuration .....................................................
+
+# Text in the license configuration is stored in the resources, which means
+# it gets stored in a legacy Mac encoding according to the language. dmgbuild
+# will *try* to convert Unicode strings to the appropriate encoding, *but*
+# you should be aware that Python doesn't support all of the necessary encodings;
+# in many cases you will need to encode the text yourself and use byte strings
+# instead here.
+
+# Recognized language names are:
+#
+# af_ZA, ar, be_BY, bg_BG, bn, bo, br, ca_ES, cs_CZ, cy, da_DK, de_AT, de_CH,
+# de_DE, dz_BT, el_CY, el_GR, en_AU, en_CA, en_GB, en_IE, en_SG, en_US, eo,
+# es_419, es_ES, et_EE, fa_IR, fi_FI, fo_FO, fr_001, fr_BE, fr_CA, fr_CH,
+# fr_FR, ga-Latg_IE, ga_IE, gd, grc, gu_IN, gv, he_IL, hi_IN, hr_HR, hu_HU,
+# hy_AM, is_IS, it_CH, it_IT, iu_CA, ja_JP, ka_GE, kl, ko_KR, lt_LT, lv_LV,
+# mk_MK, mr_IN, mt_MT, nb_NO, ne_NP, nl_BE, nl_NL, nn_NO, pa, pl_PL, pt_BR,
+# pt_PT, ro_RO, ru_RU, se, sk_SK, sl_SI, sr_RS, sv_SE, th_TH, to_TO, tr_TR,
+# uk_UA, ur_IN, ur_PK, uz_UZ, vi_VN, zh_CN, zh_TW
+
+# license = {
+# 'default-language': 'en_US',
+# 'licenses': {
+# # For each language, the text of the license. This can be plain text,
+# # RTF (in which case it must start "{\rtf1"), or a path to a file
+# # containing the license text. If you're using RTF,
+# # watch out for Python escaping (or read it from a file).
+# 'English': b'''{\\rtf1\\ansi\\ansicpg1252\\cocoartf1504\\cocoasubrtf820
+# {\\fonttbl\\f0\\fnil\\fcharset0 Helvetica-Bold;\\f1\\fnil\\fcharset0 Helvetica;}
+# {\\colortbl;\\red255\\green255\\blue255;\\red0\\green0\\blue0;}
+# {\\*\\expandedcolortbl;;\\cssrgb\\c0\\c0\\c0;}
+# \\paperw11905\\paperh16837\\margl1133\\margr1133\\margb1133\\margt1133
+# \\deftab720
+# \\pard\\pardeftab720\\sa160\\partightenfactor0
+
+# \\f0\\b\\fs60 \\cf2 \\expnd0\\expndtw0\\kerning0
+# \\up0 \\nosupersub \\ulnone \\outl0\\strokewidth0 \\strokec2 Test License\\
+# \\pard\\pardeftab720\\sa160\\partightenfactor0
+
+# \\fs36 \\cf2 \\strokec2 What is this?\\
+# \\pard\\pardeftab720\\sa160\\partightenfactor0
+
+# \\f1\\b0\\fs22 \\cf2 \\strokec2 This is the English license. It says what you are allowed to do with this software.\\
+# \\
+# }''',
+# },
+# 'buttons': {
+# # For each language, text for the buttons on the licensing window.
+# #
+# # Default buttons and text are built-in for the following languages:
+# #
+# # English (en_US), German (de_DE), Spanish (es_ES), French (fr_FR),
+# # Italian (it_IT), Japanese (ja_JP), Dutch (nl_NL), Swedish (sv_SE),
+# # Brazilian Portuguese (pt_BR), Simplified Chinese (zh_CN),
+# # Traditional Chinese (zh_TW), Danish (da_DK), Finnish (fi_FI),
+# # Korean (ko_KR), Norwegian (nb_NO)
+# #
+# # You don't need to specify them for those languages; if you fail to
+# # specify them for some other language, English will be used instead.
+
+# 'en_US': (
+# b'English',
+# b'Agree',
+# b'Disagree',
+# b'Print',
+# b'Save',
+# b'If you agree with the terms of this license, press "Agree" to '
+# b'install the software. If you do not agree, press "Disagree".'
+# ),
+# },
+# }