Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.05 69 lines 2.1 kB view raw
1{ lib 2, mkDerivation 3, wrapQtAppsHook 4, fetchFromGitHub 5, cmake 6, ninja 7, pkg-config 8, eigen 9, zlib 10, libpng 11, boost 12, guile_3_0 13, stdenv 14}: 15 16mkDerivation { 17 pname = "libfive-unstable"; 18 version = "2022-05-19"; 19 20 src = fetchFromGitHub { 21 owner = "libfive"; 22 repo = "libfive"; 23 rev = "d83cc22709ff1f7c478be07ff2419e30e024834e"; 24 sha256 = "lNJg2LCpFcTewSA00s7omUtzhVxycAXvo6wEM/JjrN0="; 25 }; 26 27 nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config ]; 28 buildInputs = [ eigen zlib libpng boost guile_3_0 ]; 29 30 preConfigure = '' 31 substituteInPlace studio/src/guile/interpreter.cpp \ 32 --replace "qputenv(\"GUILE_LOAD_COMPILED_PATH\", \"libfive/bind/guile\");" \ 33 "qputenv(\"GUILE_LOAD_COMPILED_PATH\", \"libfive/bind/guile:$out/lib/guile/3.0/ccache\");" 34 35 substituteInPlace libfive/bind/guile/CMakeLists.txt \ 36 --replace "LIBFIVE_FRAMEWORK_DIR=$<TARGET_FILE_DIR:libfive>" \ 37 "LIBFIVE_FRAMEWORK_DIR=$out/lib" \ 38 --replace "LIBFIVE_STDLIB_DIR=$<TARGET_FILE_DIR:libfive-stdlib>" \ 39 "LIBFIVE_STDLIB_DIR=$out/lib" 40 41 export XDG_CACHE_HOME=$(mktemp -d)/.cache 42 ''; 43 44 cmakeFlags = [ 45 "-DGUILE_CCACHE_DIR=${placeholder "out"}/lib/guile/3.0/ccache" 46 ]; 47 48 postInstall = if stdenv.isDarwin then '' 49 # No rules to install the mac app, so do it manually. 50 mkdir -p $out/Applications 51 cp -r studio/Studio.app $out/Applications/Studio.app 52 53 install_name_tool \ 54 -change libfive.dylib $out/lib/libfive.dylib \ 55 -change libfive-guile.dylib $out/lib/libfive-guile.dylib \ 56 $out/Applications/Studio.app/Contents/MacOS/Studio 57 '' else '' 58 # Link "Studio" binary to "libfive-studio" to be more obvious: 59 ln -s "$out/bin/Studio" "$out/bin/libfive-studio" 60 ''; 61 62 meta = with lib; { 63 description = "Infrastructure for solid modeling with F-Reps in C, C++, and Guile"; 64 homepage = "https://libfive.com/"; 65 maintainers = with maintainers; [ hodapp kovirobi ]; 66 license = with licenses; [ mpl20 gpl2Plus ]; 67 platforms = with platforms; linux ++ darwin; 68 }; 69}