python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / libfive / default.nix
blob37eaed3ac65066fd2bbb8c1bd485e9574622a285
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
16 mkDerivation {
17   pname = "libfive-unstable";
18   version = "2022-05-19";
20   src = fetchFromGitHub {
21     owner = "libfive";
22     repo = "libfive";
23     rev = "d83cc22709ff1f7c478be07ff2419e30e024834e";
24     sha256 = "lNJg2LCpFcTewSA00s7omUtzhVxycAXvo6wEM/JjrN0=";
25   };
27   nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config ];
28   buildInputs = [ eigen zlib libpng boost guile_3_0 ];
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\");"
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"
41     export XDG_CACHE_HOME=$(mktemp -d)/.cache
42   '';
44   cmakeFlags = [
45     "-DGUILE_CCACHE_DIR=${placeholder "out"}/lib/guile/3.0/ccache"
46   ];
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
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   '';
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   };