From 50d630d1234d5cef6c7c457d44215e3ff404696e Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 19 May 2024 18:38:27 +0200 Subject: Updated 6 files and added 2 files --- converter/convert_windows_x64.sh | 30 ++++++++++++++++++++++ generator/Atomic-ARM.pkgproj | 4 +-- generator/Atomic-x64.pkgproj | 4 +-- generator/index.js | 27 ++++++++++++++++---- generator/windows.iss | 54 ++++++++++++++++++++++++++++++++++++++++ launcher/Cargo.lock | 2 +- launcher/Cargo.toml | 2 +- launcher/src/main.rs | 2 ++ 8 files changed, 114 insertions(+), 11 deletions(-) create mode 100755 converter/convert_windows_x64.sh create mode 100644 generator/windows.iss diff --git a/converter/convert_windows_x64.sh b/converter/convert_windows_x64.sh new file mode 100755 index 0000000..58d72c4 --- /dev/null +++ b/converter/convert_windows_x64.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +me="$(realpath "$(dirname "$0")")" + +if [ ! -d "$1" ]; then + echo "$0: No such file or directory" + exit +fi + +if [ ! -f "$1/vk_swiftshader.dll" ]; then + echo "$0: Application is not a valid Atomic application" + exit +fi + +original=$(du -hs "$1" | awk '{print $1;}') + +echo "$0: Removing built-in Electron" +rm -rf "$1/locales" "$1/"*".pak" "$1/chrome_crashpad_handler" "$1/icudtl.dat" "$1/"*".dll" "$1/libvulkan.so.1" "$1/LICENSE" "$1/LICENSES.chromium.html" "$1/"*".bin" "$1/version" "$1/vk_swiftshader_icd.json" + +executable=$(ls "$1/"*".exe") + +echo "$0: Executable found at $executable" + +echo "$0: Copying launcher" +rm -f "$executable" +cp "$me/launcher-windows-x64.exe" "$executable" || cp "$me/../Launcher/launcher-windows-x64.exe" "$executable" + +new=$(du -hs "$1" | awk '{print $1;}') + +echo "$0: Completed. Was $original, is now $new." diff --git a/generator/Atomic-ARM.pkgproj b/generator/Atomic-ARM.pkgproj index 67d38c5..047471e 100644 --- a/generator/Atomic-ARM.pkgproj +++ b/generator/Atomic-ARM.pkgproj @@ -1008,7 +1008,7 @@ USE_HFS+_COMPRESSION VERSION - 1.0.1 + 1.1.0 TYPE 0 @@ -1513,7 +1513,7 @@ USE_HFS+_COMPRESSION VERSION - 1.2.0 + 1.3.0 TYPE 0 diff --git a/generator/Atomic-x64.pkgproj b/generator/Atomic-x64.pkgproj index 5c47f21..3a2cd60 100644 --- a/generator/Atomic-x64.pkgproj +++ b/generator/Atomic-x64.pkgproj @@ -1008,7 +1008,7 @@ USE_HFS+_COMPRESSION VERSION - 1.0.1 + 1.1.0 TYPE 0 @@ -1513,7 +1513,7 @@ USE_HFS+_COMPRESSION VERSION - 1.2.0 + 1.3.0 TYPE 0 diff --git a/generator/index.js b/generator/index.js index 0b92105..ce42e6a 100644 --- a/generator/index.js +++ b/generator/index.js @@ -16,6 +16,11 @@ cp.execSync("npm install electron@latest --platform=darwin --arch=x64", { cwd: " fs.renameSync("./work/node_modules/electron/dist", "./work/electron-darwin-x64"); fs.rmSync("./work/node_modules", { recursive: true }); +console.log("# Downloading Electron for Windows x64"); +cp.execSync("npm install electron@latest --platform=win32 --arch=x64", { cwd: "./work", stdio: "inherit" }); +fs.renameSync("./work/node_modules/electron/dist", "./work/electron-win32-x64"); +fs.rmSync("./work/node_modules", { recursive: true }); + let version = fs.readFileSync("./work/electron-darwin-arm64/version").toString().trim(); console.log("# Electron version: " + version); @@ -29,6 +34,9 @@ fs.renameSync("./work/electron-darwin-arm64/Electron.app", "./work/root/arm/Atom fs.renameSync("./work/root/x64/AtomicRuntime.framework/Contents/MacOS/Electron", "./work/root/x64/AtomicRuntime.framework/Contents/MacOS/Atomic"); fs.renameSync("./work/root/arm/AtomicRuntime.framework/Contents/MacOS/Electron", "./work/root/arm/AtomicRuntime.framework/Contents/MacOS/Atomic"); +fs.renameSync("./work/electron-win32-x64", "./work/root/x64/AtomicRuntime"); +fs.renameSync("./work/root/x64/AtomicRuntime/electron.exe", "./work/root/x64/AtomicRuntime/atomic.exe"); + fs.rmSync("./work/root/arm/AtomicRuntime.framework/Contents/Info.plist"); fs.rmSync("./work/root/arm/AtomicRuntime.framework/Contents/PkgInfo"); fs.rmSync("./work/root/x64/AtomicRuntime.framework/Contents/Info.plist"); @@ -52,7 +60,7 @@ for (let file of fs.readdirSync("../converter/").filter(i => i.startsWith("launc fs.copyFileSync("../converter/" + file, "./work/root/launcher/Atomic/Launcher/" + file); } -console.log("# Generating installer"); +console.log("# Generating installer for macOS x64"); let data = plist['parse'](fs.readFileSync("./Atomic-x64.pkgproj").toString()); data["PACKAGES"].filter(i => i["PACKAGE_SETTINGS"]["NAME"] === "Atomic Runtime")[0]["PACKAGE_SETTINGS"]["VERSION"] = version; @@ -63,6 +71,12 @@ fs.writeFileSync("./Atomic-x64-work.pkgproj", plist['build'](data) .replaceAll("", "") ); +cp.execSync("packagesbuild ./Atomic-x64-work.pkgproj", { stdio: "inherit" }); + +console.log("# Generating installer for macOS ARM"); + +cp.execSync("packagesbuild ./Atomic-ARM-work.pkgproj", { stdio: "inherit" }); + data = plist['parse'](fs.readFileSync("./Atomic-ARM.pkgproj").toString()); data["PACKAGES"].filter(i => i["PACKAGE_SETTINGS"]["NAME"] === "Atomic Runtime")[0]["PACKAGE_SETTINGS"]["VERSION"] = version; fs.writeFileSync("./Atomic-ARM-work.pkgproj", plist['build'](data) @@ -72,18 +86,21 @@ fs.writeFileSync("./Atomic-ARM-work.pkgproj", plist['build'](data) .replaceAll("", "") ); -cp.execSync("packagesbuild ./Atomic-x64-work.pkgproj", { stdio: "inherit" }); -cp.execSync("packagesbuild ./Atomic-ARM-work.pkgproj", { stdio: "inherit" }); +console.log("# Generating installer for Windows x64"); +fs.writeFileSync("./windows-work.iss", fs.readFileSync("./windows.iss").toString().replace(/#define MyAppVersion "(.*)"/gm, '#define MyAppVersion "' + version + '"')); +cp.execSync("wine ~/.wine/drive_c/Program\\ Files\\ \\(x86\\)/Inno\\ Setup\\ 6/ISCC.exe \"Z:\\Volumes\\Projects\\atomic\\generator\\windows-work.iss\"", { stdio: "inherit" }); console.log("# Cleaning up"); fs.renameSync("./build/ARM/Atomic.pkg", "./build/Atomic-Mac-ARM64.pkg"); fs.renameSync("./build/x64/Atomic.pkg", "./build/Atomic-Mac-x64.pkg"); -fs.rmdirSync("./build/ARM"); -fs.rmdirSync("./build/x64"); +fs.rmSync("./build/ARM", { recursive: true }); +fs.rmSync("./build/x64", { recursive: true }); fs.rmSync("./work", { recursive: true }); fs.rmSync("./Atomic-ARM-work.pkgproj"); fs.rmSync("./Atomic-x64-work.pkgproj"); +fs.rmSync("./windows-work.iss"); console.log("# Publishing to GitLab"); cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Mac-ARM64.pkg https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Mac-ARM64.pkg`, { cwd: "./build" }); cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Mac-x64.pkg https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Mac-x64.pkg`, { cwd: "./build" }); +cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Win32-x64.exe https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Win32-x64.exe`, { cwd: "./build" }); diff --git a/generator/windows.iss b/generator/windows.iss new file mode 100644 index 0000000..c77461d --- /dev/null +++ b/generator/windows.iss @@ -0,0 +1,54 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "Atomic Runtime for Windows" +#define MyAppVersion "1.0.0" +#define MyAppPublisher "Equestria.dev" +#define MyAppURL "https://source.equestria.dev/equestria.dev/atomic" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{34C445C9-205B-456A-88D2-B1862EB6550B} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={autopf}\Common Files\Equestria.dev +DisableDirPage=yes +DefaultGroupName={#MyAppName} +DisableProgramGroupPage=yes +LicenseFile=Z:\Volumes\Projects\atomic\generator\license-en.rtf +InfoBeforeFile=Z:\Volumes\Projects\atomic\generator\readme-en.rtf +InfoAfterFile=Z:\Volumes\Projects\atomic\generator\post-en.rtf +; Uncomment the following line to run in non administrative install mode (install for current user only.) +;PrivilegesRequired=lowest +OutputDir=Z:\Volumes\Projects\atomic\generator\build +OutputBaseFilename=Atomic-Win32-x64 +Compression=lzma +SolidCompression=yes +WizardStyle=modern +ArchitecturesInstallIn64BitMode=x64 +ArchitecturesAllowed=x64 + +[Types] +Name: "compact"; Description: "Atomic Runtime only (recommended)" +Name: "full"; Description: "Full Atomic Platform" +Name: "custom"; Description: "Custom"; Flags: iscustom + +[Components] +Name: "runtime"; Description: "Atomic Runtime"; Types: full compact custom; Flags: fixed +Name: "sdk"; Description: "UNIX Software Development Kit"; Types: full +Name: "launcher"; Description: "Standalone Launcher"; Types: full + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Files] +Source: "Z:\Volumes\Projects\atomic\generator\work\root\x64\AtomicRuntime\*"; DestDir: "{app}\AtomicRuntime"; Components: runtime; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "Z:\Volumes\Projects\atomic\generator\work\root\launcher\Atomic\Launcher\*"; DestDir: "{app}\AtomicStandaloneLauncher"; Components: launcher; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "Z:\Volumes\Projects\atomic\generator\work\root\sdk\Atomic\SDK\*"; DestDir: "{app}\AtomicSDK"; Components: sdk; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files diff --git a/launcher/Cargo.lock b/launcher/Cargo.lock index b9ecda2..39f5849 100644 --- a/launcher/Cargo.lock +++ b/launcher/Cargo.lock @@ -48,7 +48,7 @@ dependencies = [ [[package]] name = "launcher" -version = "1.2.0" +version = "1.3.0" dependencies = [ "dirs", "rustc_version_runtime", diff --git a/launcher/Cargo.toml b/launcher/Cargo.toml index 37fa64d..f0f2b82 100644 --- a/launcher/Cargo.toml +++ b/launcher/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "launcher" -version = "1.2.0" +version = "1.3.0" edition = "2021" [dependencies] diff --git a/launcher/src/main.rs b/launcher/src/main.rs index 441219f..9d4acbc 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -1,3 +1,5 @@ +#![windows_subsystem = "windows"] + use std::path::PathBuf; use std::process; use launcher::{AppData, AppDataError, constants}; -- cgit