2021-04-22 07:49:32 +12:00
|
|
|
#!/bin/sh
|
|
|
|
EXEC_DIR=$(pwd)
|
|
|
|
|
|
|
|
DIR=$(mktemp -d /tmp/manuskript-windows.XXXXXX)
|
|
|
|
PREFIX=$DIR/.wine
|
|
|
|
|
2021-11-22 09:32:12 +13:00
|
|
|
BUILD_ARCH="win32"
|
|
|
|
PY_VERSION="3.8.10"
|
|
|
|
|
|
|
|
PY_NAME="python-$PY_VERSION"
|
|
|
|
|
|
|
|
if [ "$BUILD_ARCH" = "win64" ]; then
|
|
|
|
PY_NAME="$PY_NAME-amd64"
|
|
|
|
fi
|
|
|
|
|
2021-04-22 07:49:32 +12:00
|
|
|
# Install Python:
|
2021-11-22 09:32:12 +13:00
|
|
|
PY_DOWNLOAD="https://www.python.org/ftp/python/$PY_VERSION/$PY_NAME.exe"
|
2021-04-22 07:49:32 +12:00
|
|
|
PY_SETUP=$(echo $PY_DOWNLOAD | tr '/' ' ' | awk '{ print $(NF) }')
|
|
|
|
|
|
|
|
if [ ! -e $PY_SETUP ]; then
|
|
|
|
wget $PY_DOWNLOAD
|
|
|
|
fi
|
|
|
|
|
2021-11-22 09:32:12 +13:00
|
|
|
WINEPREFIX=$PREFIX WINEARCH=$BUILD_ARCH wine $PY_SETUP /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
|
2021-04-22 07:49:32 +12:00
|
|
|
|
|
|
|
# Install Pandoc:
|
2021-11-19 03:23:07 +13:00
|
|
|
PAN_DOWNLOAD="https://github.com/jgm/pandoc/releases/download/2.16.1/pandoc-2.16.1-windows-x86_64.msi"
|
2021-04-22 07:49:32 +12:00
|
|
|
PAN_SETUP=$(echo $PAN_DOWNLOAD | tr '/' ' ' | awk '{ print $(NF) }')
|
|
|
|
|
|
|
|
if [ ! -e $PAN_SETUP ]; then
|
|
|
|
wget $PAN_DOWNLOAD
|
|
|
|
fi
|
|
|
|
|
2021-11-22 09:32:12 +13:00
|
|
|
WINEPREFIX=$PREFIX WINEARCH=$BUILD_ARCH wine $PAN_SETUP /qn /norestart
|
|
|
|
|
|
|
|
PY_DIR="Python$(echo $PY_VERSION | sed -e s/\\./\ /g - | awk '{ print $1$2 }')"
|
|
|
|
|
|
|
|
if [ "$BUILD_ARCH" = "win32" ]; then
|
|
|
|
PY_DIR="$PY_DIR-32"
|
|
|
|
fi
|
2021-04-22 07:49:32 +12:00
|
|
|
|
|
|
|
# Install most dependencies with pip:
|
2021-11-22 09:32:12 +13:00
|
|
|
cd $PREFIX/drive_c/Program\ Files/$PY_DIR/
|
2021-04-22 07:49:32 +12:00
|
|
|
|
|
|
|
pip_install() {
|
2021-11-22 09:32:12 +13:00
|
|
|
WINEPREFIX=$PREFIX WINEARCH=$BUILD_ARCH wine python.exe Scripts/pip.exe install $@
|
2021-04-22 07:49:32 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
# Upgrade pip to mitigate problems:
|
|
|
|
pip_install --upgrade pip
|
|
|
|
|
|
|
|
# Install required dependencies:
|
2021-11-26 03:06:08 +13:00
|
|
|
|
|
|
|
# Version 4.4 does not cause the issue with lxml (potential fallback)
|
|
|
|
pip_install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
|
|
|
|
#pip_install pyinstaller==4.4
|
|
|
|
|
2021-04-22 07:49:32 +12:00
|
|
|
pip_install lxml
|
|
|
|
pip_install PyQt5
|
|
|
|
|
|
|
|
# Install optional dependencies:
|
|
|
|
pip_install pyenchant
|
|
|
|
pip_install pyspellchecker
|
|
|
|
pip_install symspellpy
|
|
|
|
pip_install language_tool_python
|
|
|
|
pip_install markdown
|
|
|
|
|
|
|
|
# Clone the repository from Github:
|
|
|
|
REPOSITORY="https://github.com/olivierkes/manuskript.git"
|
|
|
|
|
|
|
|
cd $DIR
|
|
|
|
git clone $REPOSITORY
|
|
|
|
cd manuskript
|
|
|
|
|
2021-04-27 08:57:43 +12:00
|
|
|
PKG_VERSION=$(grep -E "__version__.*\".*\"" "manuskript/version.py" | cut -d\" -f2)
|
|
|
|
|
2021-04-22 07:49:32 +12:00
|
|
|
# Run PyInstaller to create the build:
|
2021-11-22 09:32:12 +13:00
|
|
|
WINEPREFIX=$PREFIX WINEARCH=$BUILD_ARCH wine pyinstaller manuskript.spec
|
2021-04-22 07:49:32 +12:00
|
|
|
cat build/manuskript/warn-manuskript.txt
|
|
|
|
|
|
|
|
cd dist/manuskript
|
|
|
|
|
|
|
|
# Remove this library (causing weird bluetooth problems):
|
|
|
|
### comment: We don't need bluetooth anyway... ^^'
|
|
|
|
rm Qt5Bluetooth.dll
|
|
|
|
|
2021-07-31 05:04:19 +12:00
|
|
|
# Remove this library (causing a crash on Windows 7):
|
|
|
|
rm ucrtbase.dll
|
|
|
|
|
2021-04-22 07:49:32 +12:00
|
|
|
# Remove unnecessary libraries:
|
|
|
|
rm api-ms-win-*
|
|
|
|
|
|
|
|
# Test Manuskript:
|
|
|
|
### comment: Seems to work fine...
|
2021-11-22 09:32:12 +13:00
|
|
|
WINEPREFIX=$PREFIX WINEARCH=$BUILD_ARCH wine manuskript.exe &
|
|
|
|
WINE_TEST_PID=$!
|
2021-04-22 07:49:32 +12:00
|
|
|
|
2021-11-22 09:32:12 +13:00
|
|
|
sleep 5
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
tmp_cleanup() {
|
|
|
|
# Cleanup everything:
|
|
|
|
### comment: removing the local git repository
|
|
|
|
### requires write permissions...
|
|
|
|
chmod +w -R $DIR/manuskript
|
|
|
|
rm -r $DIR
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $(ps $WINE_TEST_PID | grep manuskript.exe | wc -l) -gt 0 ]; then
|
|
|
|
kill $WINE_TEST_PID
|
|
|
|
else
|
|
|
|
echo "ERROR: Package has crashed to an critical error!"
|
|
|
|
tmp_cleanup
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
ZIP_NAME=manuskript-$PKG_VERSION-$BUILD_ARCH.zip
|
2021-04-27 08:57:43 +12:00
|
|
|
|
2021-04-22 07:49:32 +12:00
|
|
|
# Package everything together:
|
2021-04-27 08:57:43 +12:00
|
|
|
zip -r $ZIP_NAME manuskript
|
|
|
|
mv $ZIP_NAME $EXEC_DIR
|
2021-04-22 07:49:32 +12:00
|
|
|
|
2021-11-22 09:32:12 +13:00
|
|
|
tmp_cleanup
|