adoptopenjdk-bin: add OpenJDK 8

This commit is contained in:
Ben Wolsieffer 2019-07-21 15:40:18 -04:00
parent 18e0f9d39f
commit ded7ec067f
7 changed files with 202 additions and 109 deletions

View File

@ -6,10 +6,10 @@ import re
import requests import requests
import sys import sys
releases = ["openjdk11"] releases = ("openjdk8", "openjdk11")
oses = ["mac", "linux"] oses = ("mac", "linux")
types = ["jre", "jdk"] types = ("jre", "jdk")
impls = ["hotspot", "openj9"] impls = ("hotspot", "openj9")
arch_to_nixos = { arch_to_nixos = {
"x64": ("x86_64",), "x64": ("x86_64",),
@ -24,7 +24,6 @@ def get_sha256(url):
sys.exit(1) sys.exit(1)
return resp.text.strip().split(" ")[0] return resp.text.strip().split(" ")[0]
RE_RELEASE_NAME = re.compile(r'[^-]+-([0-9.]+)\+([0-9]+)') # example release name: jdk-11.0.1+13
def generate_sources(release, assets): def generate_sources(release, assets):
out = {} out = {}
for asset in assets: for asset in assets:
@ -34,7 +33,8 @@ def generate_sources(release, assets):
if asset["heap_size"] != "normal": continue if asset["heap_size"] != "normal": continue
if asset["architecture"] not in arch_to_nixos: continue if asset["architecture"] not in arch_to_nixos: continue
version, build = RE_RELEASE_NAME.match(asset["release_name"]).groups() # examples: 11.0.1+13, 8.0.222+10
version, build = asset["version_data"]["semver"].split("+")
type_map = out.setdefault(asset["os"], {}) type_map = out.setdefault(asset["os"], {})
impl_map = type_map.setdefault(asset["binary_type"], {}) impl_map = type_map.setdefault(asset["binary_type"], {})

View File

@ -46,9 +46,6 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name;
passthru.home = result; passthru.home = result;
# for backward compatibility
passthru.architecture = "";
meta = with stdenv.lib; { meta = with stdenv.lib; {
license = licenses.gpl2Classpath; license = licenses.gpl2Classpath;
description = "AdoptOpenJDK, prebuilt OpenJDK binary"; description = "AdoptOpenJDK, prebuilt OpenJDK binary";

View File

@ -1,48 +1,16 @@
sourcePerArch: sourcePerArch:
{ swingSupport ? true { stdenv
, stdenv , lib
, fetchurl , fetchurl
, file , autoPatchelfHook
, xorg ? null
, glib
, libxml2
, ffmpeg_2
, libxslt
, libGL
, freetype
, fontconfig
, gtk2
, pango
, cairo
, alsaLib , alsaLib
, atk , freetype
, gdk-pixbuf
, zlib , zlib
, elfutils , xorg
}: }:
assert swingSupport -> xorg != null;
let let
rSubPaths = [
"lib/jli"
"lib/server"
"lib/compressedrefs" # OpenJ9
"lib/j9vm" # OpenJ9
"lib"
];
libraries = [
stdenv.cc.libc glib libxml2 ffmpeg_2 libxslt libGL
xorg.libXxf86vm alsaLib fontconfig freetype pango gtk2 cairo gdk-pixbuf
atk zlib elfutils
] ++ (stdenv.lib.optionals swingSupport [
xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXp xorg.libXt
xorg.libXrender
stdenv.cc.cc
]);
cpuName = stdenv.hostPlatform.parsed.cpu.name; cpuName = stdenv.hostPlatform.parsed.cpu.name;
in in
@ -57,7 +25,12 @@ let result = stdenv.mkDerivation rec {
inherit (sourcePerArch.${cpuName}) url sha256; inherit (sourcePerArch.${cpuName}) url sha256;
}; };
nativeBuildInputs = [ file ]; buildInputs = [
alsaLib freetype zlib xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi
xorg.libXrender
];
nativeBuildInputs = [ autoPatchelfHook ];
# See: https://github.com/NixOS/patchelf/issues/10 # See: https://github.com/NixOS/patchelf/issues/10
dontStrip = 1; dontStrip = 1;
@ -74,10 +47,7 @@ let result = stdenv.mkDerivation rec {
# Remove embedded freetype to avoid problems like # Remove embedded freetype to avoid problems like
# https://github.com/NixOS/nixpkgs/issues/57733 # https://github.com/NixOS/nixpkgs/issues/57733
rm $out/lib/libfreetype.so find "$out" -name 'libfreetype.so*' -delete
# for backward compatibility
ln -s $out $out/jre
mkdir -p $out/nix-support mkdir -p $out/nix-support
@ -87,32 +57,16 @@ let result = stdenv.mkDerivation rec {
EOF EOF
''; '';
postFixup = ''
rpath+="''${rpath:+:}${stdenv.lib.concatStringsSep ":" (map (a: "$out/${a}") rSubPaths)}"
# set all the dynamic linkers
find $out -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$rpath" {} \;
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
'';
rpath = stdenv.lib.strings.makeLibraryPath libraries;
# FIXME: use multiple outputs or return actual JRE package # FIXME: use multiple outputs or return actual JRE package
passthru.jre = result; passthru.jre = result;
passthru.home = result; passthru.home = result;
# for backward compatibility
passthru.architecture = "";
meta = with stdenv.lib; { meta = with stdenv.lib; {
license = licenses.gpl2Classpath; license = licenses.gpl2Classpath;
description = "AdoptOpenJDK, prebuilt OpenJDK binary"; description = "AdoptOpenJDK, prebuilt OpenJDK binary";
platforms = stdenv.lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms platforms = lib.mapAttrsToList (arch: _: arch + "-linux") sourcePerArch; # some inherit jre.meta.platforms
maintainers = with stdenv.lib.maintainers; [ taku0 ]; maintainers = with lib.maintainers; [ taku0 ];
}; };
}; in result }; in result

View File

@ -0,0 +1,9 @@
let
sources = builtins.fromJSON (builtins.readFile ./sources.json);
in
{
jdk-hotspot = import ./jdk-darwin-base.nix sources.openjdk8.mac.jdk.hotspot;
jre-hotspot = import ./jdk-darwin-base.nix sources.openjdk8.mac.jre.hotspot;
jdk-openj9 = import ./jdk-darwin-base.nix sources.openjdk8.mac.jdk.openj9;
jre-openj9 = import ./jdk-darwin-base.nix sources.openjdk8.mac.jre.openj9;
}

View File

@ -0,0 +1,9 @@
let
sources = builtins.fromJSON (builtins.readFile ./sources.json);
in
{
jdk-hotspot = import ./jdk-linux-base.nix sources.openjdk8.linux.jdk.hotspot;
jre-hotspot = import ./jdk-linux-base.nix sources.openjdk8.linux.jre.hotspot;
jdk-openj9 = import ./jdk-linux-base.nix sources.openjdk8.linux.jdk.openj9;
jre-openj9 = import ./jdk-linux-base.nix sources.openjdk8.linux.jre.openj9;
}

View File

@ -4,10 +4,10 @@
"jdk": { "jdk": {
"hotspot": { "hotspot": {
"aarch64": { "aarch64": {
"build": "7", "build": "11",
"sha256": "894a846600ddb0df474350037a2fb43e3343dc3606809a20c65e750580d8f2b9", "sha256": "10e33e1862638e11a9158947b3d7b461727d8e396e378b171be1eb4dfe12f1ed",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
}, },
"armv6l": { "armv6l": {
"build": "7", "build": "7",
@ -24,48 +24,48 @@
"packageType": "jdk", "packageType": "jdk",
"vmType": "hotspot", "vmType": "hotspot",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "23cded2b43261016f0f246c85c8948d4a9b7f2d44988f75dad69723a7a526094", "sha256": "90c33cf3f2ed0bd773f648815de7347e69cfbb3416ef3bf41616ab1c4aa0f5a8",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
}, },
"openj9": { "openj9": {
"packageType": "jdk", "packageType": "jdk",
"vmType": "openj9", "vmType": "openj9",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "bb8396b3fbaa160bf2173eadbc83cce50bcd5a0879dc24b4122efb7411370d12", "sha256": "b1099cccc80a3f434728c9bc3b8a90395793b625f4680ca05267cf635143d64d",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7_openj9-0.14.3/OpenJDK11U-jdk_x64_linux_openj9_11.0.3_7_openj9-0.14.3.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11_openj9-0.15.1/OpenJDK11U-jdk_x64_linux_openj9_11.0.4_11_openj9-0.15.1.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
} }
}, },
"jre": { "jre": {
"hotspot": { "hotspot": {
"aarch64": { "aarch64": {
"build": "7", "build": "11",
"sha256": "de31fab70640c6d5099de5fc8fa8b4d6b484a7352fa48a9fafbdc088ca708564", "sha256": "5f7b5c110fc0f344a549cb11784a6d76838061a2b6f654f7841f60e0cd286c6a",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
}, },
"packageType": "jre", "packageType": "jre",
"vmType": "hotspot", "vmType": "hotspot",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "d2df8bc799b09c8375f79bf646747afac3d933bb1f65de71d6c78e7466ff8fe4", "sha256": "70d2cc675155476f1d8516a7ae6729d44681e4fad5a6fc8dfa65cab36a67b7e0",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jre_x64_linux_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
}, },
"openj9": { "openj9": {
"packageType": "jre", "packageType": "jre",
"vmType": "openj9", "vmType": "openj9",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "493a90023447f9f422db011560732cb018795023ed1166dfc04ffa18a4c1fb83", "sha256": "c2601e7cb22af7a910e03883280cee805074656104d6d3dcaaf30e3bbb832690",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7_openj9-0.14.3/OpenJDK11U-jre_x64_linux_openj9_11.0.3_7_openj9-0.14.3.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11_openj9-0.15.1/OpenJDK11U-jre_x64_linux_openj9_11.0.4_11_openj9-0.15.1.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
} }
} }
@ -76,20 +76,20 @@
"packageType": "jdk", "packageType": "jdk",
"vmType": "hotspot", "vmType": "hotspot",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "5ca2a24f1827bd7c110db99854693bf418f51ee3093c31332db5cd605278faad", "sha256": "a50b211f475b9497311c9b65594764d7b852b1653f249582bb20fc3c302846a5",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_mac_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
}, },
"openj9": { "openj9": {
"packageType": "jdk", "packageType": "jdk",
"vmType": "openj9", "vmType": "openj9",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "9217cab0b5dc6301b386ea837d6df38f93adcb5139e5f67a93bb42c3e36df624", "sha256": "7c09678d9c2d9dd0366693c6ab27bed39c76a23e7ac69b8a25c794e99dcf3ba7",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7_openj9-0.14.3/OpenJDK11U-jdk_x64_mac_openj9_11.0.3_7_openj9-0.14.3.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11_openj9-0.15.1/OpenJDK11U-jdk_x64_mac_openj9_11.0.4_11_openj9-0.15.1.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
} }
}, },
@ -98,20 +98,126 @@
"packageType": "jre", "packageType": "jre",
"vmType": "hotspot", "vmType": "hotspot",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "9523b97288ff5d50e404565d346ed8ea8f19dd155092951af88d4be6b8414776", "sha256": "1647fded28d25e562811f7bce2092eb9c21d30608843b04250c023b40604ff26",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_mac_hotspot_11.0.3_7.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jre_x64_mac_hotspot_11.0.4_11.tar.gz",
"version": "11.0.3" "version": "11.0.4"
} }
}, },
"openj9": { "openj9": {
"packageType": "jre", "packageType": "jre",
"vmType": "openj9", "vmType": "openj9",
"x86_64": { "x86_64": {
"build": "7", "build": "11",
"sha256": "eb448ffa9dc1178e0b3c198b87a3f7f2f9fc8a2c036dc066bec1212a9d819971", "sha256": "1a8e84bae517a848aa5f25c7b04f26ab3a3bfffaa7fdf9be24e1f83325e46766",
"url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7_openj9-0.14.3/OpenJDK11U-jre_x64_mac_openj9_11.0.3_7_openj9-0.14.3.tar.gz", "url": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11_openj9-0.15.1/OpenJDK11U-jre_x64_mac_openj9_11.0.4_11_openj9-0.15.1.tar.gz",
"version": "11.0.3" "version": "11.0.4"
}
}
}
}
},
"openjdk8": {
"linux": {
"jdk": {
"hotspot": {
"aarch64": {
"build": "10",
"sha256": "652776586ede124189dc218174b5922cc97feac81021ad81905900b349a352d2",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_aarch64_linux_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
},
"packageType": "jdk",
"vmType": "hotspot",
"x86_64": {
"build": "10",
"sha256": "37356281345b93feb4212e6267109b4409b55b06f107619dde4960e402bafa77",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
}
},
"openj9": {
"packageType": "jdk",
"vmType": "openj9",
"x86_64": {
"build": "10",
"sha256": "20cff719c6de43f8bb58c7f59e251da7c1fa2207897c9a4768c8c669716dc819",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10_openj9-0.15.1/OpenJDK8U-jdk_x64_linux_openj9_8u222b10_openj9-0.15.1.tar.gz",
"version": "8.0.222"
}
}
},
"jre": {
"hotspot": {
"aarch64": {
"build": "10",
"sha256": "dfaf5a121f7606c54bd6232793677a4267eddf65d29cde352b84d84edbccbb51",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jre_aarch64_linux_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
},
"packageType": "jre",
"vmType": "hotspot",
"x86_64": {
"build": "10",
"sha256": "a418ce895c8bf3ca2e7b2f423f038b8b093941684c9430f2e40da0982e12b52d",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jre_x64_linux_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
}
},
"openj9": {
"packageType": "jre",
"vmType": "openj9",
"x86_64": {
"build": "10",
"sha256": "ae56994a7c8e8c19939c0c2ff8fe5a850eb2f23845c499aa5ede26deb3d5ad28",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10_openj9-0.15.1/OpenJDK8U-jre_x64_linux_openj9_8u222b10_openj9-0.15.1.tar.gz",
"version": "8.0.222"
}
}
}
},
"mac": {
"jdk": {
"hotspot": {
"packageType": "jdk",
"vmType": "hotspot",
"x86_64": {
"build": "10",
"sha256": "9605fd00d2960934422437f601c7a9a1c5537309b9199d5bc75f84f20cd29a76",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_mac_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
}
},
"openj9": {
"packageType": "jdk",
"vmType": "openj9",
"x86_64": {
"build": "10",
"sha256": "df185e167756332163633a826b329db067f8a721f7d5d27f0b353a35fc415de0",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10_openj9-0.15.1/OpenJDK8U-jdk_x64_mac_openj9_8u222b10_openj9-0.15.1.tar.gz",
"version": "8.0.222"
}
}
},
"jre": {
"hotspot": {
"packageType": "jre",
"vmType": "hotspot",
"x86_64": {
"build": "10",
"sha256": "b3ac2436534cea932ccf665b317dbf5ffc0ee065efca808b22b6c2d795ca1b90",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jre_x64_mac_hotspot_8u222b10.tar.gz",
"version": "8.0.222"
}
},
"openj9": {
"packageType": "jre",
"vmType": "openj9",
"x86_64": {
"build": "10",
"sha256": "d5754413d7bc3a3233aaa7f8465451fbdabaf2a0c2a91743155bf135a3047ec8",
"url": "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10_openj9-0.15.1/OpenJDK8U-jre_x64_mac_openj9_8u222b10_openj9-0.15.1.tar.gz",
"version": "8.0.222"
} }
} }
} }

