-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path220-inkscape_package.sh
More file actions
executable file
·131 lines (97 loc) · 4.52 KB
/
Copy path220-inkscape_package.sh
File metadata and controls
executable file
·131 lines (97 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2021 René de Hesselle <dehesselle@web.de>
#
# SPDX-License-Identifier: GPL-2.0-or-later
### description ################################################################
# Create the application bundle and make everything relocatable.
### shellcheck #################################################################
# Nothing here.
### dependencies ###############################################################
source "$(dirname "${BASH_SOURCE[0]}")"/jhb/etc/jhb.conf.sh
### variables ##################################################################
SELF_DIR=$(dirname "$(greadlink -f "$0")")
### functions ##################################################################
# Nothing here.
### main #######################################################################
error_trace_enable
#----------------------------------------------------- generate application icon
svg2icns \
"$INK_SRC_DIR"/share/branding/inkscape-mac.svg \
"$DIR_TMP"/Inkscape.icns
#----------------------------------------------------- create application bundle
tar -C "$DIR_TMP" -xJf "$DIR_PKG/$(basename "${INK_PYTHON_URL}")"
abcreate create -i "$DIR_VERSION" -o "$DIR_ARTIFACT" \
"$SELF_DIR"/resources/applicationbundle.xml
#------------------------------------------------------------- modify Info.plist
# update Inkscape version information
/usr/libexec/PlistBuddy \
-c "Set CFBundleShortVersionString '$(ink_get_version)'" \
"$INK_APP_PLIST"
/usr/libexec/PlistBuddy \
-c "Set CFBundleVersion '$INK_BUILD'" \
"$INK_APP_PLIST"
# update minimum system version according to deployment target
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then
MACOSX_DEPLOYMENT_TARGET=$SYS_SDK_VER
fi
/usr/libexec/PlistBuddy \
-c "Set LSMinimumSystemVersion $MACOSX_DEPLOYMENT_TARGET" \
"$INK_APP_PLIST"
# add some metadata to make CI identifiable
if $CI_GITLAB; then
for var in PROJECT_NAME PROJECT_URL COMMIT_BRANCH COMMIT_SHA \
COMMIT_SHORT_SHA JOB_ID JOB_URL JOB_NAME PIPELINE_ID PIPELINE_URL; do
# use awk to create camel case strings (e.g. PROJECT_NAME to ProjectName)
/usr/libexec/PlistBuddy -c "Add CI$(
echo $var | awk -F _ '{
for (i=1; i<=NF; i++)
printf "%s", toupper(substr($i,1,1)) tolower(substr($i,2))
}'
) string $(eval echo \$CI_$var)" "$INK_APP_PLIST"
done
fi
#----------------------------------------------------------- add file type icons
cp "$INK_SRC_DIR"/packaging/macos/res/*.icns "$INK_APP_RES_DIR"
#----------------------------------------------------------- add Python packages
# add .pth file and icon
ink_configure_python
# Add rpath to find libraries.
install_name_tool -add_rpath "@executable_path/../../../../../Frameworks" \
"$INK_APP_FRA_DIR/Python.framework/Versions/Current/bin/python$INK_PYTHON_VER"
install_name_tool -add_rpath "@executable_path/../../../../../../../../\
Frameworks" \
"$INK_APP_FRA_DIR/Python.framework/Versions/Current/Resources/Python.app/\
Contents/MacOS/Python"
# Install wheels.
ink_pipinstall INK_PYTHON_PKG_AIIMPORT # AI import extension
ink_pipinstall INK_PYTHON_PKG_PLATFORMDIRS # extension manager
ink_pipinstall INK_PYTHON_PKG_BEAUTIFULSOUP4 # extension manager
ink_pipinstall INK_PYTHON_PKG_CACHECONTROL # extension manager
ink_pipinstall INK_PYTHON_PKG_CSSSELECT #
ink_pipinstall INK_PYTHON_PKG_LXML #
ink_pipinstall INK_PYTHON_PKG_NUMPY #
ink_pipinstall INK_PYTHON_PKG_PILLOW # export raster extension
ink_pipinstall INK_PYTHON_PKG_PYGOBJECT #
ink_pipinstall INK_PYTHON_PKG_PYSERIAL #
ink_pipinstall INK_PYTHON_PKG_SCOUR #
ink_pipinstall INK_PYTHON_PKG_TINYCSS2 #
# Reset Python interpreter shebang in all scripts.
# shellcheck disable=SC2044 # fragile for loop
for file in $(find "$INK_APP_BIN_DIR" -type f); do
if [[ $(file -b "$file") = *Python* ]]; then
gsed -i '1s|.*|#!/usr/bin/env python3|' "$file"
fi
done
#----------------------------------------------------- remove Python cache files
rm -rf "$INK_APP_RES_DIR"/share/glib-2.0/codegen/__pycache__
#-------------------------------------------------- add fontconfig configuration
# Mimic the behavior of having all files under 'share' and linking the
# active ones to 'etc'.
cd "$INK_APP_ETC_DIR"/fonts/conf.d || exit 1
for file in ./*.conf; do
ln -sf ../../../share/fontconfig/conf.avail/"$(basename "$file")" .
done
# Our customized version loses all the non-macOS paths and sets a cache
# directory below '$HOME/Library/Application Support/Inkscape'.
cp "$SELF_DIR"/resources/fonts.conf "$INK_APP_ETC_DIR"/fonts