Browse Source

update `Libs` part of pkg-config file with configured MPI providers

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 2 years ago
parent
commit
2c3a5fd0ac
2 changed files with 12 additions and 2 deletions
  1. 1 1
      libtomcrypt.pc.in
  2. 11 1
      makefile.shared

+ 1 - 1
libtomcrypt.pc.in

@@ -6,5 +6,5 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@
 Name: LibTomCrypt
 Description: public domain open source cryptographic toolkit
 Version: @PROJECT_VERSION@
-Libs: -L${libdir} -ltomcrypt
+Libs: -L${libdir} -ltomcrypt @MPI_PROVIDERS@
 Cflags: -I${includedir}

+ 11 - 1
makefile.shared

@@ -54,6 +54,15 @@ endif
 
 include makefile_include.mk
 
+ifneq ($(findstring -DLTM_DESC,$(LTC_CFLAGS)),)
+LTC_MPI_PROVIDERS += -ltommath
+endif
+ifneq ($(findstring -DTFM_DESC,$(LTC_CFLAGS)),)
+LTC_MPI_PROVIDERS += -ltfm
+endif
+ifneq ($(findstring -DGMP_DESC,$(LTC_CFLAGS)),)
+LTC_MPI_PROVIDERS += -lgmp
+endif
 
 #ciphers come in two flavours... enc+dec and enc
 src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
@@ -80,7 +89,8 @@ $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
 
 install: $(call print-help,install,Installs the library + headers + pkg-config file) .common_install
 	sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' -e 's,@CMAKE_INSTALL_LIBDIR@,lib,' \
-		-e 's,@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@,include/tomcrypt,' libtomcrypt.pc.in > libtomcrypt.pc
+		-e 's,@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@,include/tomcrypt,' \
+		-e 's,@MPI_PROVIDERS@,$(LTC_MPI_PROVIDERS),' libtomcrypt.pc.in > libtomcrypt.pc
 	install -p -d $(DESTDIR)$(LIBPATH)/pkgconfig
 	install -p -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/