View File

@ -7262,6 +7262,24 @@ in
then callPackage adoptopenjdk-bin-11-packages-linux.jre-openj9 {} then callPackage adoptopenjdk-bin-11-packages-linux.jre-openj9 {}
else callPackage adoptopenjdk-bin-11-packages-darwin.jre-openj9 {}; else callPackage adoptopenjdk-bin-11-packages-darwin.jre-openj9 {};
adoptopenjdk-bin-8-packages-linux = import ../development/compilers/adoptopenjdk-bin/jdk8-linux.nix;
adoptopenjdk-bin-8-packages-darwin = import ../development/compilers/adoptopenjdk-bin/jdk8-darwin.nix;
adoptopenjdk-hotspot-bin-8 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-8-packages-linux.jdk-hotspot {}
else callPackage adoptopenjdk-bin-8-packages-darwin.jdk-hotspot {};
adoptopenjdk-jre-hotspot-bin-8 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-8-packages-linux.jre-hotspot {}
else callPackage adoptopenjdk-bin-8-packages-darwin.jre-hotspot {};
adoptopenjdk-openj9-bin-8 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-8-packages-linux.jdk-openj9 {}
else callPackage adoptopenjdk-bin-8-packages-darwin.jdk-openj9 {};
adoptopenjdk-jre-openj9-bin-8 = if stdenv.isLinux
then callPackage adoptopenjdk-bin-8-packages-linux.jre-openj9 {}
else callPackage adoptopenjdk-bin-8-packages-darwin.jre-openj9 {};
adoptopenjdk-bin = adoptopenjdk-hotspot-bin-11; adoptopenjdk-bin = adoptopenjdk-hotspot-bin-11;
adoptopenjdk-jre-bin = adoptopenjdk-jre-hotspot-bin-11; adoptopenjdk-jre-bin = adoptopenjdk-jre-hotspot-bin-11;