lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 16.09-beta 241 lines 7.9 kB view raw
1{ stdenv, fetchurl, unzip, zip, procps, coreutils, alsaLib, ant, freetype 2, which, bootjdk, nettools, xorg, file, cups 3, fontconfig, cpio, cacert, perl, setJavaClassPath 4, minimal ? false 5}: 6 7let 8 9 /** 10 * The JRE libraries are in directories that depend on the CPU. 11 */ 12 architecture = 13 if stdenv.system == "i686-linux" then 14 "i386" 15 else if stdenv.system == "x86_64-linux" then 16 "amd64" 17 else 18 throw "openjdk requires i686-linux or x86_64 linux"; 19 20 update = "91"; 21 22 build = "01"; 23 24 # On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well. 25 paxflags = if stdenv.isi686 then "msp" else "m"; 26 27 baseurl = "http://hg.openjdk.java.net/jdk7u/jdk7u"; 28 repover = "jdk7u${update}-b${build}"; 29 jdk7 = fetchurl { 30 url = "${baseurl}/archive/${repover}.tar.gz"; 31 sha256 = "08f7cbayyrryim3xbrs12cr12i1mczcikyc9rdlsyih0r4xvll28"; 32 }; 33 langtools = fetchurl { 34 url = "${baseurl}/langtools/archive/${repover}.tar.gz"; 35 sha256 = "0rmlzrgsacn60blpg1sp30k6p0sgzsml8wb41yc998km1bsnjxnh"; 36 }; 37 hotspot = fetchurl { 38 url = "${baseurl}/hotspot/archive/${repover}.tar.gz"; 39 sha256 = "1w1n81y9jcvjzssl4049yzfc0gdfnh73ki6wg1d8pg22zlyhrrwv"; 40 }; 41 corba = fetchurl { 42 url = "${baseurl}/corba/archive/${repover}.tar.gz"; 43 sha256 = "086yr927bxnlgljx7mw2cg6f6aip57hi4qpn1h35n6fsyvb4n67h"; 44 }; 45 jdk = fetchurl { 46 url = "${baseurl}/jdk/archive/${repover}.tar.gz"; 47 sha256 = "14r39ylj3qa63arpqxl0h84baah1kjgnyp3v9d7d4vd0yagpn66b"; 48 }; 49 jaxws = fetchurl { 50 url = "${baseurl}/jaxws/archive/${repover}.tar.gz"; 51 sha256 = "1p1739gb5gx9m4sm3i4javfk9lk41wnz92k6gis6sq99dd1bj1l5"; 52 }; 53 jaxp = fetchurl { 54 url = "${baseurl}/jaxp/archive/${repover}.tar.gz"; 55 sha256 = "1nl3kmbwqhhymcp25rnmf5mr3dn87lgdxvz9wgng7if6yqxlyakq"; 56 }; 57 openjdk = stdenv.mkDerivation rec { 58 name = "openjdk-7u${update}b${build}"; 59 60 srcs = [ jdk7 langtools hotspot corba jdk jaxws jaxp ]; 61 sourceRoot = "."; 62 63 outputs = [ "out" "jre" ]; 64 65 buildInputs = 66 [ unzip procps ant which zip cpio nettools alsaLib 67 xorg.libX11 xorg.libXt xorg.libXext xorg.libXrender xorg.libXtst 68 xorg.libXi xorg.libXinerama xorg.libXcursor xorg.lndir 69 fontconfig perl file bootjdk 70 ]; 71 72 NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; 73 74 NIX_LDFLAGS = if minimal then null else "-lfontconfig -lXcursor -lXinerama"; 75 76 postUnpack = '' 77 ls | grep jdk | grep -v '^jdk7u' | awk -F- '{print $1}' | while read p; do 78 mv $p-* $(ls | grep '^jdk7u')/$p 79 done 80 cd jdk7u-* 81 82 sed -i -e "s@/usr/bin/test@${coreutils}/bin/test@" \ 83 -e "s@/bin/ls@${coreutils}/bin/ls@" \ 84 hotspot/make/linux/makefiles/sa.make 85 86 sed -i "s@/bin/echo -e@${coreutils}/bin/echo -e@" \ 87 {jdk,corba}/make/common/shared/Defs-utils.gmk 88 89 tar xf ${cups.src} 90 cupsDir=$(echo $(pwd)/cups-*) 91 makeFlagsArray+=(CUPS_HEADERS_PATH=$cupsDir) 92 ''; 93 94 patches = [ 95 ./cppflags-include-fix.patch 96 ./fix-java-home.patch 97 ./paxctl.patch 98 ./read-truststore-from-env.patch 99 ./currency-date-range.patch 100 ]; 101 102 NIX_NO_SELF_RPATH = true; 103 104 makeFlags = [ 105 "SORT=${coreutils}/bin/sort" 106 "ALSA_INCLUDE=${alsaLib.dev}/include/alsa/version.h" 107 "FREETYPE_HEADERS_PATH=${freetype.dev}/include" 108 "FREETYPE_LIB_PATH=${freetype.out}/lib" 109 "MILESTONE=${update}" 110 "BUILD_NUMBER=b${build}" 111 "USRBIN_PATH=" 112 "COMPILER_PATH=" 113 "DEVTOOLS_PATH=" 114 "UNIXCOMMAND_PATH=" 115 "BOOTDIR=${bootjdk.home}" 116 "STATIC_CXX=false" 117 "UNLIMITED_CRYPTO=1" 118 "FULL_DEBUG_SYMBOLS=0" 119 ] ++ stdenv.lib.optional minimal "BUILD_HEADLESS=1"; 120 121 configurePhase = "true"; 122 123 preBuild = '' 124 # We also need to PaX-mark in the middle of the build 125 substituteInPlace hotspot/make/linux/makefiles/launcher.make \ 126 --replace XXX_PAXFLAGS_XXX ${paxflags} 127 substituteInPlace jdk/make/common/Program.gmk \ 128 --replace XXX_PAXFLAGS_XXX ${paxflags} 129 ''; 130 131 installPhase = '' 132 mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk 133 134 cp -av build/*/j2sdk-image/* $out/lib/openjdk 135 136 # Move some stuff to top-level. 137 mv $out/lib/openjdk/include $out/include 138 mv $out/lib/openjdk/man $out/share/man 139 140 # jni.h expects jni_md.h to be in the header search path. 141 ln -s $out/include/linux/*_md.h $out/include/ 142 143 # Remove some broken manpages. 144 rm -rf $out/share/man/ja* 145 146 # Remove crap from the installation. 147 rm -rf $out/lib/openjdk/demo $out/lib/openjdk/sample 148 149 # Move the JRE to a separate output. 150 mv $out/lib/openjdk/jre $jre/lib/openjdk/ 151 mkdir $out/lib/openjdk/jre 152 lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre 153 154 rm -rf $out/lib/openjdk/jre/bin 155 ln -s $out/lib/openjdk/bin $out/lib/openjdk/jre/bin 156 157 # Set PaX markings 158 exes=$(file $out/lib/openjdk/bin/* $jre/lib/openjdk/jre/bin/* 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//') 159 echo "to mark: *$exes*" 160 for file in $exes; do 161 echo "marking *$file*" 162 paxmark ${paxflags} "$file" 163 done 164 165 # Remove duplicate binaries. 166 for i in $(cd $out/lib/openjdk/bin && echo *); do 167 if [ "$i" = java ]; then continue; fi 168 if cmp -s $out/lib/openjdk/bin/$i $jre/lib/openjdk/jre/bin/$i; then 169 ln -sfn $jre/lib/openjdk/jre/bin/$i $out/lib/openjdk/bin/$i 170 fi 171 done 172 173 # Generate certificates. 174 pushd $jre/lib/openjdk/jre/lib/security 175 rm cacerts 176 perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt 177 popd 178 179 ln -s $out/lib/openjdk/bin $out/bin 180 ln -s $jre/lib/openjdk/jre/bin $jre/bin 181 ''; # */ 182 183 # FIXME: this is unnecessary once the multiple-outputs branch is merged. 184 preFixup = '' 185 prefix=$jre stripDirs "$stripDebugList" "''${stripDebugFlags:--S}" 186 patchELF $jre 187 propagatedNativeBuildInputs+=" $jre" 188 189 # Propagate the setJavaClassPath setup hook from the JRE so that 190 # any package that depends on the JRE has $CLASSPATH set up 191 # properly. 192 mkdir -p $jre/nix-support 193 echo -n "${setJavaClassPath}" > $jre/nix-support/propagated-native-build-inputs 194 195 # Set JAVA_HOME automatically. 196 mkdir -p $out/nix-support 197 cat <<EOF > $out/nix-support/setup-hook 198 if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi 199 EOF 200 ''; 201 202 postFixup = '' 203 # Build the set of output library directories to rpath against 204 LIBDIRS="" 205 for output in $outputs; do 206 LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':'):$LIBDIRS" 207 done 208 209 # Add the local library paths to remove dependencies on the bootstrap 210 for output in $outputs; do 211 OUTPUTDIR="$(eval echo \$$output)" 212 BINLIBS="$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)" 213 echo "$BINLIBS" | while read i; do 214 patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true 215 patchelf --shrink-rpath "$i" || true 216 done 217 done 218 219 # Test to make sure that we don't depend on the bootstrap 220 for output in $outputs; do 221 if grep -q -r '${bootjdk}' $(eval echo \$$output); then 222 echo "Extraneous references to ${bootjdk} detected" 223 exit 1 224 fi 225 done 226 ''; 227 228 meta = { 229 homepage = http://openjdk.java.net/; 230 license = stdenv.lib.licenses.gpl2; 231 description = "The open-source Java Development Kit"; 232 maintainers = [ stdenv.lib.maintainers.eelco ]; 233 platforms = stdenv.lib.platforms.linux; 234 }; 235 236 passthru = { 237 inherit architecture; 238 home = "${openjdk}/lib/openjdk"; 239 }; 240 }; 241in openjdk