Skip to contentSkip to conversation

Use pkg-config to get libcrypto build flags

PATCH Superseded [email protected] 2 participants 10 messages Oct 22, 2020 – Oct 26, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Use pkg-config to get libcrypto build flags

From: Luca Boccassi <[email protected]>

Especially when cross-compiling or other such cases, it might be necessary to pass additional compiler flags. This is commonly done via pkg-config, so use it if available, and fall back to the hardcoded -lcrypto if not.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 3fc1bec..122c0a2 100644
@@ -58,6 +58,7 @@ BINDIR          ?= $(PREFIX)/bin
 INCDIR          ?= $(PREFIX)/include
 LIBDIR          ?= $(PREFIX)/lib
 DESTDIR         ?=
+PKGCONF         ?= pkg-config
 
 # Rebuild if a user-specified setting that affects the build changed.
 .build-config: FORCE
@@ -69,7 +70,8 @@ DESTDIR         ?=
 
 DEFAULT_TARGETS :=
 COMMON_HEADERS  := $(wildcard common/*.h)
-LDLIBS          := -lcrypto
+LDLIBS          := $(shell $(PKGCONF) libcrypto --libs 2>/dev/null || echo -lcrypto)
+CFLAGS          += $(shell $(PKGCONF) libcrypto --cflags 2>/dev/null || echo)
 
 # If we are dynamically linking, when running tests we need to override
 # LD_LIBRARY_PATH as no RPATH is set
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 Generate and install libfsverity.pc

From: Luca Boccassi <[email protected]>

pkg-config is commonly used by libraries to convey information about compiler flags and dependencies.
As packagers, we heavily rely on it so that all our tools do the right thing by default regardless of the environment.

---
 Makefile              | 13 ++++++++++++-
 lib/libfsverity.pc.in | 10 ++++++++++
 scripts/do-release.sh |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 lib/libfsverity.pc.in
Makefile +12 -1
index 122c0a2..07b828f 100644
@@ -119,6 +119,15 @@ libfsverity.so:libfsverity.so.$(SOVERSION)
 
 DEFAULT_TARGETS += libfsverity.so
 
+# Create the pkg-config file
+libfsverity.pc:
+	sed -e "s|@PREFIX@|$(PREFIX)|" \
+		-e "s|@LIBDIR@|$(LIBDIR)|" \
+		-e "s|@INCDIR@|$(INCDIR)|" \
+		lib/libfsverity.pc.in > $@
+
+DEFAULT_TARGETS += libfsverity.pc
+
 ##############################################################################
 
 #### Programs
@@ -190,11 +199,12 @@ check:fsverity test_programs
 	@echo "All tests passed!"
 
 install:all
-	install -d $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
+	install -d $(DESTDIR)$(LIBDIR)/pkgconfig $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
 	install -m755 fsverity $(DESTDIR)$(BINDIR)
 	install -m644 libfsverity.a $(DESTDIR)$(LIBDIR)
 	install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)
 	ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so
+	install -m644 libfsverity.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 	install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR)
 
 uninstall:
@@ -202,6 +212,7 @@ uninstall:
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.a
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so.$(SOVERSION)
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so
+	rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
 	rm -f $(DESTDIR)$(INCDIR)/libfsverity.h
 
 help:
lib/libfsverity.pc.in new file +10 -0
new file mode 100644
index 0000000..613e9bc
@@ -0,0 +1,10 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCDIR@
+
+Name: libfsverity
+Description: fs-verity library
+Version: 1.2
+Libs: -L${libdir} -lfsverity
+Requires.private: libcrypto
+Cflags: -I${includedir}
scripts/do-release.sh +2 -0
index 255fc53..352fcf1 100755
@@ -28,6 +28,8 @@ minor=$(echo "$VERS" | cut -d. -f2)
 sed -E -i -e "/FSVERITY_UTILS_MAJOR_VERSION/s/[0-9]+/$major/" \
 	  -e "/FSVERITY_UTILS_MINOR_VERSION/s/[0-9]+/$minor/" \
 	  include/libfsverity.h
+sed -E -i "/Version:/s/[0-9]+\.[0-9]+/$VERS/" \
+	  lib/libfsverity.pc.in
 git commit -a --signoff --message="v$VERS"
 git tag --sign "v$VERS" --message="$PKG"
 
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [fsverity-utils PATCH 2/2] Generate and install libfsverity.pc

Quoted 20 lines · On Thu, Oct 22, 2020 at 06:59:34PM +0100, [email protected] wrote:

From: Luca Boccassi <[email protected]>

pkg-config is commonly used by libraries to convey information about compiler flags and dependencies.
As packagers, we heavily rely on it so that all our tools do the right thing by default regardless of the environment.

---
 Makefile              | 13 ++++++++++++-
 lib/libfsverity.pc.in | 10 ++++++++++
 scripts/do-release.sh |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 lib/libfsverity.pc.in
Makefile +0 -0
index 122c0a2..07b828f 100644

Makefile libfsverity.so:libfsverity.so.$(SOVERSION) · line 123

Quoted 5 lines
Makefile +2 -0
@@ -119,6 +119,15 @@ libfsverity.so:libfsverity.so.$(SOVERSION)
 
 DEFAULT_TARGETS += libfsverity.so
 
+# Create the pkg-config file
+libfsverity.pc:

The dependency on lib/libfsverity.pc.in should be listed here.

Also, this depends on $(PREFIX), $(LIBDIR), and $(INCDIR). Can you also add those and $(BINDIR) to the string that gets written to .build-config, then add a dependency on .build-config?

Makefile libfsverity.so:libfsverity.so.$(SOVERSION) · line 128

Quoted 5 lines
Makefile +5 -0
+	sed -e "s|@PREFIX@|$(PREFIX)|" \
+		-e "s|@LIBDIR@|$(LIBDIR)|" \
+		-e "s|@INCDIR@|$(INCDIR)|" \
+		lib/libfsverity.pc.in > $@
+

This looks messy in the build output:

	$ make
	  CC       lib/compute_digest.o
	  CC       lib/hash_algs.o
	  CC       lib/sign_digest.o
	  CC       lib/utils.o
	  AR       libfsverity.a
	  CC       lib/compute_digest.shlib.o
	  CC       lib/hash_algs.shlib.o
	  CC       lib/sign_digest.shlib.o
	  CC       lib/utils.shlib.o
	  CCLD     libfsverity.so.0
	  LN       libfsverity.so
	sed -e "s|@PREFIX@|/usr/local|" \
		-e "s|@LIBDIR@|/usr/local/lib|" \
		-e "s|@INCDIR@|/usr/local/include|" \
		lib/libfsverity.pc.in > libfsverity.pc
	  CC       programs/utils.o
	  CC       programs/cmd_enable.o
	  CC       programs/cmd_measure.o
	  CC       programs/cmd_sign.o
	  CC       programs/fsverity.o
	  CCLD     fsverity

Below QUIET_LN, can you add:

	QUIET_GEN       = @echo '  GEN     ' $@;

Then prefix the sed command with $(QUIET_GEN) so the output looks nice.

Also, $< can be used instead of lib/libfsverity.pc.in, once the dependency is added.

Quoted 20 lines
Makefile +4 -1
+DEFAULT_TARGETS += libfsverity.pc
+
 ##############################################################################
 
 #### Programs
@@ -190,11 +199,12 @@ check:fsverity test_programs
 	@echo "All tests passed!"
 
 install:all
-	install -d $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
+	install -d $(DESTDIR)$(LIBDIR)/pkgconfig $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
 	install -m755 fsverity $(DESTDIR)$(BINDIR)
 	install -m644 libfsverity.a $(DESTDIR)$(LIBDIR)
 	install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)
 	ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so
+	install -m644 libfsverity.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 	install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR)
 
 uninstall:

Makefile uninstall: · line 216

Quoted 5 lines
Makefile +1 -0
@@ -202,6 +212,7 @@ uninstall:
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.a
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so.$(SOVERSION)
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so
+	rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
 	rm -f $(DESTDIR)$(INCDIR)/libfsverity.h

'make clean' should remove libfsverity.pc as well.

Also, libfsverity.pc should be listed in .gitignore.

- Eric

#3 lore raw

Re: [fsverity-utils PATCH 2/2] Generate and install libfsverity.pc

Quoted 101 lines · Eric Biggers
Quoted 20 lines · On Thu, Oct 22, 2020 at 06:59:34PM +0100, [email protected] wrote:

From: Luca Boccassi <[email protected]>

pkg-config is commonly used by libraries to convey information about compiler flags and dependencies.
As packagers, we heavily rely on it so that all our tools do the right thing by default regardless of the environment.

---
 Makefile              | 13 ++++++++++++-
 lib/libfsverity.pc.in | 10 ++++++++++
 scripts/do-release.sh |  2 ++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 lib/libfsverity.pc.in
Makefile +0 -0
index 122c0a2..07b828f 100644

Makefile libfsverity.so:libfsverity.so.$(SOVERSION) · line 123

Quoted 5 lines
Makefile +2 -0
@@ -119,6 +119,15 @@ libfsverity.so:libfsverity.so.$(SOVERSION)
 
 DEFAULT_TARGETS += libfsverity.so
 
+# Create the pkg-config file
+libfsverity.pc:

The dependency on lib/libfsverity.pc.in should be listed here.

Also, this depends on $(PREFIX), $(LIBDIR), and $(INCDIR). Can you also add those and $(BINDIR) to the string that gets written to .build-config, then add a dependency on .build-config?

Makefile libfsverity.so:libfsverity.so.$(SOVERSION) · line 128

Quoted 5 lines
Makefile +5 -0
+	sed -e "s|@PREFIX@|$(PREFIX)|" \
+		-e "s|@LIBDIR@|$(LIBDIR)|" \
+		-e "s|@INCDIR@|$(INCDIR)|" \
+		lib/libfsverity.pc.in > $@
+

This looks messy in the build output:

	$ make
	  CC       lib/compute_digest.o
	  CC       lib/hash_algs.o
	  CC       lib/sign_digest.o
	  CC       lib/utils.o
	  AR       libfsverity.a
	  CC       lib/compute_digest.shlib.o
	  CC       lib/hash_algs.shlib.o
	  CC       lib/sign_digest.shlib.o
	  CC       lib/utils.shlib.o
	  CCLD     libfsverity.so.0
	  LN       libfsverity.so
	sed -e "s|@PREFIX@|/usr/local|" \
		-e "s|@LIBDIR@|/usr/local/lib|" \
		-e "s|@INCDIR@|/usr/local/include|" \
		lib/libfsverity.pc.in > libfsverity.pc
	  CC       programs/utils.o
	  CC       programs/cmd_enable.o
	  CC       programs/cmd_measure.o
	  CC       programs/cmd_sign.o
	  CC       programs/fsverity.o
	  CCLD     fsverity

Below QUIET_LN, can you add:

	QUIET_GEN       = @echo '  GEN     ' $@;

Then prefix the sed command with $(QUIET_GEN) so the output looks nice.

Also, $< can be used instead of lib/libfsverity.pc.in, once the dependency is added.

Quoted 20 lines
Makefile +4 -1
+DEFAULT_TARGETS += libfsverity.pc
+
 ##############################################################################
 
 #### Programs
@@ -190,11 +199,12 @@ check:fsverity test_programs
 	@echo "All tests passed!"
 
 install:all
-	install -d $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
+	install -d $(DESTDIR)$(LIBDIR)/pkgconfig $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
 	install -m755 fsverity $(DESTDIR)$(BINDIR)
 	install -m644 libfsverity.a $(DESTDIR)$(LIBDIR)
 	install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)
 	ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so
+	install -m644 libfsverity.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 	install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR)
 
 uninstall:

Makefile uninstall: · line 216

Quoted 5 lines
Makefile +1 -0
@@ -202,6 +212,7 @@ uninstall:
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.a
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so.$(SOVERSION)
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so
+	rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
 	rm -f $(DESTDIR)$(INCDIR)/libfsverity.h

'make clean' should remove libfsverity.pc as well.

Quoted 3 lines

Also, libfsverity.pc should be listed in .gitignore.

- Eric

All done in v2. 'make clean' already removes the .pc file, as it's part of the DEFAULT_TARGETS list.

Signature · 2 lines
Kind regards,
Luca Boccassi
maintainer
#4 lore raw
In reply to [email protected]
Quoted 24 lines · On Thu, Oct 22, 2020 at 06:59:33PM +0100, [email protected] wrote:

From: Luca Boccassi <[email protected]>

Especially when cross-compiling or other such cases, it might be necessary to pass additional compiler flags. This is commonly done via pkg-config, so use it if available, and fall back to the hardcoded -lcrypto if not.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +1 -0
index 3fc1bec..122c0a2 100644
@@ -58,6 +58,7 @@ BINDIR          ?= $(PREFIX)/bin
 INCDIR          ?= $(PREFIX)/include
 LIBDIR          ?= $(PREFIX)/lib
 DESTDIR         ?=
+PKGCONF         ?= pkg-config
 
 # Rebuild if a user-specified setting that affects the build changed.
 .build-config: FORCE

Makefile DESTDIR ?= · line 74

Quoted 6 lines
Makefile +2 -1
@@ -69,7 +70,8 @@ DESTDIR         ?=
 
 DEFAULT_TARGETS :=
 COMMON_HEADERS  := $(wildcard common/*.h)
-LDLIBS          := -lcrypto
+LDLIBS          := $(shell $(PKGCONF) libcrypto --libs 2>/dev/null || echo -lcrypto)
+CFLAGS          += $(shell $(PKGCONF) libcrypto --cflags 2>/dev/null || echo)

There should be a way to prevent pkg-config from being used if someone wants to link to a local copy of libcrypto. One might expect setting PKGCONF to an empty string to work, and it kind of does, but then the shell command executes "libcrypto", which is strange. How about quoting "$(PKGCONF)" so that the shell command is guaranteed to fail as expected in that case?

- Eric

#5 lore raw
Quoted 38 lines · Eric Biggers
Quoted 24 lines · On Thu, Oct 22, 2020 at 06:59:33PM +0100, [email protected] wrote:

From: Luca Boccassi <[email protected]>

Especially when cross-compiling or other such cases, it might be necessary to pass additional compiler flags. This is commonly done via pkg-config, so use it if available, and fall back to the hardcoded -lcrypto if not.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +1 -0
index 3fc1bec..122c0a2 100644
@@ -58,6 +58,7 @@ BINDIR          ?= $(PREFIX)/bin
 INCDIR          ?= $(PREFIX)/include
 LIBDIR          ?= $(PREFIX)/lib
 DESTDIR         ?=
+PKGCONF         ?= pkg-config
 
 # Rebuild if a user-specified setting that affects the build changed.
 .build-config: FORCE

Makefile DESTDIR ?= · line 74

Quoted 6 lines
Makefile +2 -1
@@ -69,7 +70,8 @@ DESTDIR         ?=
 
 DEFAULT_TARGETS :=
 COMMON_HEADERS  := $(wildcard common/*.h)
-LDLIBS          := -lcrypto
+LDLIBS          := $(shell $(PKGCONF) libcrypto --libs 2>/dev/null || echo -lcrypto)
+CFLAGS          += $(shell $(PKGCONF) libcrypto --cflags 2>/dev/null || echo)

There should be a way to prevent pkg-config from being used if someone wants to link to a local copy of libcrypto. One might expect setting PKGCONF to an empty string to work, and it kind of does, but then the shell command executes "libcrypto", which is strange. How about quoting "$(PKGCONF)" so that the shell command is guaranteed to fail as expected in that case?

Quoted 1 line

- Eric

Sure, done in v2.

Signature · 2 lines
Kind regards,
Luca Boccassi
#6 lore raw

PATCH v2 1/2 Use pkg-config to get libcrypto build flags

In reply to [email protected]

From: Luca Boccassi <[email protected]>

Especially when cross-compiling or other such cases, it might be necessary to pass additional compiler flags. This is commonly done via pkg-config, so use it if available, and fall back to the hardcoded -lcrypto if not.

---
v2: quote PKGCONF in shell invocation

 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 3fc1bec..d7e6eb2 100644
@@ -58,6 +58,7 @@ BINDIR          ?= $(PREFIX)/bin
 INCDIR          ?= $(PREFIX)/include
 LIBDIR          ?= $(PREFIX)/lib
 DESTDIR         ?=
+PKGCONF         ?= pkg-config
 
 # Rebuild if a user-specified setting that affects the build changed.
 .build-config: FORCE
@@ -69,7 +70,8 @@ DESTDIR         ?=
 
 DEFAULT_TARGETS :=
 COMMON_HEADERS  := $(wildcard common/*.h)
-LDLIBS          := -lcrypto
+LDLIBS          := $(shell "$(PKGCONF)" libcrypto --libs 2>/dev/null || echo -lcrypto)
+CFLAGS          += $(shell "$(PKGCONF)" libcrypto --cflags 2>/dev/null || echo)
 
 # If we are dynamically linking, when running tests we need to override
 # LD_LIBRARY_PATH as no RPATH is set
Signature · 1 line
2.20.1
#7 lore raw

PATCH v2 2/2 Generate and install libfsverity.pc

From: Luca Boccassi <[email protected]>

pkg-config is commonly used by libraries to convey information about compiler flags and dependencies.
As packagers, we heavily rely on it so that all our tools do the right thing by default regardless of the environment.

---
v2: add pc file to .gitignore
add and use QUIET_GEN prefix
add install variables to .build-config have libfsverity.pc depend on lib/libfsverity.pc.in

 .gitignore            |  1 +
 Makefile              | 16 ++++++++++++++--
 lib/libfsverity.pc.in | 10 ++++++++++
 scripts/do-release.sh |  2 ++
 4 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 lib/libfsverity.pc.in
.gitignore +1 -0
index 04f9a6f..572da31 100644
@@ -9,5 +9,6 @@
 /run-tests.log
 /test_*
 cscope.*
+libfsverity.pc
 ncscope.*
 tags
Makefile +14 -2
index d7e6eb2..6fdf91a 100644
@@ -51,6 +51,7 @@ QUIET_CC        = @echo '  CC      ' $@;
 QUIET_CCLD      = @echo '  CCLD    ' $@;
 QUIET_AR        = @echo '  AR      ' $@;
 QUIET_LN        = @echo '  LN      ' $@;
+QUIET_GEN       = @echo '  GEN     ' $@;
 endif
 USE_SHARED_LIB  ?=
 PREFIX          ?= /usr/local
@@ -62,7 +63,7 @@ PKGCONF         ?= pkg-config
 
 # Rebuild if a user-specified setting that affects the build changed.
 .build-config: FORCE
-	@flags='$(CC):$(CFLAGS):$(CPPFLAGS):$(LDFLAGS):$(USE_SHARED_LIB)'; \
+	@flags='$(CC):$(CFLAGS):$(CPPFLAGS):$(LDFLAGS):$(USE_SHARED_LIB):$(PREFIX):$(LIBDIR):$(INCDIR):$(BINDIR)'; \
 	if [ "$$flags" != "`cat $@ 2>/dev/null`" ]; then		\
 		[ -e $@ ] && echo "Rebuilding due to new settings";	\
 		echo "$$flags" > $@;					\
@@ -119,6 +120,15 @@ libfsverity.so:libfsverity.so.$(SOVERSION)
 
 DEFAULT_TARGETS += libfsverity.so
 
+# Create the pkg-config file
+libfsverity.pc: lib/libfsverity.pc.in
+	$(QUIET_GEN) sed -e "s|@PREFIX@|$(PREFIX)|" \
+		-e "s|@LIBDIR@|$(LIBDIR)|" \
+		-e "s|@INCDIR@|$(INCDIR)|" \
+		$< > $@
+
+DEFAULT_TARGETS += libfsverity.pc
+
 ##############################################################################
 
 #### Programs
@@ -190,11 +200,12 @@ check:fsverity test_programs
 	@echo "All tests passed!"
 
 install:all
-	install -d $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
+	install -d $(DESTDIR)$(LIBDIR)/pkgconfig $(DESTDIR)$(INCDIR) $(DESTDIR)$(BINDIR)
 	install -m755 fsverity $(DESTDIR)$(BINDIR)
 	install -m644 libfsverity.a $(DESTDIR)$(LIBDIR)
 	install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)
 	ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so
+	install -m644 libfsverity.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 	install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR)
 
 uninstall:
@@ -202,6 +213,7 @@ uninstall:
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.a
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so.$(SOVERSION)
 	rm -f $(DESTDIR)$(LIBDIR)/libfsverity.so
+	rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
 	rm -f $(DESTDIR)$(INCDIR)/libfsverity.h
 
 help:
lib/libfsverity.pc.in new file +10 -0
new file mode 100644
index 0000000..613e9bc
@@ -0,0 +1,10 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=@INCDIR@
+
+Name: libfsverity
+Description: fs-verity library
+Version: 1.2
+Libs: -L${libdir} -lfsverity
+Requires.private: libcrypto
+Cflags: -I${includedir}
scripts/do-release.sh +2 -0
index 255fc53..352fcf1 100755
@@ -28,6 +28,8 @@ minor=$(echo "$VERS" | cut -d. -f2)
 sed -E -i -e "/FSVERITY_UTILS_MAJOR_VERSION/s/[0-9]+/$major/" \
 	  -e "/FSVERITY_UTILS_MINOR_VERSION/s/[0-9]+/$minor/" \
 	  include/libfsverity.h
+sed -E -i "/Version:/s/[0-9]+\.[0-9]+/$VERS/" \
+	  lib/libfsverity.pc.in
 git commit -a --signoff --message="v$VERS"
 git tag --sign "v$VERS" --message="$PKG"
 
Signature · 1 line
2.20.1
maintainer
#8 lore raw

Re: [fsverity-utils PATCH v2 2/2] Generate and install libfsverity.pc

Quoted 8 lines · On Mon, Oct 26, 2020 at 11:15:06AM +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

pkg-config is commonly used by libraries to convey information about compiler flags and dependencies.
As packagers, we heavily rely on it so that all our tools do the right thing by default regardless of the environment.

Applied with a couple fixups. Thanks!

- Eric

maintainer
#9 lore raw
In reply to [email protected]
Quoted 7 lines · On Mon, Oct 26, 2020 at 11:15:05AM +0000, [email protected] wrote:

From: Luca Boccassi <[email protected]>

Especially when cross-compiling or other such cases, it might be necessary to pass additional compiler flags. This is commonly done via pkg-config, so use it if available, and fall back to the hardcoded -lcrypto if not.

Applied with one fixup. Thanks!

- Eric