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 , bqn-path ? null 6 , mbqn-source ? null 7 , enableReplxx ? false 8 , libffi 9 , pkg-config 10 }: ··· 43 pkg-config 44 ]; 45 46 - # TODO(@sternenseemann): allow building against dzaima's replxx fork 47 buildInputs = [ 48 libffi 49 ]; ··· 59 ] 60 ++ lib.optional enableReplxx "REPLXX=1"; 61 62 preBuild = '' 63 # Purity: avoids git downloading bytecode files 64 mkdir -p build/bytecodeLocal/gen ··· 69 '') 70 + lib.optionalString enableReplxx '' 71 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 ''; 78 79 installPhase = '' 80 runHook preInstall ··· 84 # note guard condition for case-insensitive filesystems 85 [ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn 86 [ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn 87 - 88 runHook postInstall 89 ''; 90
··· 5 , bqn-path ? null 6 , mbqn-source ? null 7 , enableReplxx ? false 8 + # No support for macOS' .dylib on the CBQN side 9 + , enableLibcbqn ? stdenv.hostPlatform.isLinux 10 , libffi 11 , pkg-config 12 }: ··· 45 pkg-config 46 ]; 47 48 buildInputs = [ 49 libffi 50 ]; ··· 60 ] 61 ++ lib.optional enableReplxx "REPLXX=1"; 62 63 + buildFlags = [ 64 + # interpreter binary 65 + "o3" 66 + ] ++ lib.optionals enableLibcbqn [ 67 + # embeddable interpreter as a shared lib 68 + "shared-o3" 69 + ]; 70 + 71 preBuild = '' 72 # Purity: avoids git downloading bytecode files 73 mkdir -p build/bytecodeLocal/gen ··· 78 '') 79 + lib.optionalString enableReplxx '' 80 cp -r ${replxx-submodule} build/replxxLocal/ 81 ''; 82 + 83 + outputs = [ 84 + "out" 85 + "lib" 86 + "dev" 87 + ]; 88 89 installPhase = '' 90 runHook preInstall ··· 94 # note guard condition for case-insensitive filesystems 95 [ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn 96 [ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn 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 + + '' 103 runHook postInstall 104 ''; 105