node-yara-rs

git clone git://archive.git.mtrnord.blog/MTRNord/node-yara-rs.git
Log | Files | Refs | README | LICENSE

commit fd293aecf61af40ae252528b8d892b01a9fa28d6
parent 39a03f6bf7aaf4c16776081b105da71584de294b
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sun,  1 Oct 2023 14:20:26 +0200

Statically link yara

Diffstat:
M.github/workflows/CI.yml | 4+---
MCargo.toml | 4++--
MMakefile | 19+++++++++++++++----
3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml @@ -62,9 +62,7 @@ jobs: target: aarch64-unknown-linux-gnu build: |- set -e && - echo $YARA_INCLUDE_DIR - echo $YARA_LIBRARY_PATH - NIX_PATH=nixpkgs=channel:nixos-23.05 nix-shell -p pkg-config yara jansson openssl gnumake autoconf automake libtool protobufc pcre clang gcc napi-rs-cli --keep YARA_LIBRARY_PATH --keep YARA_INCLUDE_DIR --keep LIBCLANG_PATH --keep BINDGEN_EXTRA_CLANG_ARGS --run "napi build --platform --release --target aarch64-unknown-linux-gnu" && + NIX_PATH=nixpkgs=channel:nixos-23.05 nix-shell -p pkg-config jansson openssl gnumake autoconf automake libtool protobufc pcre clang gcc napi-rs-cli --keep LIBCLANG_PATH --keep BINDGEN_EXTRA_CLANG_ARGS --run "make yara && napi build --platform --release --target aarch64-unknown-linux-gnu" && strip *.node name: stable - ${{ matrix.settings.target }} - node@18 runs-on: ${{ matrix.settings.host }} diff --git a/Cargo.toml b/Cargo.toml @@ -13,10 +13,10 @@ napi = { version = "2.12.2", default-features = false, features = [ "error_anyhow", ] } napi-derive = "2.12.2" -yara = { version = "0.21.0" } +yara = { version = "0.21.0", features = ["yara-static", "openssl-static"] } [build-dependencies] napi-build = "2.0.1" [profile.release] -lto = true +lto = false diff --git a/Makefile b/Makefile @@ -2,7 +2,6 @@ BASE=$(shell pwd) OSNAME=$(shell uname) CFGOPTS += --with-crypto -CFGOPTS += --enable-magic ifeq ($(OSNAME),Darwin) CFLAGS += -I/usr/local/include/node @@ -14,9 +13,12 @@ YARA?=4.3.2 libyara: yara -yara: +clean: -rm -rf $(BASE)/build/yara -rm -rf $(BASE)/deps/yara-$(YARA) + cargo clean + +yara: clean test -f $(BASE)/deps/yara-$(YARA).tar.gz || curl -L -k https://github.com/VirusTotal/yara/archive/v$(YARA).tar.gz > $(BASE)/deps/yara-$(YARA).tar.gz cd $(BASE)/deps && tar -xzvf yara-$(YARA).tar.gz cd $(BASE)/deps/yara-$(YARA) && ./bootstrap.sh @@ -25,10 +27,19 @@ yara: LDFLAGS="$(LDFLAGS)" \ ./configure \ $(CFGOPTS) \ + --enable-static \ + --disable-shared \ --with-pic \ --prefix=$(BASE)/build/yara cd $(BASE)/deps/yara-$(YARA) && make cd $(BASE)/deps/yara-$(YARA) && make install build: yara - yarn build -\ No newline at end of file + yarn build + +debug_results: build + cargo rustc --release -- --print link-args + ldd *.node + +test: build + yarn run test +\ No newline at end of file