Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 156 lines 4.9 kB view raw
1{ lib, stdenv, fetchurl, makeFontsConf 2, cacert 3, cairo, coreutils, fontconfig, freefont_ttf 4, glib, gmp 5, gtk3 6, glibcLocales 7, libedit, libffi 8, libiconv 9, libGL 10, libGLU 11, libjpeg 12, xorg 13, ncurses 14, libpng, libtool, mpfr, openssl, pango, poppler 15, readline, sqlite 16, disableDocs ? false 17, CoreFoundation 18, gsettings-desktop-schemas 19, wrapGAppsHook 20}: 21 22let 23 24 fontsConf = makeFontsConf { 25 fontDirectories = [ freefont_ttf ]; 26 }; 27 28 libPath = lib.makeLibraryPath [ 29 cairo 30 fontconfig 31 glib 32 gmp 33 gtk3 34 gsettings-desktop-schemas 35 libedit 36 libGL 37 libGLU 38 libjpeg 39 libpng 40 mpfr 41 ncurses 42 openssl 43 pango 44 poppler 45 readline 46 sqlite 47 ]; 48 49in 50 51stdenv.mkDerivation rec { 52 pname = "racket"; 53 version = "8.9"; # always change at once with ./minimal.nix 54 55 src = (lib.makeOverridable ({ name, sha256 }: 56 fetchurl { 57 url = "https://mirror.racket-lang.org/installers/${version}/${name}-src.tgz"; 58 inherit sha256; 59 } 60 )) { 61 name = "${pname}-${version}"; 62 sha256 = "sha256-OuIl6E4Rn0zRpH8bFhM1aPx9NcKQxQVJVWbZ3M78UiQ="; 63 }; 64 65 FONTCONFIG_FILE = fontsConf; 66 LD_LIBRARY_PATH = libPath; 67 NIX_LDFLAGS = lib.concatStringsSep " " [ 68 (lib.optionalString (stdenv.cc.isGNU && ! stdenv.isDarwin) "-lgcc_s") 69 ]; 70 71 nativeBuildInputs = [ cacert wrapGAppsHook ]; 72 73 buildInputs = [ fontconfig libffi libtool sqlite gsettings-desktop-schemas gtk3 ncurses ] 74 ++ lib.optionals stdenv.isDarwin [ libiconv CoreFoundation ]; 75 76 patches = [ 77 # Hardcode variant detection because we wrap the Racket binary making it 78 # fail to detect its variant at runtime. 79 # See: https://github.com/NixOS/nixpkgs/issues/114993#issuecomment-812951247 80 ./force-cs-variant.patch 81 82 # The entry point binary $out/bin/racket is codesigned at least once. The 83 # following error is triggered as a result. 84 # (error 'add-ad-hoc-signature "file already has a signature") 85 # We always remove the existing signature then call add-ad-hoc-signature to 86 # circumvent this error. 87 ./force-remove-codesign-then-add.patch 88 ]; 89 90 preConfigure = '' 91 unset AR 92 for f in src/lt/configure src/cs/c/configure src/bc/src/string.c; do 93 substituteInPlace "$f" \ 94 --replace /usr/bin/uname ${coreutils}/bin/uname \ 95 --replace /bin/cp ${coreutils}/bin/cp \ 96 --replace /bin/ln ${coreutils}/bin/ln \ 97 --replace /bin/rm ${coreutils}/bin/rm \ 98 --replace /bin/true ${coreutils}/bin/true 99 done 100 101 # The configure script forces using `libtool -o` as AR on Darwin. But, the 102 # `-o` option is only available from Apple libtool. GNU ar works here. 103 substituteInPlace src/ChezScheme/zlib/configure \ 104 --replace 'ARFLAGS="-o"' 'AR=ar; ARFLAGS="rc"' 105 106 mkdir src/build 107 cd src/build 108 109 '' + lib.optionalString stdenv.isLinux '' 110 gappsWrapperArgs+=("--prefix" "LD_LIBRARY_PATH" ":" ${libPath}) 111 gappsWrapperArgs+=("--set" "LOCALE_ARCHIVE" "${glibcLocales}/lib/locale/locale-archive") 112 '' + lib.optionalString stdenv.isDarwin '' 113 gappsWrapperArgs+=("--prefix" "DYLD_LIBRARY_PATH" ":" ${libPath}) 114 '' 115 ; 116 117 preBuild = lib.optionalString stdenv.isDarwin '' 118 # Cannot set DYLD_LIBRARY_PATH as an attr of this drv, becasue dynamic 119 # linker environment variables like this are purged. 120 # See: https://apple.stackexchange.com/a/212954/167199 121 122 # Make builders feed it to dlopen(...). Do not expose all of $libPath to 123 # DYLD_LIBRARY_PATH as the order of looking up symbols like 124 # `__cg_jpeg_resync_to_restart` will be messed up. Our libJPEG.dyllib 125 # expects it from our libTIFF.dylib, but instead it could not be found from 126 # the system `libTIFF.dylib`. DYLD_FALLBACK_LIBRARY_PATH has its own problem 127 # , too. 128 export DYLD_FALLBACK_LIBRARY_PATH="${libPath}" 129 ''; 130 131 shared = if stdenv.isDarwin then "dylib" else "shared"; 132 configureFlags = [ "--enable-${shared}" "--enable-lt=${libtool}/bin/libtool" ] 133 ++ lib.optionals disableDocs [ "--disable-docs" ] 134 ++ lib.optionals stdenv.isDarwin [ "--enable-xonx" ]; 135 136 configureScript = "../configure"; 137 138 enableParallelBuilding = false; 139 140 meta = with lib; { 141 description = "A programmable programming language"; 142 longDescription = '' 143 Racket is a full-spectrum programming language. It goes beyond 144 Lisp and Scheme with dialects that support objects, types, 145 laziness, and more. Racket enables programmers to link 146 components written in different dialects, and it empowers 147 programmers to create new, project-specific dialects. Racket's 148 libraries support applications from web servers and databases to 149 GUIs and charts. 150 ''; 151 homepage = "https://racket-lang.org/"; 152 license = with licenses; [ asl20 /* or */ mit ]; 153 maintainers = with maintainers; [ henrytill vrthra ]; 154 platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; 155 }; 156}