Skip to content

Building installer package and test it

Building Windows installer

OmegaT project uses Launch4j for application launcher and uses InnoSetup version 6 to build installer and package into distribution.

Launch4j

Launch4j is a cross-platform tool for wrapping Java applications distributed as jars in lightweight Windows native executables. The executable can be configured to search for a certain JRE version or use a bundled one, and it's possible to set runtime options, like the initial/max heap size.

The wrapper also provides better user experience through an application icon, a native pre-JRE splash screen, and a Java download page in case the appropriate JRE cannot be found.

You can find a project home page at https://launch4j.sourceforge.net/

OmegaT project uses a Gradle plugin to use launch4j during build process. The plugin we use is found at https://plugins.gradle.org/plugin/edu.sc.seis.launch4j

There is a gradle task in launch4j group

  • createAllExecutables

that will be automatically executed when win task selected.

Inno Setup

We use Inno Setup to build an installer binary for Windows. Inno Setup is a free installer builder for Windows programs by Jordan Russell and Martijn Laan. First introduced in 1997, Inno Setup today rivals and even surpasses many commercial installers in a feature set and stability.

We can download Inno Setup executable binary that can run on Windows. It is also able to run with WINE on linux.

There is a docker image built with WINE and linux.

https://github.com/amake/innosetup-docker

Install InnoSetup on Windows

When you want to build a Windows installer package on Windows10/11, you need to prepare InnoSetup6 installation manually. Please open your web browser and goto https://jsoftware.org/isdl.php Select Stable Release innosetup-6.2.2.exe, download and install.

After successfully installed, you should go to https://github.com/jsoftware/issrc/tree/is-6_2_2 and click "Code" button on the page, then select "Download ZIP" link. You will get downloaded zip file named issrc-is-6_2_2.zip. Please open zip file and goto internal folder Files/Langauges/Unofficial, and then extract all *.isl files into your InnoSetup installed folder, C:\Program Files (x86)\Inno Setup6\Languages\.

At last, please open the control panel's Systems property and open Environment Variable edit dialog. Add Inno Setup folder C:\Program Files (x86)\Inno Setup6\ in PATH environment variable.

Build windows package on Linux

OmegaT CI/CD environment is on Ubuntu Linux 22.04. Gradle tasks automatically check existence of iscc command, or container execution environment where there is docker command or nerdctl command.

Gradle tasks

There are 6 tasks defined to assemble Windows installer. When launch win task of gradle, it will launch all 6 tasks.

  • winJRE
  • winJRE64
  • winNoJRE
  • winJRESigned
  • winJRE64Signed
  • winNoJRESigned

To build singed executable binary installer, you need to have a signing tool and a certification in your smartcard(HSM). You should configure your key id and passphrase in $HOME/.gradle/gradle.properties. You also need to install a smartcard reader driver in your system.

A configuration looks like

#pkcs11engine=/usr/lib/x86_64-linux-gnu/engine-3/libpkcs11.so
pkcs11module=/usr/lib/libcrypto3PKCS.so
pkcs11cert=pkcs11:type=cert
winCodesignPassword=passphraseHere
winCodesignTimestampUrl=http://time.certum.pl/

OmegaT gradle build script is configured that you run a build process on Linux or Windows, and you have installed osslsigncode utility in your Operating System.

Because of recent change of an operation policy by a certification authority consortium, certification is now provided a form of hardware security module (HSM) such as smartcard, it is so difficult to sign code in container environment.

If anyone knows a way to do it with container, please tell us.

Building macOS installer

OmegaT project provides zip-packages which have macOS framework folder structure with application launcher binary. We use AppBundler that Sun Microsystems (currently Oracle) released for java applications on macOS.

We use a gradle-appbundler-plugin and configured to produce intell mac launcher and M1/M2 mac launcher. genMac task is to configured to generate the launcher.

build distribution

There are several tasks defined to assemble distributions for macOS.

basic distribution without signing

armMacDiztZip and macDistCip tasks are used to build standard distribution package. if you launch mac task, you will get these 2 package files.

signed package

OmegaT project prepares tasks to sign to packages for macOS.

  • macSignedDistZip
  • armMacSignedDistZip
  • macStapledNotarizedDistZip
  • armMacStapledNotarizedDistZip

Debug mac packages

It is convenient to use a following tasks to prepare a package directory structure in a build/install/ folder.

  • installArmMacDist
  • installMacDist

Building distribution with Linux Java runtime

OmegaT has tasks to build a distribution with Java runtime for Linux OS.

  • linux64DistTarBz
  • linuxArm64DistTarBz

These tasks build tar.bz2 distribution package with JRE.

Java Runtime to bundle with

You need to put Java Runtime package in a directory assetDir property specified. It is a parent directory of OmegaT project source in default.

Following packages are recognized as a windows JRE.

  • OpenJDK17U-jre_x86-32_windows_hotspot_17.0.8.1_1.zip
  • OpenJDK17U-jre_x64_windows_hotspot_17.0.8.1_1.zip

Following packages are recognized as a macOS JRE.

  • OpenJDK17U-jre_aarch64_mac_hotspot_17.0.8.1_1.tar.gz
  • OpenJDK17U-jre_x64_mac_hotspot_17.0.8.1_1.tar.gz

Following packages are recognized as a Linux JRE.

  • OpenJDK17U-jre_aarch64_linux_hotspot_17.0.8.1_1.tar.gz
  • OpenJDK17U-jre_x64_linux_hotspot_17.0.8.1_1.tar.gz

Building Linux native packages

OmegaT has tasks to generate Linux native packages in "DEB" and "RPM". We use jpackage packaging tool which is added in a Java Development Kit. It has been introduced from Java 14 and OmegaT project requires JDK 17.

The packaging tool jpackage generates installable packages for Java applications. You can provide platform-specific packages for Linux, macOS and Windows to users with a familiar way to install and launch your applications.

jpackage bundles java runtime which is used to run Gradle or is used to compile a project that has jpackage utility. Because OmegaT project uses Java 11 to compile, you need to run Gradle with JDK17.

OmegaT use gradle-jpackage-plugin that integrate jpackage command line utility which is bundled in JDK with Gradle build utility.

You can use the following tasks to produce the packages.

  • linuxDebDist
  • linuxRpmDist

You can debug a content of the package, you can run a task jpackage that produce a directory structure in build/app-image/OmegaT/.

Directory structure inside package

A directory hierarchy inside package is a bit different with standard zip distributions, which is conformance with the Linux Standard Base.

For example of deb package, when installing the package you will observe;

/opt/omegat-org/omegat/
                  |- bin/OmegaT   (launcher exe)
                  |- share/doc/license
                  |- lib/
                       |- app/ (*.jar)
                       |- docs/ (readme, manuals)
                       |- images/
                       |- modules/
                       |- runtime/  (JRE)
                       |- scripts/
                       libapplauncher.so
                       OmegaT.png