diff --git a/pkgs/development/compilers/jdk/builder.sh b/pkgs/development/compilers/jdk/builder.sh old mode 100755 new mode 100644 index ae3ae055b839..cc70c09b3c85 --- a/pkgs/development/compilers/jdk/builder.sh +++ b/pkgs/development/compilers/jdk/builder.sh @@ -1,29 +1,38 @@ -#!/bin/sh +source $stdenv/setup -. $stdenv/setup || exit 1 src=$filename.bin -cp $pathname $src || exit 1 +if ! test -e "$pathname"; then + echo "" + echo "SORRY!" + echo "You should download \`$(basename $pathname)' from Sun and place it in $(dirname $pathname)." + echo "Blame Sun, not us." + echo "" + exit 1 +fi -actual=$(md5sum -b $src | cut -c1-32) +actual=$(md5sum -b $pathname | cut -c1-32) if test "$actual" != "$md5"; then echo "hash is $actual, expected $md5" exit 1 fi -chmod u+x $src || exit 1 +unzip $pathname || true -alias more=cat +ensureDir $out +mv $dirname/* $out/ -yes yes | ./$src || exit 1 - -mkdir $out || exit 1 -mv $dirname/* $out/ || exit 1 - -# remove crap in the root directory +# Remove crap in the root directory. for file in $out/* do if test -f $file ; then rm $file fi done + +# Unpack .pack files. +for i in $(find $out -name "*.pack"); do + echo "unpacking $i..." + $out/bin/unpack200 "$i" "$(dirname $i)/$(basename $i .pack).jar" + rm "$i" +done diff --git a/pkgs/development/compilers/jdk/default.nix b/pkgs/development/compilers/jdk/default.nix index ccfd88bb92ae..060d270fb081 100644 --- a/pkgs/development/compilers/jdk/default.nix +++ b/pkgs/development/compilers/jdk/default.nix @@ -1,9 +1,9 @@ -{stdenv, fetchurl}: +{stdenv, fetchurl, unzip}: if stdenv.system == "i686-linux" then (import ./jdk5-sun-linux.nix) { - inherit stdenv fetchurl; + inherit stdenv fetchurl unzip; } else false diff --git a/pkgs/development/compilers/jdk/jdk5-sun-linux.nix b/pkgs/development/compilers/jdk/jdk5-sun-linux.nix index 81ed02232843..3160ad24bbcf 100644 --- a/pkgs/development/compilers/jdk/jdk5-sun-linux.nix +++ b/pkgs/development/compilers/jdk/jdk5-sun-linux.nix @@ -8,17 +8,16 @@ * * @author Martin Bravenboer */ -{stdenv, fetchurl}: +{stdenv, fetchurl, unzip}: assert stdenv.system == "i686-linux"; -derivation { +stdenv.mkDerivation { name = "jdk-1.5.0"; + builder = ./builder.sh; filename = "jdk-1_5_0_05"; dirname = "jdk1.5.0_05"; - system = stdenv.system; - builder = ./builder.sh; pathname = "/tmp/jdk-1_5_0_05-linux-i586.bin"; md5 = "2f83bf2a38fff1f8ac51b02ec7391ca3"; - stdenv = stdenv; + buildInputs = [unzip]; } diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix index 392741ea95a6..be95cfb6fdca 100644 --- a/pkgs/system/all-packages-generic.nix +++ b/pkgs/system/all-packages-generic.nix @@ -506,7 +506,7 @@ rec { "/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home" else (import ../development/compilers/jdk) { - inherit fetchurl stdenv; + inherit fetchurl stdenv unzip; }; j2sdk14x = (import ../development/compilers/jdk/default-1.4.nix) {