mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
cbqn: install headers and shared library
This is useful for embedding CBQN and writing libraries that can be used via the CBQN FFI.
This commit is contained in:
parent
a3f612564c
commit
2f3f2c82c8
@ -5,6 +5,8 @@
|
|||||||
, bqn-path ? null
|
, bqn-path ? null
|
||||||
, mbqn-source ? null
|
, mbqn-source ? null
|
||||||
, enableReplxx ? false
|
, enableReplxx ? false
|
||||||
|
# No support for macOS' .dylib on the CBQN side
|
||||||
|
, enableLibcbqn ? stdenv.hostPlatform.isLinux
|
||||||
, libffi
|
, libffi
|
||||||
, pkg-config
|
, pkg-config
|
||||||
}:
|
}:
|
||||||
@ -59,6 +61,14 @@ stdenv.mkDerivation rec {
|
|||||||
]
|
]
|
||||||
++ lib.optional enableReplxx "REPLXX=1";
|
++ lib.optional enableReplxx "REPLXX=1";
|
||||||
|
|
||||||
|
buildFlags = [
|
||||||
|
# interpreter binary
|
||||||
|
"o3"
|
||||||
|
] ++ lib.optionals enableLibcbqn [
|
||||||
|
# embeddable interpreter as a shared lib
|
||||||
|
"shared-o3"
|
||||||
|
];
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
# Purity: avoids git downloading bytecode files
|
# Purity: avoids git downloading bytecode files
|
||||||
mkdir -p build/bytecodeLocal/gen
|
mkdir -p build/bytecodeLocal/gen
|
||||||
@ -76,6 +86,12 @@ stdenv.mkDerivation rec {
|
|||||||
makeFlagsArray+=(LD_LIBS="-ldl -lffi")
|
makeFlagsArray+=(LD_LIBS="-ldl -lffi")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
outputs = [
|
||||||
|
"out"
|
||||||
|
"lib"
|
||||||
|
"dev"
|
||||||
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
@ -84,7 +100,12 @@ stdenv.mkDerivation rec {
|
|||||||
# note guard condition for case-insensitive filesystems
|
# note guard condition for case-insensitive filesystems
|
||||||
[ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn
|
[ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn
|
||||||
[ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn
|
[ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn
|
||||||
|
''
|
||||||
|
+ lib.optionalString enableLibcbqn ''
|
||||||
|
install -Dm644 include/bqnffi.h -t "$dev/include"
|
||||||
|
install -Dm755 libcbqn${stdenv.hostPlatform.extensions.sharedLibrary} -t "$lib/lib"
|
||||||
|
''
|
||||||
|
+ ''
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user