[feat] add shared lib build script
This commit is contained in:
parent
dad8d46e9b
commit
9572a7e549
|
@ -1,5 +0,0 @@
|
|||
build-lib:
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o ../lib/libdal-arm64.dylib -buildmode=c-shared ./dal.go
|
||||
for arch in amd64 arm64; do\
|
||||
CC=x86_64-unknown-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=$${arch} go build -o ../lib/libdal-$${arch}.so -buildmode=c-shared ./dal.go;\
|
||||
done
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { dlopen, FFIType, suffix, ptr, toBuffer } from "bun:ffi";
|
||||
|
||||
const libname = `lib/clib.${suffix}`;
|
||||
const libname = `../clib/clib.${suffix}`;
|
||||
const libpath = libname;
|
||||
|
||||
const {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"fmt": "prettier --write .",
|
||||
"build": "tsc",
|
||||
"prepublish": "tsc",
|
||||
"preinstall": "cd binding && go build -buildmode=c-archive -o dal.a ./dal.go",
|
||||
"preinstall": "cd binding && go build -buildmode=c-archive -o dal.a ./dal.go && cd ../clib && go build -o ./clib.dylib -buildmode=c-shared ./main.go",
|
||||
"postinstall": "node-gyp configure build"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue