lol
0
fork

Configure Feed

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

at 24.05-pre 180 lines 6.3 kB view raw
1{ stdenv, lib, fetchurl, fetchFromGitHub, bash, pkg-config, autoconf, cpio 2, file, which, unzip, zip, perl, cups, freetype, alsa-lib, libjpeg, giflib 3, libpng, zlib, lcms2, libX11, libICE, libXrender, libXext, libXt, libXtst 4, libXi, libXinerama, libXcursor, libXrandr, fontconfig, openjdk16-bootstrap 5, setJavaClassPath 6, headless ? false 7, enableJavaFX ? false, openjfx 8, enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf 9}: 10 11let 12 version = { 13 feature = "16"; 14 interim = "0"; 15 build = "36"; 16 }; 17 18 # when building a headless jdk, also bootstrap it with a headless jdk 19 openjdk-bootstrap = openjdk16-bootstrap.override { gtkSupport = !headless; }; 20 21 openjdk = stdenv.mkDerivation { 22 pname = "openjdk" + lib.optionalString headless "-headless"; 23 version = "${version.feature}+${version.build}"; 24 25 src = fetchFromGitHub { 26 owner = "openjdk"; 27 repo = "jdk${version.feature}u"; 28 rev = "jdk-${version.feature}+${version.build}"; 29 sha256 = "165nr15dqfcxzsl5z95g4iklln4rlfkgdigdma576mx8813ldi44"; 30 }; 31 32 nativeBuildInputs = [ pkg-config autoconf unzip ]; 33 buildInputs = [ 34 cpio file which zip perl zlib cups freetype alsa-lib libjpeg giflib 35 libpng zlib lcms2 libX11 libICE libXrender libXext libXtst libXt libXtst 36 libXi libXinerama libXcursor libXrandr fontconfig openjdk-bootstrap 37 ] ++ lib.optionals (!headless && enableGnome2) [ 38 gtk3 gnome_vfs GConf glib 39 ]; 40 41 patches = [ 42 ./fix-java-home-jdk10.patch 43 ./read-truststore-from-env-jdk10.patch 44 ./currency-date-range-jdk10.patch 45 ./increase-javadoc-heap-jdk13.patch 46 # -Wformat etc. are stricter in newer gccs, per 47 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 48 # so grab the work-around from 49 # https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24 50 (fetchurl { 51 url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch"; 52 sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r"; 53 }) 54 ./fix-glibc-2.34.patch 55 ] ++ lib.optionals (!headless && enableGnome2) [ 56 ./swing-use-gtk-jdk13.patch 57 ]; 58 59 prePatch = '' 60 chmod +x configure 61 patchShebangs --build configure 62 ''; 63 64 # JDK's build system attempts to specifically detect 65 # and special-case WSL, and we don't want it to do that, 66 # so pass the correct platform names explicitly 67 configurePlatforms = ["build" "host"]; 68 69 configureFlags = [ 70 "--with-boot-jdk=${openjdk-bootstrap.home}" 71 "--with-version-build=${version.build}" 72 "--with-version-opt=nixos" 73 "--with-version-pre=" 74 "--enable-unlimited-crypto" 75 "--with-native-debug-symbols=internal" 76 "--with-freetype=system" 77 "--with-libjpeg=system" 78 "--with-giflib=system" 79 "--with-libpng=system" 80 "--with-zlib=system" 81 "--with-lcms=system" 82 "--with-stdc++lib=dynamic" 83 ] ++ lib.optional headless "--enable-headless-only" 84 ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}"; 85 86 separateDebugInfo = true; 87 88 env.NIX_CFLAGS_COMPILE = "-Wno-error"; 89 90 NIX_LDFLAGS = toString (lib.optionals (!headless) [ 91 "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic" 92 ] ++ lib.optionals (!headless && enableGnome2) [ 93 "-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2" 94 ]); 95 96 # -j flag is explicitly rejected by the build system: 97 # Error: 'make -jN' is not supported, use 'make JOBS=N' 98 # Note: it does not make build sequential. Build system 99 # still runs in parallel. 100 enableParallelBuilding = false; 101 102 buildFlags = [ "all" ]; 103 104 postBuild = '' 105 cd build/linux* 106 make images 107 cd - 108 ''; 109 110 installPhase = '' 111 mkdir -p $out/lib 112 113 mv build/*/images/jdk $out/lib/openjdk 114 115 # Remove some broken manpages. 116 rm -rf $out/lib/openjdk/man/ja* 117 118 # Mirror some stuff in top-level. 119 mkdir -p $out/share 120 ln -s $out/lib/openjdk/include $out/include 121 ln -s $out/lib/openjdk/man $out/share/man 122 ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip 123 124 # jni.h expects jni_md.h to be in the header search path. 125 ln -s $out/include/linux/*_md.h $out/include/ 126 127 # Remove crap from the installation. 128 rm -rf $out/lib/openjdk/demo 129 ${lib.optionalString headless '' 130 rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so 131 ''} 132 133 ln -s $out/lib/openjdk/bin $out/bin 134 ''; 135 136 preFixup = '' 137 # Propagate the setJavaClassPath setup hook so that any package 138 # that depends on the JDK has $CLASSPATH set up properly. 139 mkdir -p $out/nix-support 140 #TODO or printWords? cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040 141 echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs 142 143 # Set JAVA_HOME automatically. 144 mkdir -p $out/nix-support 145 cat <<EOF > $out/nix-support/setup-hook 146 if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi 147 EOF 148 ''; 149 150 postFixup = '' 151 # Build the set of output library directories to rpath against 152 LIBDIRS="" 153 for output in $(getAllOutputNames); do 154 if [ "$output" = debug ]; then continue; fi 155 LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS" 156 done 157 # Add the local library paths to remove dependencies on the bootstrap 158 for output in $(getAllOutputNames); do 159 if [ "$output" = debug ]; then continue; fi 160 OUTPUTDIR=$(eval echo \$$output) 161 BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*) 162 echo "$BINLIBS" | while read i; do 163 patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true 164 patchelf --shrink-rpath "$i" || true 165 done 166 done 167 ''; 168 169 disallowedReferences = [ openjdk-bootstrap ]; 170 171 pos = builtins.unsafeGetAttrPos "feature" version; 172 meta = import ./meta.nix lib version.feature; 173 174 passthru = { 175 architecture = ""; 176 home = "${openjdk}/lib/openjdk"; 177 inherit gtk3; 178 }; 179 }; 180in openjdk