2018-01-14 01:18:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-04-28 14:34:18 +00:00
|
|
|
set -e
|
2022-02-28 15:30:40 +00:00
|
|
|
info_year=$( date "+%Y" )
|
2018-01-14 01:18:50 +00:00
|
|
|
site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")"
|
2022-04-18 08:59:42 +00:00
|
|
|
arch=$(uname -m)
|
2020-01-28 03:22:22 +00:00
|
|
|
if [ "$BUILD" = "linux" ]; then
|
2022-04-18 08:59:42 +00:00
|
|
|
pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/gio/modules/libgiolibproxy.so:. "
|
|
|
|
pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/libproxy.so.1:. "
|
|
|
|
pyinstaller_args+="--add-binary /lib/"$arch"-linux-gnu/libnsl.so.1:. "
|
|
|
|
pyinstaller_args+="--add-binary /usr/lib/"$arch"-linux-gnu/libxcb.so.1:. "
|
2018-02-20 02:43:39 +00:00
|
|
|
fi
|
2018-01-14 01:18:50 +00:00
|
|
|
|
|
|
|
# This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk,
|
|
|
|
# but it does use GTK (through wxPython). pyinstaller has some special
|
|
|
|
# logic to handle GTK apps that is engaged when you import
|
|
|
|
# gi.repository.Gtk that pulls in things like themes, icons, etc. Without
|
|
|
|
# that, the Params dialog is unthemed and barely usable. This hidden
|
|
|
|
# import option is actually the only reason we had to install python-gi
|
|
|
|
# above!
|
|
|
|
pyinstaller_args+="--hidden-import gi.repository.Gtk "
|
|
|
|
|
2018-07-14 00:03:26 +00:00
|
|
|
# mac and windows build seem to miss wx import
|
2018-07-18 02:42:59 +00:00
|
|
|
pyinstaller_args+="--hidden-import wx "
|
2018-01-14 01:18:50 +00:00
|
|
|
|
2018-07-31 12:53:15 +00:00
|
|
|
# We need to use the precompiled bootloader linked with graphical Mac OS X
|
|
|
|
# libraries if we develop a GUI application for Mac:
|
2020-03-15 02:12:58 +00:00
|
|
|
if [ "$BUILD" = "osx" -o "$BUILD" = "windows" ]; then
|
2018-07-31 12:53:15 +00:00
|
|
|
pyinstaller_args+="--windowed "
|
|
|
|
fi
|
|
|
|
|
2018-02-20 02:43:39 +00:00
|
|
|
# This lets pyinstaller see inkex.py, etc.
|
2018-08-20 02:21:28 +00:00
|
|
|
pyinstaller_args+="-p inkscape/share/extensions "
|
2018-01-24 01:13:37 +00:00
|
|
|
|
2018-03-31 00:37:11 +00:00
|
|
|
# output useful debugging info that helps us trace library dependency issues
|
|
|
|
pyinstaller_args+="--log-level DEBUG "
|
|
|
|
|
2021-12-08 21:18:41 +00:00
|
|
|
# This adds bundle identifier in reverse DSN format for macos
|
|
|
|
if [ "$BUILD" = "osx" ]; then
|
|
|
|
pyinstaller_args+="--osx-bundle-identifier org.inkstitch.app "
|
2022-02-28 15:30:40 +00:00
|
|
|
pyinstaller_args+="-i electron/build/icons/mac/inkstitch.icns"
|
2021-12-08 21:18:41 +00:00
|
|
|
if [[ -z ${GITHUB_REF} ]]; then
|
2022-04-18 08:59:42 +00:00
|
|
|
echo "Dev or Local Build"
|
2021-12-08 21:18:41 +00:00
|
|
|
else
|
|
|
|
bash bin/import-macos-keys
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-05-01 00:13:58 +00:00
|
|
|
if [ "$BUILD" = "windows" ]; then
|
2022-02-28 15:30:40 +00:00
|
|
|
if [[ "$VERSION" =~ ^v[0-9][.0-9]+$ ]]; then
|
|
|
|
# setting the file and product version for release
|
|
|
|
# Code to remove the periods in the version number
|
|
|
|
ENT=.
|
|
|
|
SAL=${VERSION#v}$ENT
|
|
|
|
INFO_VERSION=()
|
|
|
|
while [[ $SAL ]]; do
|
|
|
|
INFO_VERSION+=( "${SAL%%"$ENT"*}" );
|
|
|
|
SAL=${SAL#*"$ENT"};
|
|
|
|
done;
|
|
|
|
sed -i'' 's/3, 2, 1,/'"${INFO_VERSION[0]}, ${INFO_VERSION[1]}, ${INFO_VERSION[2]},"'/' installer_scripts/file_version_info.txt
|
|
|
|
fi
|
|
|
|
# set year and version in version_info
|
|
|
|
sed -i'' 's/1.1.1/'"${VERSION#v}"'/' installer_scripts/file_version_info.txt
|
|
|
|
sed -i'' 's/1234/'"${info_year}"'/' installer_scripts/file_version_info.txt
|
|
|
|
# sets icon to inkstitch.exe
|
|
|
|
pyinstaller_args+="--i electron/build/icons/win/inkstitch.ico "
|
|
|
|
pyinstaller_args+="--version-file installer_scripts/file_version_info.txt "
|
2020-01-27 20:39:45 +00:00
|
|
|
python -m PyInstaller $pyinstaller_args inkstitch.py
|
2022-06-10 14:32:16 +00:00
|
|
|
else
|
2020-01-27 20:39:45 +00:00
|
|
|
LD_LIBRARY_PATH="${site_packages}/wx" python -m PyInstaller $pyinstaller_args --strip inkstitch.py;
|
2018-05-01 00:13:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# pyinstaller put a whole mess of libraries under dist/inkstitch. We'd like
|
|
|
|
# to put some more user-accessible stuff like examples and palettes in
|
|
|
|
# folders under inkstitch/ (see ../Makefile) so let's move the pyinstaller
|
|
|
|
# stuff into its own dir.
|
|
|
|
shopt -s dotglob
|
|
|
|
mkdir dist/bin
|
|
|
|
mv dist/inkstitch/* dist/bin
|
|
|
|
mv dist/bin dist/inkstitch
|