Merge pull request #208389 from sternenseemann/cbqn-lib

cbqn: install headers and shared library

authored by

Anderson Torres and committed by
GitHub
52f11dd9 a3463841

+22 -7
+22 -7
pkgs/development/interpreters/bqn/cbqn/default.nix
··· 5 5 , bqn-path ? null 6 6 , mbqn-source ? null 7 7 , enableReplxx ? false 8 + # No support for macOS' .dylib on the CBQN side 9 + , enableLibcbqn ? stdenv.hostPlatform.isLinux 8 10 , libffi 9 11 , pkg-config 10 12 }: ··· 43 45 pkg-config 44 46 ]; 45 47 46 - # TODO(@sternenseemann): allow building against dzaima's replxx fork 47 48 buildInputs = [ 48 49 libffi 49 50 ]; ··· 59 60 ] 60 61 ++ lib.optional enableReplxx "REPLXX=1"; 61 62 63 + buildFlags = [ 64 + # interpreter binary 65 + "o3" 66 + ] ++ lib.optionals enableLibcbqn [ 67 + # embeddable interpreter as a shared lib 68 + "shared-o3" 69 + ]; 70 + 62 71 preBuild = '' 63 72 # Purity: avoids git downloading bytecode files 64 73 mkdir -p build/bytecodeLocal/gen ··· 69 78 '') 70 79 + lib.optionalString enableReplxx '' 71 80 cp -r ${replxx-submodule} build/replxxLocal/ 72 - '' 73 - # Need to adjust ld flags for darwin manually 74 - # https://github.com/dzaima/CBQN/issues/26 75 - + lib.optionalString stdenv.hostPlatform.isDarwin '' 76 - makeFlagsArray+=(LD_LIBS="-ldl -lffi") 77 81 ''; 82 + 83 + outputs = [ 84 + "out" 85 + "lib" 86 + "dev" 87 + ]; 78 88 79 89 installPhase = '' 80 90 runHook preInstall ··· 84 94 # note guard condition for case-insensitive filesystems 85 95 [ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn 86 96 [ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn 87 - 97 + '' 98 + + lib.optionalString enableLibcbqn '' 99 + install -Dm644 include/bqnffi.h -t "$dev/include" 100 + install -Dm755 libcbqn${stdenv.hostPlatform.extensions.sharedLibrary} -t "$lib/lib" 101 + '' 102 + + '' 88 103 runHook postInstall 89 104 ''; 90 105