Linux build

This commit is contained in:
assada 2023-08-14 17:20:58 +03:00
parent 1e3a51dd53
commit cc470fdaff
Signed by: assada
GPG Key ID: 8905E8CE5CC3000D
4 changed files with 139 additions and 6 deletions

View File

@ -11,4 +11,26 @@ Icom CS software for IC-F300 model is back from 1997, requires DOSbox and not mo
- [ ] Write file to radio (work in developers machine only, will be published soon)
- [x] Raw serial console
Firmware format reverse engineering progress: https://git.dead.guru/ut3ums/IC-CS-X
Firmware format reverse engineering progress: https://git.dead.guru/ut3ums/IC-CS-X
## Build
Only for JDK 20
1) compiler:compile
2) dependencies:copy-dependencies
3) assembly:single
### Linux
1) `./build_linux.sh`
### Windows
TBA
### MacOS
TBA

109
build_linux.sh Executable file
View File

@ -0,0 +1,109 @@
#!/bin/bash
JAVA_VERSION=20
MAIN_JAR="icf320-1.0-SNAPSHOT-jar-with-dependencies.jar"
APP_VERSION=1.0.1
echo "java home: $JAVA_HOME"
echo "project version: $PROJECT_VERSION"
echo "app version: $APP_VERSION"
echo "main JAR file: $MAIN_JAR"
# ------ SETUP DIRECTORIES AND FILES ----------------------------------------
# Remove previously generated java runtime and installers. Copy all required
# jar files into the input/libs folder.
rm -rfd ./build/java-runtime/
rm -rfd build/installer/
mkdir -p build/installer/input/libs/
cp target/lib*/*.jar build/installer/input/libs/
cp target/${MAIN_JAR} build/installer/input/libs/
# ------ REQUIRED MODULES ---------------------------------------------------
# Use jlink to detect all modules that are required to run the application.
# Starting point for the jdep analysis is the set of jars being used by the
# application.
echo "detecting required modules"
detected_modules=`$JAVA_HOME/bin/jdeps \
--multi-release ${JAVA_VERSION} \
--ignore-missing-deps \
--print-module-deps \
--class-path "build/installer/input/libs/*" \
target/classes/guru/dead/icf320/MainApplication.class`
echo "detected modules: ${detected_modules}"
#/home/assada/IdeaProjects/icf300/src/main/java/guru/dead/icf320/Launcher.java
# /home/assada/IdeaProjects/icf300/target/classes/guru/dead/icf320/MainApplication.class
# ------ MANUAL MODULES -----------------------------------------------------
# jdk.crypto.ec has to be added manually bound via --bind-services or
# otherwise HTTPS does not work.
#
# See: https://bugs.openjdk.java.net/browse/JDK-8221674
#
# In addition we need jdk.localedata if the application is localized.
# This can be reduced to the actually needed locales via a jlink paramter,
# e.g., --include-locales=en,de.
manual_modules=jdk.crypto.ec,jdk.localedata
echo "manual modules: ${manual_modules}"
# ------ RUNTIME IMAGE ------------------------------------------------------
# Use the jlink tool to create a runtime image for our application. We are
# doing this is a separate step instead of letting jlink do the work as part
# of the jpackage tool. This approach allows for finer configuration and also
# works with dependencies that are not fully modularized, yet.
echo "creating java runtime image"
$JAVA_HOME/bin/jlink \
--no-header-files \
--no-man-pages \
--compress=2 \
--strip-debug \
--add-modules "${detected_modules},${manual_modules}" \
--include-locales=en,de \
--output build/java-runtime
# ------ PACKAGING ----------------------------------------------------------
# A loop iterates over the various packaging types supported by jpackage. In
# the end we will find all packages inside the build/installer directory.
for type in "deb" "rpm"
do
echo "Creating installer of type ... $type"
$JAVA_HOME/bin/jpackage \
--type $type \
--dest build/installer \
--input build/installer/input/libs \
--name icf300 \
--main-class guru.dead.icf320.Launcher \
--main-jar ${MAIN_JAR} \
--java-options -Xmx2048m \
--java-options '--enable-preview' \
--java-options '-Djdk.gtk.version=2' \
--runtime-image build/java-runtime \
--linux-shortcut \
--linux-menu-group "icf300" \
--app-version ${APP_VERSION} \
--icon src/main/resources/guru/dead/icf320/icon.png \
--vendor "Dead Guru" \
--copyright "Copyright © 2023 Dead Guru" \
--description "Your friendly JDK distribution updater" \
done
# ------ CHECKSUM FILE --------------------------------------------------------
arch_name="$(uname -m)"
if [ "${arch_name}" = "aarch64" ]; then
sha256sum "build/installer/icf300_$APP_VERSION_arm64.deb" > "build/installer/icf300_$APP_VERSION_arm64.deb.sha256"
sha256sum "build/installer/icf300-$APP_VERSION.aarch64.rpm" > "build/installer/icf300-$APP_VERSION.aarch64.rpm.sha256"
else
sha256sum "build/installer/icf300_${APP_VERSION}_amd64.deb" > "build/installer/icf300_${APP_VERSION}_amd64.deb.sha256"
sha256sum "build/installer/icf300-${APP_VERSION}-1.x86_64.rpm" > "build/installer/icf300-${APP_VERSION}-1.x86_64.rpm.sha256"
fi

10
pom.xml
View File

@ -87,7 +87,7 @@
<configuration>
<archive>
<manifest>
<mainClass>guru.dead.icf320.Main</mainClass>
<mainClass>guru.dead.icf320.Launcher</mainClass>
</manifest>
</archive>
<descriptorRefs>
@ -131,7 +131,7 @@
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>guru.dead.icf320.Main</mainClass>
<mainClass>guru.dead.icf320.Launcher</mainClass>
</manifest>
</archive>
</configuration>
@ -146,7 +146,7 @@
<vendor>guru.dead</vendor>
<input>target/dependency</input>
<destination>target/dist</destination>
<mainClass>guru.dead.icf320.Main</mainClass>
<mainClass>guru.dead.icf320.Launcher</mainClass>
<mainJar>../icf320-1.0-SNAPSHOT-jar-with-dependencies.jar</mainJar>
<runtimeImage>target/icf320</runtimeImage>
<linuxShortcut>true</linuxShortcut>
@ -167,13 +167,15 @@
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>guru.dead.icf320.Main</mainClass>
<mainClass>guru.dead.icf320.Launcher</mainClass>
<launcher>icf320</launcher>
<jlinkZipName>icf320</jlinkZipName>
<jlinkImageName>icf320</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<options>-cp ../lib</options>
</configuration>
</execution>
</executions>

View File

@ -1,6 +1,6 @@
package guru.dead.icf320;
public class Main {
public class Launcher {
public static void main(String[] args) {
MainApplication.main(args);
}