mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Version the launcher
This commit is contained in:
parent
cc4b0a825e
commit
4e29440d6a
7 changed files with 29 additions and 15 deletions
|
@ -73,7 +73,7 @@ def show(mw: aqt.AnkiQt) -> QDialog:
|
||||||
abouttext += ("Python %s Qt %s Chromium %s<br>") % (
|
abouttext += ("Python %s Qt %s Chromium %s<br>") % (
|
||||||
platform.python_version(),
|
platform.python_version(),
|
||||||
qVersion(),
|
qVersion(),
|
||||||
qWebEngineChromiumVersion().split(".")[0],
|
(qWebEngineChromiumVersion() or "").split(".")[0],
|
||||||
)
|
)
|
||||||
abouttext += (
|
abouttext += (
|
||||||
without_unicode_isolation(tr.about_visit_website(val=aqt.appWebsite))
|
without_unicode_isolation(tr.about_visit_website(val=aqt.appWebsite))
|
||||||
|
|
|
@ -13,7 +13,8 @@ HOST_ARCH=$(uname -m)
|
||||||
|
|
||||||
# Define output paths
|
# Define output paths
|
||||||
OUTPUT_DIR="../../../out/launcher"
|
OUTPUT_DIR="../../../out/launcher"
|
||||||
LAUNCHER_DIR="$OUTPUT_DIR/anki-linux"
|
ANKI_VERSION=$(cat ../../../.version | tr -d '\n')
|
||||||
|
LAUNCHER_DIR="$OUTPUT_DIR/anki-launcher-$ANKI_VERSION-linux"
|
||||||
|
|
||||||
# Clean existing output directory
|
# Clean existing output directory
|
||||||
rm -rf "$LAUNCHER_DIR"
|
rm -rf "$LAUNCHER_DIR"
|
||||||
|
@ -77,8 +78,8 @@ chmod +x \
|
||||||
chmod -R a+r "$LAUNCHER_DIR"
|
chmod -R a+r "$LAUNCHER_DIR"
|
||||||
|
|
||||||
ZSTD="zstd -c --long -T0 -18"
|
ZSTD="zstd -c --long -T0 -18"
|
||||||
TRANSFORM="s%^.%anki-linux%S"
|
TRANSFORM="s%^.%anki-launcher-$ANKI_VERSION-linux%S"
|
||||||
TARBALL="$OUTPUT_DIR/anki-linux.tar.zst"
|
TARBALL="$OUTPUT_DIR/anki-launcher-$ANKI_VERSION-linux.tar.zst"
|
||||||
|
|
||||||
tar -I "$ZSTD" --transform "$TRANSFORM" -cf "$TARBALL" -C "$LAUNCHER_DIR" .
|
tar -I "$ZSTD" --transform "$TRANSFORM" -cf "$TARBALL" -C "$LAUNCHER_DIR" .
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Anki</string>
|
<string>Anki</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>ANKI_VERSION</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>12</string>
|
<string>12</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
|
|
|
@ -31,7 +31,8 @@ lipo -create \
|
||||||
cp "$OUTPUT_DIR/uv" "$APP_LAUNCHER/Contents/MacOS/"
|
cp "$OUTPUT_DIR/uv" "$APP_LAUNCHER/Contents/MacOS/"
|
||||||
|
|
||||||
# Copy support files
|
# Copy support files
|
||||||
cp Info.plist "$APP_LAUNCHER/Contents/"
|
ANKI_VERSION=$(cat ../../../.version | tr -d '\n')
|
||||||
|
sed "s/ANKI_VERSION/$ANKI_VERSION/g" Info.plist > "$APP_LAUNCHER/Contents/Info.plist"
|
||||||
cp icon/Assets.car "$APP_LAUNCHER/Contents/Resources/"
|
cp icon/Assets.car "$APP_LAUNCHER/Contents/Resources/"
|
||||||
cp ../pyproject.toml "$APP_LAUNCHER/Contents/Resources/"
|
cp ../pyproject.toml "$APP_LAUNCHER/Contents/Resources/"
|
||||||
cp ../../../.python-version "$APP_LAUNCHER/Contents/Resources/"
|
cp ../../../.python-version "$APP_LAUNCHER/Contents/Resources/"
|
||||||
|
|
|
@ -6,7 +6,8 @@ set -e
|
||||||
# base folder with Anki.app in it
|
# base folder with Anki.app in it
|
||||||
output="$1"
|
output="$1"
|
||||||
dist="$1/tmp"
|
dist="$1/tmp"
|
||||||
dmg_path="$output/Anki.dmg"
|
ANKI_VERSION=$(cat ../../../.version | tr -d '\n')
|
||||||
|
dmg_path="$output/anki-launcher-$ANKI_VERSION-mac.dmg"
|
||||||
|
|
||||||
if [ -d "/Volumes/Anki" ]
|
if [ -d "/Volumes/Anki" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -22,6 +22,11 @@ const NSIS_PATH: &str = "C:\\Program Files (x86)\\NSIS\\makensis.exe";
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
println!("Building Windows launcher...");
|
println!("Building Windows launcher...");
|
||||||
|
|
||||||
|
// Read version early so it can be used throughout the build process
|
||||||
|
let version = std::fs::read_to_string("../../../.version")?
|
||||||
|
.trim()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
let output_dir = PathBuf::from(OUTPUT_DIR);
|
let output_dir = PathBuf::from(OUTPUT_DIR);
|
||||||
let launcher_exe_dir = PathBuf::from(LAUNCHER_EXE_DIR);
|
let launcher_exe_dir = PathBuf::from(LAUNCHER_EXE_DIR);
|
||||||
let nsis_dir = PathBuf::from(NSIS_DIR);
|
let nsis_dir = PathBuf::from(NSIS_DIR);
|
||||||
|
@ -31,16 +36,20 @@ fn main() -> Result<()> {
|
||||||
extract_nsis_plugins()?;
|
extract_nsis_plugins()?;
|
||||||
copy_files(&output_dir)?;
|
copy_files(&output_dir)?;
|
||||||
sign_binaries(&output_dir)?;
|
sign_binaries(&output_dir)?;
|
||||||
copy_nsis_files(&nsis_dir)?;
|
copy_nsis_files(&nsis_dir, &version)?;
|
||||||
build_uninstaller(&output_dir, &nsis_dir)?;
|
build_uninstaller(&output_dir, &nsis_dir)?;
|
||||||
sign_file(&output_dir.join("uninstall.exe"))?;
|
sign_file(&output_dir.join("uninstall.exe"))?;
|
||||||
generate_install_manifest(&output_dir)?;
|
generate_install_manifest(&output_dir)?;
|
||||||
build_installer(&output_dir, &nsis_dir)?;
|
build_installer(&output_dir, &nsis_dir)?;
|
||||||
sign_file(&PathBuf::from("../../../out/launcher_exe/anki-install.exe"))?;
|
|
||||||
|
let installer_filename = format!("anki-launcher-{version}-windows.exe");
|
||||||
|
let installer_path = PathBuf::from("../../../out/launcher_exe").join(&installer_filename);
|
||||||
|
|
||||||
|
sign_file(&installer_path)?;
|
||||||
|
|
||||||
println!("Build completed successfully!");
|
println!("Build completed successfully!");
|
||||||
println!("Output directory: {}", output_dir.display());
|
println!("Output directory: {}", output_dir.display());
|
||||||
println!("Installer: ../../../out/launcher_exe/anki-install.exe");
|
println!("Installer: ../../../out/launcher_exe/{installer_filename}");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -235,11 +244,13 @@ fn generate_install_manifest(output_dir: &Path) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy_nsis_files(nsis_dir: &Path) -> Result<()> {
|
fn copy_nsis_files(nsis_dir: &Path, version: &str) -> Result<()> {
|
||||||
println!("Copying NSIS support files...");
|
println!("Copying NSIS support files...");
|
||||||
|
|
||||||
// Copy anki.template.nsi as anki.nsi
|
// Copy anki.template.nsi as anki.nsi and substitute version placeholders
|
||||||
copy_file("anki.template.nsi", nsis_dir.join("anki.nsi"))?;
|
let template_content = std::fs::read_to_string("anki.template.nsi")?;
|
||||||
|
let substituted_content = template_content.replace("ANKI_VERSION", version);
|
||||||
|
write_file(nsis_dir.join("anki.nsi"), substituted_content)?;
|
||||||
|
|
||||||
// Copy fileassoc.nsh
|
// Copy fileassoc.nsh
|
||||||
copy_file("fileassoc.nsh", nsis_dir.join("fileassoc.nsh"))?;
|
copy_file("fileassoc.nsh", nsis_dir.join("fileassoc.nsh"))?;
|
||||||
|
|
|
@ -24,7 +24,7 @@ Name "Anki"
|
||||||
Unicode true
|
Unicode true
|
||||||
|
|
||||||
; The file to write (relative to nsis directory)
|
; The file to write (relative to nsis directory)
|
||||||
OutFile "..\launcher_exe\anki-install.exe"
|
OutFile "..\launcher_exe\anki-launcher-ANKI_VERSION-windows.exe"
|
||||||
|
|
||||||
; Non elevated
|
; Non elevated
|
||||||
RequestExecutionLevel user
|
RequestExecutionLevel user
|
||||||
|
@ -214,7 +214,7 @@ Section ""
|
||||||
|
|
||||||
; Write the uninstall keys for Windows
|
; Write the uninstall keys for Windows
|
||||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "DisplayName" "Anki Launcher"
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "DisplayName" "Anki Launcher"
|
||||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "DisplayVersion" "1.0.0"
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "DisplayVersion" "ANKI_VERSION"
|
||||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
|
||||||
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "NoModify" 1
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Anki" "NoModify" 1
|
||||||
|
|
Loading…
Reference in a new issue