Skip to contentSkip to conversation

package/libtomcrypt: add pkgconfig support

PATCH New Peter Seiderer 3 participants 6 messages May 2, 2021 – May 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/libtomcrypt: add pkgconfig support

---
Changes v1 -> v2:
- use libtomcrypt provided libtomcrypt.pc.in template file

---
 package/libtomcrypt/libtomcrypt.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libtomcrypt/libtomcrypt.mk +4 -0
index fccd4b051c..3d166a6854 100644
@@ -27,6 +27,10 @@ define LIBTOMCRYPT_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" \
 		PREFIX=/usr NODOCS=1 INSTALL_USER=$(shell id -u) \
 		INSTALL_GROUP=$(shell id -g) install
+	sed -e 's,^prefix=.*,prefix=/usr,' \
+		-e 's,^Version:.*,Version: $(LIBTOMCRYPT_VERSION),' \
+		$(@D)/libtomcrypt.pc.in \
+		> $(STAGING_DIR)/usr/lib/pkgconfig/libtomcrypt.pc
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.31.1
#1 lore raw

PATCH v2 2/2 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

---
Changes v1 -> v2:
- add -fPIC only for non static builds (suggested by Arnout Vandecappelle)

---
 package/libtomcrypt/libtomcrypt.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libtomcrypt/libtomcrypt.mk +4 -0
index 3d166a6854..d1cf552abd 100644
@@ -19,6 +19,10 @@ LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
 
 LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
 
+ifeq ($(BR2_STATIC_LIBS),)
+LIBTOMCRYPT_CFLAGS += -fPIC
+endif
+
 define LIBTOMCRYPT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(LIBTOMCRYPT_CFLAGS)"
 endef
Signature · 1 line
2.31.1
#2 lore raw

PATCH v2 2/2 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Quoted 5 lines · Peter Seiderer

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

Applied to master, thanks.

Regards,
Arnout

Quoted 23 lines

---
Changes v1 -> v2:
- add -fPIC only for non static builds (suggested by Arnout Vandecappelle)

---
 package/libtomcrypt/libtomcrypt.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libtomcrypt/libtomcrypt.mk +4 -0
index 3d166a6854..d1cf552abd 100644
@@ -19,6 +19,10 @@ LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
 
 LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
 
+ifeq ($(BR2_STATIC_LIBS),)
+LIBTOMCRYPT_CFLAGS += -fPIC
+endif
+
 define LIBTOMCRYPT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(LIBTOMCRYPT_CFLAGS)"
 endef
#3 lore raw

PATCH v2 2/2 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

In reply to Peter Seiderer
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Seiderer <[email protected]> writes:

Fixes:
.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

---
Changes v1 -> v2:
- add -fPIC only for non static builds (suggested by Arnout Vandecappelle)

Committed to 2021.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH v2 1/2 package/libtomcrypt: add pkgconfig support

In reply to Peter Seiderer
Quoted 13 lines · Peter Seiderer

---
Changes v1 -> v2:
- use libtomcrypt provided libtomcrypt.pc.in template file

---
 package/libtomcrypt/libtomcrypt.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libtomcrypt/libtomcrypt.mk +0 -0
index fccd4b051c..3d166a6854 100644

package/libtomcrypt/libtomcrypt.mk define LIBTOMCRYPT_INSTALL_STAGING_CMDS · line 33

Quoted 7 lines
package/libtomcrypt/libtomcrypt.mk +4 -0
@@ -27,6 +27,10 @@ define LIBTOMCRYPT_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" \
 		PREFIX=/usr NODOCS=1 INSTALL_USER=$(shell id -u) \
 		INSTALL_GROUP=$(shell id -g) install
+	sed -e 's,^prefix=.*,prefix=/usr,' \
+		-e 's,^Version:.*,Version: $(LIBTOMCRYPT_VERSION),' \
+		$(@D)/libtomcrypt.pc.in \
+		> $(STAGING_DIR)/usr/lib/pkgconfig/libtomcrypt.pc

What about the option of using makefile.unix so we don't have to do this ourselves?

I've kept the patch as New in patchwork in case you don't see that as feasible.

Regards,
Arnout

Quoted 4 lines
package/libtomcrypt/libtomcrypt.mk +0 -0
 endef
 
 $(eval $(generic-package))
#5 lore raw

PATCH v2 1/2 package/libtomcrypt: add pkgconfig support

Hello Arnout,

Quoted 9 lines · Arnout Vandecappelle
Quoted 8 lines · Peter Seiderer

---
Changes v1 -> v2:
- use libtomcrypt provided libtomcrypt.pc.in template file

---
 package/libtomcrypt/libtomcrypt.mk | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 15 lines

package/libtomcrypt/libtomcrypt.mk define LIBTOMCRYPT_INSTALL_STAGING_CMDS · line 33

Quoted 12 lines
package/libtomcrypt/libtomcrypt.mk +4 -0
index fccd4b051c..3d166a6854 100644
@@ -27,6 +27,10 @@ define LIBTOMCRYPT_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" \
 		PREFIX=/usr NODOCS=1 INSTALL_USER=$(shell id -u) \
 		INSTALL_GROUP=$(shell id -g) install
+	sed -e 's,^prefix=.*,prefix=/usr,' \
+		-e 's,^Version:.*,Version: $(LIBTOMCRYPT_VERSION),' \
+		$(@D)/libtomcrypt.pc.in \
+		> $(STAGING_DIR)/usr/lib/pkgconfig/libtomcrypt.pc

What about the option of using makefile.unix so we don't have to do this ourselves?

Quick compare (with additional line breaks):

- makefile:

.../host/bin/x86_64-buildroot-linux-gnu-gcc
-I./src/headers/
-Wall -Wsign-compare -Wshadow
-DLTC_SOURCE
-Wextra -Wsystem-headers -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wwrite-strings -Wno-type-limits -O3 -funroll-loops -fomit-frame-pointer -DGIT_VERSION=\"1.18.2\" -I./src/headers -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -DLTC_SOURCE -DLTM_DESC -fPIC -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes.o

- makefile.unix:

.../host/bin/x86_64-buildroot-linux-gnu-gcc
-Isrc/headers -Itests -DLTC_SOURCE
-I./src/headers -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -DLTC_SOURCE -DLTM_DESC -fPIC -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes.o

Seems to cut down a lot of warning flags (and an overwritten optimize flag), but seems to miss the version define...

Quoted 1 line

I've kept the patch as New in patchwork in case you don't see that as feasible.

Will give the makefile.unix a try (and see if the install works as expected)...

Regards,
Peter

Quoted 12 lines

Regards,
Arnout

package/libtomcrypt/libtomcrypt.mk define LIBTOMCRYPT_INSTALL_STAGING_CMDS · line 36

Quoted 4 lines
package/libtomcrypt/libtomcrypt.mk +0 -0
 endef
 
 $(eval $(generic-package))

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot