Creating a signed OmegaT installer¶
Getting started¶
The following working environment is recommended:
-
A Linux machine (recommended Debian-based) that runs
systemctl
.A virtual machine or WSL could be a valid substitute. This guide is based on building on MXΒ Linux (Linux 5.10.0-22-amd64) and
apt
is used for package installation commands. -
Install dependencies:
-
Install docker:
- Adjust the group membership of your user, so that you can run docker images:
- Restart or log out.
Before building¶
Setting up docker¶
Follow these steps:
- Make sure that
docker
is in your groups: - Start docker:
- Check if
docker
works: - Create a folder for the building process:
Setting up Java and Gradle¶
There are other ways to do this, what follows is just our recommended approach.
- Install sdkman (as explained here):
- Select the Java version that you need, i.e.
17.0.4-tem
(recommended: make it your default version) - Confirm that you have the expected java version:
- Download the zipped JRE bundle for the same version (file called
OpenJDK11U-jre_x64_windows_hotspot_11.0.19_7.zip
) from https://adoptium.net/ for the following criteria:- Operating system: Windows
- Architecture: x64
- Package type: JRE
- Version: 11 - LTS
- Move the zipped JRE bundle to your building folder:
Activating the certificate¶
The steps in this section only need to be done once. If that has already been done and you already have a valid binary file of the certificate (the file with .cer
extension) which hasn't expired, you can skip to the next section.
Using Certum certificate, go through the procedure to activate the certificate. Through that process, you will have to define a PIN number for the common profile that is used to access the Certum's cryptographic smart card.
You'll have to run two tools for that:
- the SmartCard Reader (which you have already installed as a dependency)
- and a Crypto tool (which the Certum page will ask you download):
At the end of the process when the certificate is activated and available for download, download the binary certificate (with a
.cer
extension) from the Certum page.
Windows installation wizard¶
A few tweaks were done in the innosetup file to customize the installation wizard on Windows machines.
These changes are permanent and don't need to be applied again (this section is just for the record).
-
OmegaT is set to install in English in all cases (user can only choose the setup language)
-
Changed location where desktop shortcut icon must be created (so that it's instsalled for the current user only)
One important implication is that the installation path has been modified to use C:\Users\USER\AppData\Local\Programs\OmegaT\OmegaT.exe
by default.
Getting down to building¶
Ok, let's build the installer.
- Move the certificate file to your building folder :
- Change directory to your building folder:
- Clone the OmegaT source code repository:
- Change directory to the
omegat
folder: - Check out the
main-capstan
branch: - Create your
local.properties
file: -
Add your certificate details to the
local.properties
file:Definingpkcs11module=/usr/lib64/crypto3PKCS/sc30pkcs11-3.0.6.68-MS.so winCodesignPassword=**** # your PIN number winCodesignCert=/path/to/omegat-installer/cert/be737b17c8d3f3f0d7bbfae716b0ee1a.cer
pkcs11cert
andwinCodesignTimestampUrl
is not necessary. -
Kindly ask Gradle to build OmegaT from source and bundle it with the JRE you downloaded into a Windows setup package:
The above command would be
./gradlew winJRE64
without code signing.
The above command would be
./gradlew macDistZip
to create a mac installer (see short howto)
Result¶
If the process works, the installer will be saved in folder ./build/distributions
, e.g.
$ cd /path/to/omegat-installer/omegat
$ find . -name "*.exe"
./build/distributions/OmegaT_5.7.3_Windows_64_Signed.exe
Signing the executable on Windows (alternative approach)¶
If for any reason the signing could not be done during building, it's also possible to sign the Windows executable after creating it. In that case, you could skip section Activating the certificate above and steps 1, 6 and 7 in section Getting down to building.
Also, step 8 in section Getting down to building would be simply:
Following steps:
-
Install the certificate in the smartcard on Windows:
- open the card in the proCertum CardManager application and go to the Common profile
- open the certificate
- click on Install
It's not clear the first step is a mandatory step, but just in case.
-
Download one of the Windows SDK's (e.g. the Windows 11 one from the Visual Studio Installer): you need just one single executable called
signtool.exe
. -
Sign the executable, e.g.
OmegaT_5.7.3_Windows_64.exe
, with SHA1 timestamp: -
Sign the same executable now with SHA2 timestamp as well (dual signing - seems to be a requirement):
Notes: -
OmegaT_5.7.3_Windows_64.exe
is both the input file and the output file, so if you'd like to keep an unsigned version, make a copy first. - "cApStAn" is the name of the certificate.
References¶
- OmegaT 4.3.1 - User's Guide > Building OmegaT From Source
- OmegaT 6.0.0 - User Manual > Build OmegaT
- omegat-org > omegat > docs_devel > Building OmegaT
- omegat-org > omegat > docs_devel > Building and testing the installer package
- Open Source Code Signing - set
- omegat-org > omegat > docs_devel > Code signing how-to
- amake/innosetup-docker