heads/modules/libnitrokey
Manuel Mendez a4ba76fd90
modules: minor refactor/tweaks
Just some minor clean ups like fixing whitespace and sorting things. I
added (bash)/removed (libusb) white space in order to look like the
other modules.

I sorted the --enable/--disable/--with blocks so that common stuff
looked similar which should aid in comparing modules. I also removed a
couple of duplicate config options (--disable-fallback-curses &
--disable-regex).

Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2024-05-02 13:00:27 -04:00

38 lines
1.7 KiB
Makefile

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++" \
-DCMAKE_CXX_COMPILER_AR="$(CROSS)ar" \
-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 " \
-DCMAKE_C_COMPILER="$(CROSS)gcc" \
-DCMAKE_LINKER="$(CROSS)ld"
-DCMAKE_NM="$(CROSS)nm" \
-DCMAKE_OBCOPY="$(CROSS)obcopy" \
-DCMAKE_OBJDUMP="$(CROSS)objdump" \
-DCMAKE_SHARED_LINKER_FLAGS="-gc-sections"
-DCMAKE_STRIP="$(CROSS)strip"
libnitrokey_configure := \
mkdir build -p && \
cd build && \
$(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)
# 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