Loading maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -15489,6 +15489,12 @@ githubId = 69053978; name = "rogarb"; }; rollf = { email = "rolf.schroeder@limbus-medtec.com"; github = "rollf"; githubId = 58295931; name = "Rolf Schröder"; }; roman = { email = "open-source@roman-gonzalez.info"; github = "roman"; Loading pkgs/development/compilers/corretto/11.nix 0 → 100644 +37 −0 Original line number Diff line number Diff line { corretto11 , fetchFromGitHub , gradle_7 , jdk11 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk11; gradle = gradle_7; version = "11.0.20.9.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-11"; rev = "b880bdc8397ec3dd6b7cd4b837ce846c9e902783"; sha256 = "sha256-IomJHQn0ZgqsBZ5BrRqVrEOhTq7wjLiIKMQlz53JxsU="; }; }; in corretto.overrideAttrs (oldAttrs: { # jdk11 is built with --disable-warnings-as-errors (see openjdk/11.nix) # because of several compile errors. We need to include this parameter for # Corretto, too. Since the build is invoked via `gradle` build.gradle has to # be adapted. postPatch = oldAttrs.postPatch + '' for file in $(find installers -name "build.gradle"); do substituteInPlace $file --replace "command += archSpecificFlags" "command += archSpecificFlags + ['--disable-warnings-as-errors']" done ''; }) pkgs/development/compilers/corretto/17.nix 0 → 100644 +26 −0 Original line number Diff line number Diff line { corretto17 , fetchFromGitHub , gradle_7 , jdk17 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk17; gradle = gradle_7; version = "17.0.8.8.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-17"; rev = "9a3cc984f76cb5f90598bdb43215bad20e0f7319"; sha256 = "sha256-/VuB3ocD5VvDqCU7BoTG+fQ0aKvK1TejegRYmswInqQ="; }; }; in corretto pkgs/development/compilers/corretto/19.nix 0 → 100644 +26 −0 Original line number Diff line number Diff line { corretto19 , fetchFromGitHub , gradle_7 , jdk19 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk19; gradle = gradle_7; version = "19.0.2.7.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-19"; rev = "72f064a1d716272bd17d4e425d4a264b2c2c7d36"; sha256 = "sha256-mEj/MIbdXU0+fF5RhqjPuSeyclstesGaXB0e48YlKuw="; }; }; in corretto pkgs/development/compilers/corretto/mk-corretto.nix 0 → 100644 +115 −0 Original line number Diff line number Diff line { jdk , version , src , lib , stdenv , gradle , rsync , runCommand , testers }: # Each Corretto version is based on a corresponding OpenJDK version. So # building Corretto is more or less the same as building OpenJDK. Hence, the # Corretto derivation overrides the corresponding OpenJDK derivation in order # to have access to all the version-specific fixes for the various OpenJDK # builds. However, Corretto uses `gradle` as build tool (which in turn will # invoke `make`). The configure/build phases are adapted as needed. let pname = "corretto"; # The version scheme is different between OpenJDK & Corretto. # See https://github.com/corretto/corretto-17/blob/release-17.0.8.8.1/build.gradle#L40 # "major.minor.security.build.revision" in jdk.overrideAttrs (finalAttrs: oldAttrs: { inherit pname version src; name = "${pname}-${version}"; nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ jdk gradle rsync ]; dontConfigure = true; postPatch = '' # The rpm/deb task definitions require a Gradle plugin which we don't # have and so the build fails. We'll simply remove them here because # they are not needed anyways. rm -rf installers/linux/universal/{rpm,deb} # `/usr/bin/rsync` is invoked to copy the source tree. We don't have that. for file in $(find installers -name "build.gradle"); do substituteInPlace $file --replace "workingDir '/usr/bin'" "workingDir '.'" done ''; buildPhase = let # The Linux installer is placed at linux/universal/tar whereas the MacOS # one is at mac/tar. task = if stdenv.isDarwin then ":installers:mac:tar:packageBuildResults" else ":installers:linux:universal:tar:packageBuildResults"; in '' runHook preBuild # Corretto's actual built is triggered via `gradle`. gradle --console=plain --no-daemon ${task} # Prepare for the installPhase so that it looks like if a normal # OpenJDK had been built. dir=build/jdkImageName/images mkdir -p $dir file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz') tar -xzf $file -C $dir mv $dir/amazon-corretto-* $dir/jdk runHook postBuild ''; installPhase = oldAttrs.installPhase + '' # The installPhase will place everything in $out/lib/openjdk and # reference through symlinks. We don't rewrite the installPhase but at # least move the folder to convey that this is not OpenJDK anymore. mv $out/lib/openjdk $out/lib/corretto ln -s $out/lib/corretto $out/lib/openjdk ''; passthru = let pkg = finalAttrs.finalPackage; in oldAttrs.passthru // { tests = { version = testers.testVersion { package = pkg; }; vendor = runCommand "${pname}-vendor" { nativeBuildInputs = [ pkg ]; } '' output=$(${pkg.meta.mainProgram} -XshowSettings:properties -version 2>&1 | grep vendor) grep -Fq "java.vendor = Amazon.com Inc." - <<< "$output" && touch $out ''; compiler = runCommand "${pname}-compiler" { nativeBuildInputs = [ pkg ]; } '' cat << EOF > Main.java class Main { public static void main(String[] args) { System.out.println("Hello, World!"); } } EOF ${pkg}/bin/javac Main.java ${pkg}/bin/java Main | grep -q "Hello, World!" && touch $out ''; }; }; meta = with lib; { homepage = "https://aws.amazon.com/corretto"; license = licenses.gpl2Only; description = "Amazon's distribution of OpenJDK"; platforms = jdk.meta.platforms; mainProgram = "java"; maintainers = with maintainers; [ rollf ]; }; }) Loading
maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -15489,6 +15489,12 @@ githubId = 69053978; name = "rogarb"; }; rollf = { email = "rolf.schroeder@limbus-medtec.com"; github = "rollf"; githubId = 58295931; name = "Rolf Schröder"; }; roman = { email = "open-source@roman-gonzalez.info"; github = "roman"; Loading
pkgs/development/compilers/corretto/11.nix 0 → 100644 +37 −0 Original line number Diff line number Diff line { corretto11 , fetchFromGitHub , gradle_7 , jdk11 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk11; gradle = gradle_7; version = "11.0.20.9.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-11"; rev = "b880bdc8397ec3dd6b7cd4b837ce846c9e902783"; sha256 = "sha256-IomJHQn0ZgqsBZ5BrRqVrEOhTq7wjLiIKMQlz53JxsU="; }; }; in corretto.overrideAttrs (oldAttrs: { # jdk11 is built with --disable-warnings-as-errors (see openjdk/11.nix) # because of several compile errors. We need to include this parameter for # Corretto, too. Since the build is invoked via `gradle` build.gradle has to # be adapted. postPatch = oldAttrs.postPatch + '' for file in $(find installers -name "build.gradle"); do substituteInPlace $file --replace "command += archSpecificFlags" "command += archSpecificFlags + ['--disable-warnings-as-errors']" done ''; })
pkgs/development/compilers/corretto/17.nix 0 → 100644 +26 −0 Original line number Diff line number Diff line { corretto17 , fetchFromGitHub , gradle_7 , jdk17 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk17; gradle = gradle_7; version = "17.0.8.8.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-17"; rev = "9a3cc984f76cb5f90598bdb43215bad20e0f7319"; sha256 = "sha256-/VuB3ocD5VvDqCU7BoTG+fQ0aKvK1TejegRYmswInqQ="; }; }; in corretto
pkgs/development/compilers/corretto/19.nix 0 → 100644 +26 −0 Original line number Diff line number Diff line { corretto19 , fetchFromGitHub , gradle_7 , jdk19 , lib , stdenv , rsync , runCommand , testers }: let corretto = import ./mk-corretto.nix { inherit lib stdenv rsync runCommand testers; jdk = jdk19; gradle = gradle_7; version = "19.0.2.7.1"; src = fetchFromGitHub { owner = "corretto"; repo = "corretto-19"; rev = "72f064a1d716272bd17d4e425d4a264b2c2c7d36"; sha256 = "sha256-mEj/MIbdXU0+fF5RhqjPuSeyclstesGaXB0e48YlKuw="; }; }; in corretto
pkgs/development/compilers/corretto/mk-corretto.nix 0 → 100644 +115 −0 Original line number Diff line number Diff line { jdk , version , src , lib , stdenv , gradle , rsync , runCommand , testers }: # Each Corretto version is based on a corresponding OpenJDK version. So # building Corretto is more or less the same as building OpenJDK. Hence, the # Corretto derivation overrides the corresponding OpenJDK derivation in order # to have access to all the version-specific fixes for the various OpenJDK # builds. However, Corretto uses `gradle` as build tool (which in turn will # invoke `make`). The configure/build phases are adapted as needed. let pname = "corretto"; # The version scheme is different between OpenJDK & Corretto. # See https://github.com/corretto/corretto-17/blob/release-17.0.8.8.1/build.gradle#L40 # "major.minor.security.build.revision" in jdk.overrideAttrs (finalAttrs: oldAttrs: { inherit pname version src; name = "${pname}-${version}"; nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ jdk gradle rsync ]; dontConfigure = true; postPatch = '' # The rpm/deb task definitions require a Gradle plugin which we don't # have and so the build fails. We'll simply remove them here because # they are not needed anyways. rm -rf installers/linux/universal/{rpm,deb} # `/usr/bin/rsync` is invoked to copy the source tree. We don't have that. for file in $(find installers -name "build.gradle"); do substituteInPlace $file --replace "workingDir '/usr/bin'" "workingDir '.'" done ''; buildPhase = let # The Linux installer is placed at linux/universal/tar whereas the MacOS # one is at mac/tar. task = if stdenv.isDarwin then ":installers:mac:tar:packageBuildResults" else ":installers:linux:universal:tar:packageBuildResults"; in '' runHook preBuild # Corretto's actual built is triggered via `gradle`. gradle --console=plain --no-daemon ${task} # Prepare for the installPhase so that it looks like if a normal # OpenJDK had been built. dir=build/jdkImageName/images mkdir -p $dir file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz') tar -xzf $file -C $dir mv $dir/amazon-corretto-* $dir/jdk runHook postBuild ''; installPhase = oldAttrs.installPhase + '' # The installPhase will place everything in $out/lib/openjdk and # reference through symlinks. We don't rewrite the installPhase but at # least move the folder to convey that this is not OpenJDK anymore. mv $out/lib/openjdk $out/lib/corretto ln -s $out/lib/corretto $out/lib/openjdk ''; passthru = let pkg = finalAttrs.finalPackage; in oldAttrs.passthru // { tests = { version = testers.testVersion { package = pkg; }; vendor = runCommand "${pname}-vendor" { nativeBuildInputs = [ pkg ]; } '' output=$(${pkg.meta.mainProgram} -XshowSettings:properties -version 2>&1 | grep vendor) grep -Fq "java.vendor = Amazon.com Inc." - <<< "$output" && touch $out ''; compiler = runCommand "${pname}-compiler" { nativeBuildInputs = [ pkg ]; } '' cat << EOF > Main.java class Main { public static void main(String[] args) { System.out.println("Hello, World!"); } } EOF ${pkg}/bin/javac Main.java ${pkg}/bin/java Main | grep -q "Hello, World!" && touch $out ''; }; }; meta = with lib; { homepage = "https://aws.amazon.com/corretto"; license = licenses.gpl2Only; description = "Amazon's distribution of OpenJDK"; platforms = jdk.meta.platforms; mainProgram = "java"; maintainers = with maintainers; [ rollf ]; }; })