├── .editorconfig ├── 0001-Avoid-requiring-pcsc-development-files-at-runtime.patch ├── 0002-java-remove-version-build.patch ├── README.md ├── extract_cacerts.sh ├── flathub.json ├── org.freedesktop.Sdk.Extension.openjdk17.appdata.xml └── org.freedesktop.Sdk.Extension.openjdk17.yaml /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.yaml] 4 | max_line_length = 1000 5 | -------------------------------------------------------------------------------- /0001-Avoid-requiring-pcsc-development-files-at-runtime.patch: -------------------------------------------------------------------------------- 1 | From c9230ce05d9596df22443d564a03d8de63f137d6 Mon Sep 17 00:00:00 2001 2 | From: Mat Booth 3 | Date: Mon, 13 Sep 2021 15:44:32 +0100 4 | Subject: [PATCH] Avoid requiring pcsc development files at runtime 5 | 6 | JDK should try to use the versioned name of the .so instead of the 7 | unversioned name 8 | --- 9 | .../unix/classes/sun/security/smartcardio/PlatformPCSC.java | 4 ++-- 10 | 1 file changed, 2 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 13 | index 38fa3da9e..12086acac 100644 14 | --- a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 15 | +++ b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java 16 | @@ -46,8 +46,8 @@ class PlatformPCSC { 17 | 18 | private final static String PROP_NAME = "sun.security.smartcardio.library"; 19 | 20 | - private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so"; 21 | - private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so"; 22 | + private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so.1"; 23 | + private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so.1"; 24 | private final static String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC"; 25 | 26 | PlatformPCSC() { 27 | -- 28 | 2.31.1 29 | 30 | -------------------------------------------------------------------------------- /0002-java-remove-version-build.patch: -------------------------------------------------------------------------------- 1 | commit 2bf4f8e07bcbebbde9330d9c9e6906c588ec6f19 2 | Author: Martin Pilarski 3 | Date: Thu Feb 15 20:34:30 2024 +0100 4 | 5 | Avoid unsetting of VERSION_BUILD by removing corresponding code. 6 | VERSION_BUILD gets set via make/conf/version-numbers.conf. 7 | 8 | diff --git a/make/autoconf/jdk-version.m4 b/make/autoconf/jdk-version.m4 9 | index b75d2392980..59dc1a769a9 100644 10 | --- a/make/autoconf/jdk-version.m4 11 | +++ b/make/autoconf/jdk-version.m4 12 | @@ -257,30 +257,6 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS], 13 | fi 14 | fi 15 | 16 | - AC_ARG_WITH(version-build, [AS_HELP_STRING([--with-version-build], 17 | - [Set version 'BUILD' field (build number) @<:@not specified@:>@])], 18 | - [with_version_build_present=true], [with_version_build_present=false]) 19 | - 20 | - if test "x$with_version_build_present" = xtrue; then 21 | - if test "x$with_version_build" = xyes; then 22 | - AC_MSG_ERROR([--with-version-build must have a value]) 23 | - elif test "x$with_version_build" = xno; then 24 | - # Interpret --without-* as empty string instead of the literal "no" 25 | - VERSION_BUILD= 26 | - elif test "x$with_version_build" = x; then 27 | - VERSION_BUILD= 28 | - else 29 | - JDKVER_CHECK_AND_SET_NUMBER(VERSION_BUILD, $with_version_build) 30 | - fi 31 | - else 32 | - if test "x$NO_DEFAULT_VERSION_PARTS" != xtrue; then 33 | - # Default is to not have a build number. 34 | - VERSION_BUILD="" 35 | - # FIXME: Until all code can cope with an empty VERSION_BUILD, set it to 0. 36 | - VERSION_BUILD=0 37 | - fi 38 | - fi 39 | - 40 | AC_ARG_WITH(version-feature, [AS_HELP_STRING([--with-version-feature], 41 | [Set version 'FEATURE' field (first number) @<:@current source value@:>@])], 42 | [with_version_feature_present=true], [with_version_feature_present=false]) 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDK Extension for OpenJDK 17 2 | 3 | This extension contains the OpenJDK 17 Java Runtime Environment (JRE) and Java Developement Kit (JDK). 4 | 5 | OpenJDK 17 is the previous long-term support (LTS) version. 6 | 7 | For the current LTS version, see the [OpenJDK 21](https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk21) extension. 8 | 9 | For the current latest (non-LTS) version, see the [OpenJDK](https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk) extension. 10 | 11 | ## Usage 12 | 13 | You can bundle the JRE with your Flatpak application by adding this SDK extension to your Flatpak manifest and calling the install.sh script. For example: 14 | 15 | ```yaml 16 | app-id: com.example.myapp 17 | runtime: org.freedesktop.Platform 18 | runtime-version: '24.08' 19 | sdk: org.freedesktop.Sdk 20 | sdk-extensions: 21 | - org.freedesktop.Sdk.Extension.openjdk17 22 | command: myapp 23 | 24 | finish-args: 25 | - --socket=x11 26 | - --share=ipc 27 | - --env=PATH=/app/jre/bin:/app/bin:/usr/bin 28 | - --env=JAVA_HOME=/app/jre 29 | # ... 30 | 31 | modules: 32 | - name: openjdk 33 | buildsystem: simple 34 | build-commands: 35 | - /usr/lib/sdk/openjdk17/install.sh 36 | 37 | - name: myapp 38 | buildsystem: simple 39 | build-options: 40 | env: 41 | PATH: /app/bin:/usr/bin:/usr/lib/sdk/openjdk17/bin 42 | JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 43 | build-commands: 44 | - install -Dm755 -t /app/bin myapp 45 | - install -Dm644 -t /app/share/com.example.myapp myapp.jar 46 | # ... 47 | sources: 48 | - type: archive 49 | url: https://example.com/myapp/download/myapp-1.0.0.tar.gz 50 | # ... 51 | - type: script 52 | dest-filename: myapp 53 | commands: 54 | - exec java -jar /app/share/com.example.myapp/myapp.jar $@ 55 | # ... 56 | ``` 57 | -------------------------------------------------------------------------------- /extract_cacerts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Tool to generate a Java-style "cacerts" keystore from the installed 4 | # system certificates 5 | 6 | set -e 7 | 8 | jdk=${1:-/app/jdk} 9 | 10 | function get_alias() { 11 | local alias="" 12 | local issuer="${1// /}," 13 | # Determine which attribute to use for the alias 14 | if [[ $issuer =~ CN= ]] ; then 15 | # Use the "Common Name" if available 16 | alias=$(echo "$issuer" | sed -e 's/.*CN=\([^,]*\),.*/\1/') 17 | # Unless it's GlobalSign, because of non-uniqueness 18 | if [[ $alias == GlobalSign ]] ; then 19 | # In which case use the "Organisational Unit" instead 20 | alias=$(echo "$issuer" | sed -e 's/.*OU=\([^,]*\),.*/\1/') 21 | fi 22 | elif [[ $issuer =~ OU= ]] ; then 23 | # Use the "Organisational Unit" if CN is unavailable 24 | alias=$(echo "$issuer" | sed -e 's/.*OU=\([^,]*\),.*/\1/') 25 | else 26 | # Use the "Organisation" if CN and OU are unavailable 27 | alias=$(echo "$issuer" | sed -e 's/.*O=\([^,]*\),.*/\1/') 28 | fi 29 | # Return only acsii chars, all lowercase, all one word, just to be consistent with what p11-kit would do 30 | echo "$alias" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9()._-]//g' 31 | } 32 | 33 | declare -A used_aliases 34 | 35 | for certificate in $(ls /etc/ssl/certs/*.pem) ; do 36 | cert=$($jdk/bin/keytool -printcert -file $certificate) 37 | issuer=$(echo "$cert" | grep '^Issuer' | cut -d' ' -f1 --complement) 38 | fprint=$(echo "$cert" | grep 'SHA1:' | cut -d' ' -f3) 39 | alias=$(get_alias "$issuer") 40 | 41 | # If this alias has already been used, add a unique digit to the end 42 | if [[ -v "used_aliases[$alias]" ]]; then 43 | original_alias="$alias" 44 | for i in {1..9}; do 45 | alias="${original_alias}$i" 46 | [[ -v "used_aliases[$alias]" ]] || break 47 | done 48 | 49 | echo "Note: renaming duplicate alias $original_alias -> $alias" >&2 50 | fi 51 | 52 | echo "Adding $fprint ($alias)" 53 | $jdk/bin/keytool -importcert -noprompt -alias $alias -storepass changeit -storetype JKS -keystore cacerts -file $certificate 54 | used_aliases["$alias"]=1 55 | done 56 | 57 | rm $jdk/lib/security/cacerts 58 | mv cacerts $jdk/lib/security/cacerts -------------------------------------------------------------------------------- /flathub.json: -------------------------------------------------------------------------------- 1 | { 2 | "skip-icons-check": true 3 | } 4 | -------------------------------------------------------------------------------- /org.freedesktop.Sdk.Extension.openjdk17.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.freedesktop.Sdk.Extension.openjdk17 5 | CC0-1.0 6 | 0BSD AND Apache-1.1 AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FTL AND GPL-2.0 AND GPL-2.0-with-classpath-exception AND IJG AND ISC AND LGPL-2.1-or-later AND MIT AND MPL-2.0 AND RSA-MD AND SAX-PD AND W3C AND Zlib 7 | OpenJDK 17 SDK Extension 8 | The LTS (long term support) version of the OpenJDK JRE and JDK 9 | 10 |

11 | This SDK extension allows the building and running of Java-based applications. 12 |

13 |
14 | https://openjdk.java.net/ 15 | https://bugs.openjdk.java.net/ 16 | Mat Booth 17 | mat.booth@gmail.com 18 |
19 | -------------------------------------------------------------------------------- /org.freedesktop.Sdk.Extension.openjdk17.yaml: -------------------------------------------------------------------------------- 1 | id: org.freedesktop.Sdk.Extension.openjdk17 2 | branch: '24.08' 3 | runtime: org.freedesktop.Sdk 4 | runtime-version: '24.08' 5 | build-extension: true 6 | sdk: org.freedesktop.Sdk 7 | separate-locales: false 8 | cleanup: 9 | - /share/info 10 | - /share/man 11 | build-options: 12 | no-debuginfo: true 13 | strip: true 14 | prefix: /usr/lib/sdk/openjdk17 15 | env: 16 | V: '1' 17 | modules: 18 | - name: bootstrap_jdk 19 | buildsystem: simple 20 | cleanup: 21 | - '*' 22 | sources: 23 | - type: file 24 | only-arches: 25 | - x86_64 26 | url: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_linux_hotspot_17.0.15_6.tar.gz 27 | dest-filename: java-openjdk.tar.gz 28 | sha256: 9616877c733c9249328ea9bd83a5c8c30e0f9a7af180cac8ffda9034161c2df2 29 | x-checker-data: 30 | type: json 31 | url: https://api.adoptium.net/v3/assets/latest/17/hotspot?os=linux&architecture=x64&image_type=jdk 32 | version-query: .[0].version.semver 33 | url-query: .[0].binary.package.link 34 | versions: 35 | - ==: 17 36 | - type: file 37 | only-arches: 38 | - aarch64 39 | url: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.15_6.tar.gz 40 | dest-filename: java-openjdk.tar.gz 41 | sha256: 0db0d6cbe33238f33aa52837b1dc8fc6067b34d206b3e0f9243c7f8c9b9539a5 42 | x-checker-data: 43 | type: json 44 | url: https://api.adoptium.net/v3/assets/latest/17/hotspot?os=linux&architecture=aarch64&image_type=jdk 45 | version-query: .[0].version.semver 46 | url-query: .[0].binary.package.link 47 | versions: 48 | - ==: 17 49 | build-commands: 50 | - mkdir -p $FLATPAK_DEST/bootstrap-java 51 | - tar xf java-openjdk.tar.gz --strip-components=1 --directory=$FLATPAK_DEST/bootstrap-java 52 | - name: java 53 | buildsystem: autotools 54 | no-parallel-make: true 55 | config-opts: 56 | - --with-boot-jdk=/usr/lib/sdk/openjdk17/bootstrap-java 57 | - --with-jvm-variants=server 58 | - --with-version-pre= 59 | - --with-version-opt= 60 | - --with-vendor-version-string=21.9 61 | - --with-vendor-name=Flathub 62 | - --with-vendor-url=https://flathub.org 63 | - --with-vendor-bug-url=https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk17/issues 64 | - --with-debug-level=release 65 | - --with-native-debug-symbols=internal 66 | - --enable-unlimited-crypto 67 | - --with-zlib=system 68 | - --with-libjpeg=system 69 | - --with-giflib=system 70 | - --with-libpng=system 71 | - --with-lcms=system 72 | - --with-harfbuzz=system 73 | - --with-stdc++lib=dynamic 74 | - --with-extra-cxxflags=-grecord-gcc-switches -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection 75 | - --with-extra-cflags=-grecord-gcc-switches -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection 76 | - --with-extra-ldflags=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed 77 | - --disable-javac-server 78 | - --disable-warnings-as-errors 79 | make-args: 80 | - LOG=info 81 | - images 82 | post-install: 83 | - (cd $FLATPAK_DEST/jvm && ln -s openjdk-17.* openjdk-17) 84 | sources: 85 | - type: git 86 | url: https://github.com/adoptium/jdk17u.git 87 | tag: jdk-17.0.15+6 88 | commit: 0b592b7f04aae6cec666345be37c1456845e6e0d 89 | x-checker-data: 90 | type: json 91 | url: https://api.github.com/repos/adoptium/temurin17-binaries/releases/latest 92 | is-main-source: true 93 | tag-query: .tag_name 94 | - type: patch 95 | path: 0001-Avoid-requiring-pcsc-development-files-at-runtime.patch 96 | - type: patch 97 | path: 0002-java-remove-version-build.patch 98 | - type: shell 99 | commands: 100 | - chmod a+x configure 101 | - sed -i -e "s|@prefix@|$FLATPAK_DEST|" make/autoconf/spec.gmk.in 102 | - git describe --match jdk-17.*+* HEAD | sed -e 's/jdk-17.*+\(\)/VERSION_BUILD=\1/' >> make/conf/version-numbers.conf 103 | - name: cacerts 104 | buildsystem: simple 105 | sources: 106 | - type: file 107 | path: extract_cacerts.sh 108 | build-commands: 109 | - ./extract_cacerts.sh $FLATPAK_DEST/jvm/openjdk-17 110 | - name: ant 111 | buildsystem: simple 112 | cleanup: 113 | - '*.bat' 114 | - '*.cmd' 115 | sources: 116 | - type: file 117 | url: http://archive.apache.org/dist/ant/binaries/apache-ant-1.10.15-bin.tar.gz 118 | dest-filename: apache-ant-bin.tar.gz 119 | sha512: d78427aff207592c024ff1552dc04f7b57065a195c42d398fcffe7a0145e8d00cd46786f5aa52e77ab0fdf81334f065eb8011eecd2b48f7228e97ff4cb20d16c 120 | x-checker-data: 121 | type: anitya 122 | project-id: 50 123 | stable-only: true 124 | is-main-source: false 125 | url-template: http://archive.apache.org/dist/ant/binaries/apache-ant-$version-bin.tar.gz 126 | build-commands: 127 | - mkdir -p $FLATPAK_DEST/ant 128 | - tar xf apache-ant-bin.tar.gz --strip-components=1 --directory=$FLATPAK_DEST/ant 129 | - ln -s $FLATPAK_DEST/ant/bin/ant $FLATPAK_DEST/bin 130 | - name: maven 131 | buildsystem: simple 132 | cleanup: 133 | - '*.bat' 134 | - '*.cmd' 135 | sources: 136 | - type: file 137 | url: http://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz 138 | dest-filename: apache-maven-bin.tar.gz 139 | sha512: a555254d6b53d267965a3404ecb14e53c3827c09c3b94b5678835887ab404556bfaf78dcfe03ba76fa2508649dca8531c74bca4d5846513522404d48e8c4ac8b 140 | x-checker-data: 141 | type: anitya 142 | project-id: 1894 143 | stable-only: true 144 | is-main-source: false 145 | url-template: http://archive.apache.org/dist/maven/maven-3/$version/binaries/apache-maven-$version-bin.tar.gz 146 | versions: 147 | <: 4.0.0 148 | build-commands: 149 | - mkdir -p $FLATPAK_DEST/maven 150 | - tar xf apache-maven-bin.tar.gz --strip-components=1 --exclude=jansi-native --directory=$FLATPAK_DEST/maven 151 | - ln -s $FLATPAK_DEST/maven/bin/mvn $FLATPAK_DEST/maven/bin/mvnDebug $FLATPAK_DEST/bin 152 | - name: gradle 153 | buildsystem: simple 154 | cleanup: 155 | - '*.bat' 156 | sources: 157 | - type: file 158 | url: https://services.gradle.org/distributions/gradle-8.13-bin.zip 159 | dest-filename: gradle-bin.zip 160 | sha256: 20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78 161 | x-checker-data: 162 | type: json 163 | url: https://services.gradle.org/versions/current 164 | is-main-source: false 165 | version-query: .version 166 | url-query: .downloadUrl 167 | build-commands: 168 | - unzip -q gradle-bin.zip -d $FLATPAK_DEST 169 | - mv $FLATPAK_DEST/gradle-* $FLATPAK_DEST/gradle 170 | - ln -s $FLATPAK_DEST/gradle/bin/gradle $FLATPAK_DEST/bin 171 | - name: scripts 172 | buildsystem: simple 173 | sources: 174 | - type: script 175 | commands: 176 | - mkdir -p /app/jre/bin 177 | - cd /usr/lib/sdk/openjdk17/jvm/openjdk-17 178 | - cp -ra conf lib release /app/jre/ 179 | - rm /app/jre/lib/src.zip /app/jre/lib/ct.sym 180 | - cp -ra bin/{java,keytool,rmiregistry} /app/jre/bin 181 | dest-filename: install.sh 182 | - type: script 183 | commands: 184 | - mkdir -p /app/jdk/ 185 | - cd /usr/lib/sdk/openjdk17/jvm/openjdk-17 186 | - cp -ra bin conf include jmods lib release /app/jdk/ 187 | dest-filename: installjdk.sh 188 | - type: script 189 | commands: 190 | - export JAVA_HOME=/usr/lib/sdk/openjdk17/jvm/openjdk-17 191 | - export PATH=$PATH:/usr/lib/sdk/openjdk17/bin 192 | dest-filename: enable.sh 193 | build-commands: 194 | - cp enable.sh install.sh installjdk.sh /usr/lib/sdk/openjdk17/ 195 | - name: appdata 196 | buildsystem: simple 197 | sources: 198 | - type: file 199 | path: org.freedesktop.Sdk.Extension.openjdk17.appdata.xml 200 | build-commands: 201 | - mkdir -p ${FLATPAK_DEST}/share/metainfo 202 | - cp org.freedesktop.Sdk.Extension.openjdk17.appdata.xml ${FLATPAK_DEST}/share/metainfo 203 | --------------------------------------------------------------------------------