Moving scripts to their own dedicated directory.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adsooi 2022-01-26 19:48:46 +01:00
parent 5bad125c44
commit faae76fbbd
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
9 changed files with 16 additions and 4 deletions

32
scripts/build-macosx.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.."
rm $(find . -name "*.qmlc")
rm $(find . -name "*.pyc")
python3 -m pip install -U pyinstaller
# Building translations
cd "LogarithmPlotter/i18n/"
bash release.sh
cd ../../
pyinstaller --add-data "LogarithmPlotter/qml:qml" \
--add-data "LogarithmPlotter/i18n:i18n" \
--add-data "LICENSE.md:." \
--add-data "mac/logarithmplotterfile.icns:." \
--add-data "README.md:." \
--exclude-module "FixTk" \
--exclude-module "tcl" \
--exclude-module "tk" \
--exclude-module "_tkinter" \
--exclude-module "tkinter" \
--exclude-module "Tkinter" \
--noconsole \
--noconfirm \
--icon=mac/logarithmplotter.icns \
--osx-bundle-identifier eu.ad5001.LogarithmPlotter \
-n LogarithmPlotter \
LogarithmPlotter/logarithmplotter.py
cp mac/Info.plist dist/LogarithmPlotter.app/Contents/Info.plist

View file

@ -0,0 +1,9 @@
rem Need pyinstaller >= 4.3, or there is an issue regarding the PATH of the building.
python -m pip install -U pyinstaller>=4.3
rem Building translations
cd "LogarithmPlotter\i18n"
cmd release.sh
cd ..\..
pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --add-data "LogarithmPlotter/i18n;i18n" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter

14
scripts/build-wine.sh Normal file
View file

@ -0,0 +1,14 @@
#!/bin/bash
cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.."
# Giving pyinstaller another run
rm $(find . -name "*.qmlc")
rm -rf $(find . -name "*.pyc")
wine python -m pip install -U pyinstaller
# Building translations
cd "LogarithmPlotter/i18n/"
bash release.sh
cd ../../
wine pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --add-data "LogarithmPlotter/i18n;i18n" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter

30
scripts/package-linux.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.."
# Building translations
cd "LogarithmPlotter/i18n/"
bash release.sh
cd ../../
# Deb
sudo python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \
--package logarithmplotter --copyright-file linux/debian/copyright --suite impish --depends3 "$(cat linux/debian/depends)" --section science \
bdist_deb
# Flatpak building
FLATPAK_BUILDER=$(which flatpak-builder)
if [ -z $FLATPAK_BUILDER ]; then
echo "flatpak-builder not installed. Will not proceed to build flatpak."
else
cd linux/flatpak
flatpak-builder AppDir eu.ad5001.LogarithmPlotter.json --user --force-clean --install
cd ../../
fi
# Snapcraft building
SNAPCRAFT=$(which snapcraft)
if [ -z $SNAPCRAFT ]; then
echo "snapcraft not installed. Will not proceed to build snap"
else
snapcraft
fi

63
scripts/package-macosx.sh Normal file
View file

@ -0,0 +1,63 @@
#!/usr/bin/env bash
cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.."
VERSION=0.1.6
title="LogarithmPlotter v${VERSION} Setup"
finalDMGName="LogarithmPlotter-v${VERSION}-setup.dmg"
applicationName=LogarithmPlotter
backgroundPictureName=logarithmplotter-installer-background.png
source=Installer
cd dist
rm -rf Installer
mkdir -p Installer
mkdir -p Installer/.background
cp ../mac/install-bg.png "./Installer/.background/${backgroundPictureName}"
cp -r LogarithmPlotter.app Installer/LogarithmPlotter.app
cp ../LICENSE.md Installer/LICENSE.md
cp ../README.md Installer/README.md
# Calculating folder size
duoutput=$(du -h Installer | tail -n1)
size=$(expr ${duoutput%M*} + 2) # +2 for allowing small space to edit.
echo "Creating DMG file with size ${size}M."
# Adapted from https://stackoverflow.com/a/1513578
hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ \
-fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}M pack.temp.dmg
device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
sleep 3
echo '
tell application "Finder"
tell disk "'${title}'"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 475}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
set background picture of theViewOptions to file ".background:'${backgroundPictureName}'"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'${applicationName}'" of container window to {100, 100}
set position of item "Applications" of container window to {375, 100}
set position of item "README.md" of container window to {185, 265}
set position of item "LICENSE.md" of container window to {290, 265}
update without registering applications
delay 5
close
end tell
end tell
' | osascript
chmod -Rf go-w /Volumes/"${title}"
sync
sync
hdiutil detach ${device}
hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${finalDMGName}"
rm -f pack.temp.dmg
rm -rf Installer

View file

@ -0,0 +1,7 @@
XCOPY win\*.* dist\logarithmplotter /C /S /D /Y /I
XCOPY README.md dist\logarithmplotter /C /D /Y
XCOPY LICENSE.md dist\logarithmplotter /C /D /Y
rem Creating installer
cd dist\logarithmplotter
"C:\Program Files (x86)\NSIS\makensis" installer.nsi
cd ..\..

8
scripts/package-wine.sh Normal file
View file

@ -0,0 +1,8 @@
#!/bin/bash
cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.."
# Moving files
cp win/* README.md LICENSE.md dist/logarithmplotter/
# Creating installer
cd dist/logarithmplotter/
makensis installer.nsi

24
scripts/sign-deb.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
# This script is used to sign the LogarithmPlotter deb directly from it's DSC file.
# Adapted from https://github.com/astraw/stdeb/issues/181
PPA_ARCHIVE="ppa:ad5001/logarithmplotter"
cd ../deb_dist
# create a temporary folder
mkdir tmp -p
cd tmp
rm -rf *
# DSC file variables
dsc_file="$(find ../ -regextype sed -regex ".*/*.dsc" | cut -c 4-)"
source_package_name="$(echo $dsc_file | cut -c -$(expr ${#dsc_file} - 4))"
# extract and sign the files
dpkg-source -x "../$dsc_file"
cd "$(find . -type d | head -n 2 | tail -n 1 | cut -c 3-)" # go to the (only) directory.
debuild -S -sa -k"mail@ad5001.eu"
# upload package to my PPA
dput $PPA_ARCHIVE "../${source_package_name}_source.changes"