Use smc and just to package

This commit is contained in:
Rémi BERTHO 2023-11-07 20:55:38 +01:00
parent d1fe41cbee
commit 68860aad80
Signed by: dalan
GPG key ID: EE3B917931C07B64
6 changed files with 56 additions and 535 deletions

24
Justfile Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env -S just --justfile
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
alias b := build
build:
cargo build
dist_linux:
rm -Rf ./dist
mkdir dist
cargo build --release
smc bin_linux files
smc sources
dist_win:
Remove-Item dist -Force -Recurse
New-Item -Path dist -Type Directory
cargo build --release
smc bin_win files
smc sources
pandoc -i LICENSE.md -s -o LICENSE.rtf
Start-Process -FilePath "C:\Program Files (x86)\Inno Setup 6\compil32.exe" -ArgumentList "/cc", "win-setup.iss" -Wait
Get-FileHash "dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe" -Algorithm SHA512 | Select-Object -ExpandProperty Hash | Out-File "dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc-setup.exe.sha512sum"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 431 KiB

View file

@ -1,20 +0,0 @@
$version="1.1"
if (Test-Path dist\"SimplePanoramaViewer-$version-win64.exe")
{
Remove-Item dist\"SimplePanoramaViewer-$version-win64.exe" -Force -Recurse
}
if (Test-Path dist\SimplePanoramaViewer)
{
Remove-Item dist\SimplePanoramaViewer -Force -Recurse
}
pandoc -i LICENSE.md -s -o LICENSE.rtf
pyinstaller SimplePanoramaViewer_folder.spec
Start-Process -FilePath "C:\Program Files (x86)\Inno Setup 6\compil32.exe" -ArgumentList "/cc", "win-setup.iss" -Wait
Remove-Item dist\SimplePanoramaViewer -Force -Recurse
Get-FileHash "dist/SimplePanoramaViewer-$version-win64-setup.exe" -Algorithm SHA512 | Select-Object -ExpandProperty Hash | Out-File "dist/SimplePanoramaViewer-$version-win64-setup.exe.sha512sum"
pyinstaller SimplePanoramaViewer_file.spec
Rename-Item -Path "dist\SimplePanoramaViewer.exe" -NewName "SimplePanoramaViewer-$version-win64.exe"
Get-FileHash "dist/SimplePanoramaViewer-$version-win64.exe" -Algorithm SHA512 | Select-Object -ExpandProperty Hash | Out-File "dist/SimplePanoramaViewer-$version-win64.exe.sha512sum"

29
smc.toml Normal file
View file

@ -0,0 +1,29 @@
[profiles]
[profiles.bin_linux]
output = "./dist/SimplePanoramaViewer-2.0.0-x86_64-unknown-linux-gnu$EXT"
directory = "target/release/"
files = ["simple_panorama_viewer"]
container = "Tar"
compression = "Zstd"
compression_level = 15
signatures = ["Sha512"]
[profiles.bin_win]
output = "./dist/SimplePanoramaViewer-2.0.0-x86_64-pc-windows-msvc$EXT"
directory = "target/release/"
files = ["simple_panorama_viewer.exe"]
container = "Zip"
compression = "Deflate"
compression_level = 9
signatures = ["Sha512"]
[profiles.files]
files = ["README.md", "LICENSE.md"]
[profiles.sources]
paths = ["./"]
output = "./dist/SimplePanoramaViewer-2.0.0-src$EXT"
container = "Tar"
compression = "Zstd"
compression_level = 15
signatures = ["Sha512"]

View file

@ -1,98 +0,0 @@
#!/bin/bash
print_help()
{
echo "SimplePanoramaViewer utility script"
echo
echo "Use:"
echo " bash utility.sh OPTION [PATH_TO_INSTALL_DIR]"
echo
echo "Options:"
echo " -i, --install Install SimplePanoramaViewer in PATH_TO_INSTALL_DIR"
echo " -u, --uninstall Uninstall SimplePanoramaViewer from PATH_TO_INSTALL_DIR"
echo " -p, --package Generate a package for SimplePanoramaViewer"
}
check_dir()
{
if [ -z "$1" ]; then
echo "You need to pass a directory"
exit
fi
}
install()
{
DESTDIR=$1
check_dir "$DESTDIR"
if [ -z "$2" ]; then
PREFIX=$DESTDIR
else
PREFIX="$2"
DESTDIR=$DESTDIR$PREFIX
echo $DESTDIR
fi
mkdir -p "$DESTDIR/bin/"
mkdir -p "$DESTDIR/share/applications"
cp install/SimplePanoramaViewer.desktop "$DESTDIR/share/applications"
cp target/release/simple_panorama_viewer "$DESTDIR/bin"
chmod a+x "$DESTDIR/bin/simple_panorama_viewer"
}
uninstall()
{
DIR=$1
check_dir "$DIR"
rm "$DIR/bin/simple_panorama_viewer"
rm "$DIR/share/applications/SimplePanoramaViewer.desktop"
}
package()
{
DIR="/tmp/SimplePanoramaViewer"
mkdir "$DIR"
cp target/release/simple_panorama_viewer "$DIR"
cp LICENSE.md "$DIR"
cp README.md "$DIR"
chmod a+x "$DIR/simple_panorama_viewer"
mkdir -p dist
cd /tmp || exit
tar --zstd -cf "SimplePanoramaViewer.tar.zst" "SimplePanoramaViewer"
cd - || exit
cp -f "$DIR.tar.zst" dist
rm -r "$DIR"
rm "$DIR.tar.zst"
}
build()
{
cargo build --release
strip target/release/simple_panorama_viewer
}
case "$1" in
"-h" | "--help")
print_help
;;
"-i" | "--install")
install "$2" "$3"
;;
"-u" | "--uninstall")
uninstall "$2"
;;
"-p" | "--package")
package
;;
"-b" | "--build")
build
;;
*)
print_help
;;
esac

View file

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "SimplePanoramaViewer" #define MyAppName "SimplePanoramaViewer"
#define MyAppVersion "1.1" #define MyAppVersion "2.0.0"
#define MyAppPublisher "Dalan" #define MyAppPublisher "Dalan"
#define MyAppURL "https://www.dalan.fr" #define MyAppURL "https://www.dalan.fr"
#define MyAppExeName "SimplePanoramaViewer.exe" #define MyAppExeName "SimplePanoramaViewer.exe"
@ -22,9 +22,9 @@ AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName} DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes DisableProgramGroupPage=yes
LicenseFile=LICENSE.rtf LicenseFile=LICENSE.rtf
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-win64-setup OutputBaseFilename={#MyAppName}-{#MyAppVersion}-x86_64-pc-windows-msvc-setup
OutputDir=dist OutputDir=dist
Compression=lzma Compression=lzma2
SolidCompression=yes SolidCompression=yes
ArchitecturesAllowed=x64 ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64 ArchitecturesInstallIn64BitMode=x64