lol
0
fork

Configure Feed

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

at 23.11-beta 146 lines 3.4 kB view raw
1{ lib 2, patchelf 3, requireFile 4, stdenv 5# arguments from default.nix 6, lang 7, meta 8, name 9, src 10, version 11# dependencies 12, alsa-lib 13, coreutils 14, cudaPackages 15, dbus 16, fontconfig 17, freetype 18, gcc 19, glib 20, libGL 21, libGLU 22, libuuid 23, libxml2 24, ncurses 25, opencv2 26, openssl 27, unixODBC 28, xkeyboard_config 29, xorg 30, zlib 31# options 32, cudaSupport 33}: 34 35stdenv.mkDerivation rec { 36 inherit meta name src version; 37 38 buildInputs = [ 39 coreutils 40 patchelf 41 alsa-lib 42 coreutils 43 dbus 44 fontconfig 45 freetype 46 gcc.cc 47 gcc.libc 48 glib 49 ncurses 50 opencv2 51 openssl 52 unixODBC 53 xkeyboard_config 54 libxml2 55 libuuid 56 zlib 57 libGL 58 libGLU 59 ] ++ (with xorg; [ 60 libX11 61 libXext 62 libXtst 63 libXi 64 libXmu 65 libXrender 66 libxcb 67 libXcursor 68 libXfixes 69 libXrandr 70 libICE 71 libSM 72 ]); 73 74 ldpath = lib.makeLibraryPath buildInputs 75 + lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") 76 (":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs); 77 78 dontConfigure = true; 79 dontBuild = true; 80 81 unpackPhase = '' 82 echo "=== Extracting makeself archive ===" 83 # find offset from file 84 offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src) 85 dd if="$src" ibs=$offset skip=1 | tar -xf - 86 cd Unix 87 ''; 88 89 installPhase = '' 90 cd Installer 91 # don't restrict PATH, that has already been done 92 sed -i -e 's/^PATH=/# PATH=/' MathInstaller 93 sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller 94 95 echo "=== Running MathInstaller ===" 96 ./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent 97 98 # Fix library paths 99 cd $out/libexec/Mathematica/Executables 100 for path in mathematica MathKernel Mathematica WolframKernel wolfram math; do 101 sed -i -e 's#export LD_LIBRARY_PATH$#export LD_LIBRARY_PATH=${zlib}/lib:\''${LD_LIBRARY_PATH}#' $path 102 done 103 104 # Fix xkeyboard config path for Qt 105 for path in mathematica Mathematica; do 106 line=$(grep -n QT_PLUGIN_PATH $path | sed 's/:.*//') 107 sed -i -e "$line iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"" $path 108 done 109 ''; 110 111 preFixup = '' 112 echo "=== PatchElfing away ===" 113 # This code should be a bit forgiving of errors, unfortunately 114 set +e 115 find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do 116 type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/') 117 if [ -z "$type" ]; then 118 : 119 elif [ "$type" == "EXEC" ]; then 120 echo "patching $f executable <<" 121 patchelf --shrink-rpath "$f" 122 patchelf \ 123 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 124 --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \ 125 "$f" \ 126 && patchelf --shrink-rpath "$f" \ 127 || echo unable to patch ... ignoring 1>&2 128 elif [ "$type" == "DYN" ]; then 129 echo "patching $f library <<" 130 patchelf \ 131 --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \ 132 "$f" \ 133 && patchelf --shrink-rpath "$f" \ 134 || echo unable to patch ... ignoring 1>&2 135 else 136 echo "not patching $f <<: unknown elf type" 137 fi 138 done 139 ''; 140 141 # all binaries are already stripped 142 dontStrip = true; 143 144 # we did this in prefixup already 145 dontPatchELF = true; 146}