Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer package building #545

Merged
merged 3 commits into from
Nov 1, 2023
Merged

Installer package building #545

merged 3 commits into from
Nov 1, 2023

Conversation

hajdam
Copy link
Contributor

@hajdam hajdam commented Sep 13, 2023

Installers/package building using jpackage tool

  • Packager creates variant with bundled Java, but runtime is stripped before output is build
  • Contains .exe file created by launch4j - feel free to rebuild / replace it by using launch4j.xml file
  • This has limitation, that packages are platform specific. In theory they could be noarch / work for all architectures
  • Untested whether x86_64 dmg file will work on arm/M1-2 mac os

Packages from testing with current development build:
https://hajdam.zdechov.net/share/stendhal/

@AntumDeluge
Copy link
Member

The Windows installer should probably use the files already located in buildtools/launch4j.

@hajdam
Copy link
Contributor Author

hajdam commented Sep 13, 2023

The Windows installer should probably use the files already located in buildtools/launch4j.

I tried, but it has different path, so it didn't fit / package creation failed. I also tried lnk / symlink, but it didn't accept it. Feel free to provide patch if you see suitable fix.

@AntumDeluge
Copy link
Member

AntumDeluge commented Oct 31, 2023

Okay, I see why it's not using the buildtools/launch4j/stendhal-starter.exe executable. The packager puts contents of stendhal-<version>.zip into app sub-directory.

sorry I didn't respond sooner, just got my Windows system set up for development again

A couple suggestions:

  1. Remove package/client/stendhal-starter.exe from app image (since it will never be used):
diff --git a/buildtools/ant_modules/package.xml b/buildtools/ant_modules/package.xml
index 1383f6bc4a..8231256589 100644
--- a/buildtools/ant_modules/package.xml
+++ b/buildtools/ant_modules/package.xml
@@ -8,8 +8,13 @@
     - Follow jpackage error messages to install missing dependencies, like for example .NET runtime / wix on Windows
   -->

-  <target name="msiPackage" description="Creates MSI installer package from current build">
+  <target name="stagePackage">
+    <delete dir="${build}/package/client"/>
     <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
+    <delete file="${build}/package/client/stendhal-starter.exe"/>
+  </target>
+
+  <target name="msiPackage" description="Creates MSI installer package from current build" depends="stagePackage">
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
       <arg line="--dest ${build}/package/msi-app-image"/>
@@ -38,8 +43,7 @@
     </exec>
   </target> <!-- msiPackage -->

-  <target name="dmgPackage" description="Creates DMG package from current build">
-    <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
+  <target name="dmgPackage" description="Creates DMG package from current build" depends="stagePackage">
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
       <arg line="--dest ${build}/package/dmg-app-image"/>
@@ -66,8 +70,7 @@
     </exec>
   </target> <!-- dmgPackage -->

-  <target name="rpmPackage" description="Creates RPM package from current build">
-    <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
+  <target name="rpmPackage" description="Creates RPM package from current build" depends="stagePackage">
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
       <arg line="--dest ${build}/package/rpm-app-image"/>
@@ -99,8 +102,7 @@
     </exec>
   </target> <!-- rpmPackage -->

-  <target name="debPackage" description="Creates DEB package from current build">
-    <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
+  <target name="debPackage" description="Creates DEB package from current build" depends="stagePackage">
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
       <arg line="--dest ${build}/package/deb-app-image"/>
  1. Clean up app image directory before build to prevent failures on subsequent builds:
diff --git a/buildtools/ant_modules/package.xml b/buildtools/ant_modules/package.xml
index 1383f6bc4a..8e46993cff 100644
--- a/buildtools/ant_modules/package.xml
+++ b/buildtools/ant_modules/package.xml
@@ -9,6 +9,7 @@
   -->

   <target name="msiPackage" description="Creates MSI installer package from current build">
+    <delete dir="${build}/package/msi-app-image"/>
     <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
@@ -39,6 +40,7 @@
   </target> <!-- msiPackage -->

   <target name="dmgPackage" description="Creates DMG package from current build">
+    <delete dir="${build}/package/dmg-app-image"/>
     <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
@@ -67,6 +69,7 @@
   </target> <!-- dmgPackage -->

   <target name="rpmPackage" description="Creates RPM package from current build">
+    <delete dir="${build}/package/rpm-app-image"/>
     <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>
@@ -100,6 +103,7 @@
   </target> <!-- rpmPackage -->

   <target name="debPackage" description="Creates DEB package from current build">
+    <delete dir="${build}/package/deb-app-image"/>
     <unzip dest="${build}/package/client" src="${buildroot}/stendhal-${version}.zip"/>
     <exec executable="jpackage" dir="." failonerror="true">
       <arg line="--type app-image"/>

@AntumDeluge AntumDeluge self-assigned this Oct 31, 2023
@AntumDeluge AntumDeluge merged commit 7b57cc3 into arianne:master Nov 1, 2023
3 checks passed
@AntumDeluge
Copy link
Member

Thank you @hajdam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants