2020-10-19 14:47:22 +00:00
|
|
|
modules-$(CONFIG_NKSTORECLI) += libnitrokey
|
|
|
|
|
|
|
|
libnitrokey_depends := libhidapi-libusb libusb $(musl_dep)
|
|
|
|
|
|
|
|
libnitrokey_version := 3.6
|
|
|
|
libnitrokey_dir := libnitrokey-$(libnitrokey_version)
|
|
|
|
libnitrokey_tar := libnitrokey-v$(libnitrokey_version).tar.gz
|
|
|
|
libnitrokey_url := https://github.com/Nitrokey/libnitrokey/releases/download/v$(libnitrokey_version)/$(libnitrokey_tar)
|
|
|
|
libnitrokey_hash := 4f3382b6193afe69c2001321038fce9490bc28803ed687152a397ccd89146ae6
|
|
|
|
|
|
|
|
# currently the dynamic lib is not included
|
|
|
|
#libnitrokey_libraries := \
|
|
|
|
# build/libnitrokey.so.3
|
|
|
|
|
|
|
|
cmake_cross := "-DCMAKE_AR=$(CROSS)ar" \
|
|
|
|
-DCMAKE_CXX_COMPILER="$(CROSS)g++" \
|
2024-01-29 03:55:11 +00:00
|
|
|
-DCMAKE_CXX_COMPILER_AR="$(CROSS)ar" \
|
2020-10-19 14:47:22 +00:00
|
|
|
-DCMAKE_CXX_FLAGS="-Os -fdata-sections -ffunction-sections -ffile-prefix-map=$(pwd)=heads -gno-record-gcc-switches -D__MUSL__ -I$(INSTALL)/include -L$(INSTALL)/lib " \
|
2024-01-29 03:55:11 +00:00
|
|
|
-DCMAKE_C_COMPILER="$(CROSS)gcc" \
|
2020-10-19 14:47:22 +00:00
|
|
|
-DCMAKE_LINKER="$(CROSS)ld"
|
|
|
|
-DCMAKE_NM="$(CROSS)nm" \
|
|
|
|
-DCMAKE_OBCOPY="$(CROSS)obcopy" \
|
2024-01-29 03:55:11 +00:00
|
|
|
-DCMAKE_OBJDUMP="$(CROSS)objdump" \
|
|
|
|
-DCMAKE_SHARED_LINKER_FLAGS="-gc-sections"
|
2020-10-19 14:47:22 +00:00
|
|
|
-DCMAKE_STRIP="$(CROSS)strip"
|
|
|
|
|
|
|
|
libnitrokey_configure := \
|
|
|
|
mkdir build -p && \
|
|
|
|
cd build && \
|
2024-01-29 03:55:11 +00:00
|
|
|
$(CROSS_TOOLS) cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=/ -DCOMPILE_TESTS=OFF -DNO_LOG=ON $(cmake_cross)
|
2020-10-19 14:47:22 +00:00
|
|
|
|
|
|
|
# install "by-hand" as INSTALL_PREFIX is not working as expected
|
|
|
|
libnitrokey_target := $(CROSS_TOOLS) $(MAKE_JOBS) -C build DESTDIR="$(INSTALL)" && \
|
|
|
|
cp build/$(libnitrokey_dir)/build/libnitrokey.a $(INSTALL)/lib/libnitrokey.a && \
|
|
|
|
mkdir -p $(INSTALL)/include/libnitrokey/ && \
|
|
|
|
cp -r build/$(libnitrokey_dir)/NK_C_API.h $(INSTALL)/include/libnitrokey/ && \
|
|
|
|
cp -r build/$(libnitrokey_dir)/libnitrokey/*.h $(INSTALL)/include/libnitrokey
|