All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf
@ 2019-03-19 21:06 Luca Boccassi
  2019-03-19 21:23 ` Stanislav Fomichev
                   ` (7 more replies)
  0 siblings, 8 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-19 21:06 UTC (permalink / raw)
  To: netdev

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 18 +++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index a05c43468bd0..542c64e2a6d9 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -179,6 +180,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_LINK)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(shell make --no-print-directory -sC ../../.. kernelversion)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -208,7 +215,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -218,7 +230,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..0cac2f5f54a6
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include/bpf
+
+Name: libbpf
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+Description: Linux kernel BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
@ 2019-03-19 21:23 ` Stanislav Fomichev
  2019-03-19 23:02   ` Luca Boccassi
  2019-03-19 23:00 ` [PATCH bpf-next v2] " Luca Boccassi
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-19 21:23 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev

On 03/19, Luca Boccassi wrote:
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
>  tools/lib/bpf/.gitignore         |  1 +
>  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
>  3 files changed, 27 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/bpf/libbpf.pc.template
> 
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index 4db74758c674..7d9e182a1f51 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -1,3 +1,4 @@
>  libbpf_version.h
> +libbpf.pc
>  FEATURE-DUMP.libbpf
>  test_libbpf
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index a05c43468bd0..542c64e2a6d9 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
>  
>  LIB_FILE = libbpf.a libbpf.so
> +PC_FILE = libbpf.pc
>  
>  VERSION		= $(BPF_VERSION)
>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
>  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
>  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>  
> -CMD_TARGETS = $(LIB_FILE)
> +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
>  
>  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
>  
> @@ -179,6 +180,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
>  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
>  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
>  
> +$(OUTPUT)libbpf.pc:
> +	$(QUIET_LINK)sed -e "s|@PREFIX@|$(prefix)|" \
Maybe QUIET_GEN instead? Or QUIET_INSTALL (tools/lib/traceevent/Makefile)?

> +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> +		-e "s|@VERSION@|$(shell make --no-print-directory -sC ../../.. kernelversion)|" \
Make it its own variable, like we do in bpftool?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/bpf/bpftool/Makefile#n26

Also, I wonder what would happen in the case of out-of-tree libbpf:
https://github.com/libbpf/libbpf

Should there be some fallback?

> +		< $@.template > $@
> +
>  check: check_abi
>  
>  check_abi: $(OUTPUT)libbpf.so
> @@ -208,7 +215,12 @@ install_headers:
>  		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
>  		$(call do_install,btf.h,$(prefix)/include/bpf,644);
>  
> -install: install_lib
> +install_pkgconfig: $(PC_FILE)
> +	$(call QUIET_INSTALL, $(PC_FILE)) \
> +		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
> +
> +
> +install: install_lib install_pkgconfig
>  
>  ### Cleaning rules
>  
> @@ -218,7 +230,7 @@ config-clean:
>  
>  clean:
>  	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
> -		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
> +		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
>  	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
>  
>  
> diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
> new file mode 100644
> index 000000000000..0cac2f5f54a6
> --- /dev/null
> +++ b/tools/lib/bpf/libbpf.pc.template
> @@ -0,0 +1,11 @@
> +prefix=@PREFIX@
> +libdir=@LIBDIR@
> +includedir=${prefix}/include/bpf
> +
> +Name: libbpf
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> +Description: Linux kernel BPF library
> +Version: @VERSION@
> +Libs: -L${libdir} -lbpf
> +Requires.private: libelf
> +Cflags: -I${includedir}
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
  2019-03-19 21:23 ` Stanislav Fomichev
@ 2019-03-19 23:00 ` Luca Boccassi
  2019-03-19 23:17   ` Stanislav Fomichev
  2019-03-20 13:28 ` [PATCH bpf-next v3] " luca.boccassi
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 31+ messages in thread
From: Luca Boccassi @ 2019-03-19 23:00 UTC (permalink / raw)
  To: netdev; +Cc: sdf

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index a05c43468bd0..1df3ebfb3118 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -89,6 +90,7 @@ OBJ		= $@
 N		=
 
 LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
+KERNEL_VERSION = $(shell make --no-print-directory -sC ../../.. kernelversion)
 
 # Set compile option CFLAGS
 ifdef EXTRA_CFLAGS
@@ -137,7 +139,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -179,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(KERNEL_VERSION)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -208,7 +216,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -218,7 +231,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..0cac2f5f54a6
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include/bpf
+
+Name: libbpf
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+Description: Linux kernel BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:23 ` Stanislav Fomichev
@ 2019-03-19 23:02   ` Luca Boccassi
  2019-03-19 23:12     ` Stanislav Fomichev
  0 siblings, 1 reply; 31+ messages in thread
From: Luca Boccassi @ 2019-03-19 23:02 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev

On Tue, 2019-03-19 at 14:23 -0700, Stanislav Fomichev wrote:
> On 03/19, Luca Boccassi wrote:
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> >  tools/lib/bpf/.gitignore         |  1 +
> >  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
> >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> >  3 files changed, 27 insertions(+), 3 deletions(-)
> >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > 
> > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > index 4db74758c674..7d9e182a1f51 100644
> > --- a/tools/lib/bpf/.gitignore
> > +++ b/tools/lib/bpf/.gitignore
> > @@ -1,3 +1,4 @@
> >  libbpf_version.h
> > +libbpf.pc
> >  FEATURE-DUMP.libbpf
> >  test_libbpf
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index a05c43468bd0..542c64e2a6d9 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> >  
> >  LIB_FILE = libbpf.a libbpf.so
> > +PC_FILE = libbpf.pc
> >  
> >  VERSION		= $(BPF_VERSION)
> >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide
> > $(BPF_IN) | \
> >  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so
> > | \
> >  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@
> > -f1 | sort -u | wc -l)
> >  
> > -CMD_TARGETS = $(LIB_FILE)
> > +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
> >  
> >  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
> >  
> > @@ -179,6 +180,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
> >  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
> >  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
> >  
> > +$(OUTPUT)libbpf.pc:
> > +	$(QUIET_LINK)sed -e "s|@PREFIX@|$(prefix)|" \
> 
> Maybe QUIET_GEN instead? Or QUIET_INSTALL
> (tools/lib/traceevent/Makefile)?

Changed to QUIET_GEN in v2.

> > +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> > +		-e "s|@VERSION@|$(shell make --no-print-directory
> > -sC ../../.. kernelversion)|" \
> 
> Make it its own variable, like we do in bpftool?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tr
> ee/tools/bpf/bpftool/Makefile#n26

Done in v2.

> Also, I wonder what would happen in the case of out-of-tree libbpf:
> https://github.com/libbpf/libbpf
> 
> Should there be some fallback?

That tree looks like it's autosynced from the kernel tree, isn't it?
Then it will just pick up the change and start generating the pc file
as well, won't it?

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 23:02   ` Luca Boccassi
@ 2019-03-19 23:12     ` Stanislav Fomichev
  0 siblings, 0 replies; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-19 23:12 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev

On 03/19, Luca Boccassi wrote:
> On Tue, 2019-03-19 at 14:23 -0700, Stanislav Fomichev wrote:
> > On 03/19, Luca Boccassi wrote:
> > > Generate a libbpf.pc file at build time so that users can rely
> > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > ---
> > >  tools/lib/bpf/.gitignore         |  1 +
> > >  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
> > >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> > >  3 files changed, 27 insertions(+), 3 deletions(-)
> > >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > > 
> > > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > > index 4db74758c674..7d9e182a1f51 100644
> > > --- a/tools/lib/bpf/.gitignore
> > > +++ b/tools/lib/bpf/.gitignore
> > > @@ -1,3 +1,4 @@
> > >  libbpf_version.h
> > > +libbpf.pc
> > >  FEATURE-DUMP.libbpf
> > >  test_libbpf
> > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > > index a05c43468bd0..542c64e2a6d9 100644
> > > --- a/tools/lib/bpf/Makefile
> > > +++ b/tools/lib/bpf/Makefile
> > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> > >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> > >  
> > >  LIB_FILE = libbpf.a libbpf.so
> > > +PC_FILE = libbpf.pc
> > >  
> > >  VERSION		= $(BPF_VERSION)
> > >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > > @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide
> > > $(BPF_IN) | \
> > >  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so
> > > | \
> > >  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@
> > > -f1 | sort -u | wc -l)
> > >  
> > > -CMD_TARGETS = $(LIB_FILE)
> > > +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
> > >  
> > >  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
> > >  
> > > @@ -179,6 +180,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
> > >  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
> > >  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
> > >  
> > > +$(OUTPUT)libbpf.pc:
> > > +	$(QUIET_LINK)sed -e "s|@PREFIX@|$(prefix)|" \
> > 
> > Maybe QUIET_GEN instead? Or QUIET_INSTALL
> > (tools/lib/traceevent/Makefile)?
> 
> Changed to QUIET_GEN in v2.
> 
> > > +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> > > +		-e "s|@VERSION@|$(shell make --no-print-directory
> > > -sC ../../.. kernelversion)|" \
> > 
> > Make it its own variable, like we do in bpftool?
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tr
> > ee/tools/bpf/bpftool/Makefile#n26
> 
> Done in v2.
> 
> > Also, I wonder what would happen in the case of out-of-tree libbpf:
> > https://github.com/libbpf/libbpf
> > 
> > Should there be some fallback?
> 
> That tree looks like it's autosynced from the kernel tree, isn't it?
> Then it will just pick up the change and start generating the pc file
> as well, won't it?
Yes, it's autosynched, but it autosyncs only tools/lib/bpf directory
and it lacks top-level makefile with kernelversion target. I guess in
this case make will spill out an error to stderr and version will be empty.

> 
> -- 
> Kind regards,
> Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 23:00 ` [PATCH bpf-next v2] " Luca Boccassi
@ 2019-03-19 23:17   ` Stanislav Fomichev
  2019-03-20 13:22     ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-19 23:17 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev

On 03/19, Luca Boccassi wrote:
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>     save kernel version in its own variable instead of calling
>     make inline
> 
>  tools/lib/bpf/.gitignore         |  1 +
>  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
>  3 files changed, 28 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/bpf/libbpf.pc.template
> 
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index 4db74758c674..7d9e182a1f51 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -1,3 +1,4 @@
>  libbpf_version.h
> +libbpf.pc
>  FEATURE-DUMP.libbpf
>  test_libbpf
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index a05c43468bd0..1df3ebfb3118 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
>  
>  LIB_FILE = libbpf.a libbpf.so
> +PC_FILE = libbpf.pc
>  
>  VERSION		= $(BPF_VERSION)
>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> @@ -89,6 +90,7 @@ OBJ		= $@
>  N		=
>  
>  LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> +KERNEL_VERSION = $(shell make --no-print-directory -sC ../../.. kernelversion)
Oh, we do already have LIBBPF_VERSION, why not use that? This way
you don't need to do anything for out-of-tree libbpf from github.

I don't remember what was the strategy regarding libbpf versioning, but
that 0.0.1 should be changed to something sensible (be set to the kernel
version upon release?)

>  
>  # Set compile option CFLAGS
>  ifdef EXTRA_CFLAGS
> @@ -137,7 +139,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
>  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
>  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>  
> -CMD_TARGETS = $(LIB_FILE)
> +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
>  
>  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
>  
> @@ -179,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
>  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
>  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
>  
> +$(OUTPUT)libbpf.pc:
> +	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
> +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> +		-e "s|@VERSION@|$(KERNEL_VERSION)|" \
> +		< $@.template > $@
> +
>  check: check_abi
>  
>  check_abi: $(OUTPUT)libbpf.so
> @@ -208,7 +216,12 @@ install_headers:
>  		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
>  		$(call do_install,btf.h,$(prefix)/include/bpf,644);
>  
> -install: install_lib
> +install_pkgconfig: $(PC_FILE)
> +	$(call QUIET_INSTALL, $(PC_FILE)) \
> +		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
> +
> +
> +install: install_lib install_pkgconfig
>  
>  ### Cleaning rules
>  
> @@ -218,7 +231,7 @@ config-clean:
>  
>  clean:
>  	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
> -		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
> +		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
>  	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
>  
>  
> diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
> new file mode 100644
> index 000000000000..0cac2f5f54a6
> --- /dev/null
> +++ b/tools/lib/bpf/libbpf.pc.template
> @@ -0,0 +1,11 @@
> +prefix=@PREFIX@
> +libdir=@LIBDIR@
> +includedir=${prefix}/include/bpf
> +
> +Name: libbpf
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> +Description: Linux kernel BPF library
> +Version: @VERSION@
> +Libs: -L${libdir} -lbpf
> +Requires.private: libelf
> +Cflags: -I${includedir}
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 23:17   ` Stanislav Fomichev
@ 2019-03-20 13:22     ` Luca Boccassi
  2019-03-20 13:30       ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Luca Boccassi @ 2019-03-20 13:22 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev

On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> On 03/19, Luca Boccassi wrote:
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> >     save kernel version in its own variable instead of calling
> >     make inline
> > 
> >  tools/lib/bpf/.gitignore         |  1 +
> >  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> >  3 files changed, 28 insertions(+), 3 deletions(-)
> >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > 
> > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > index 4db74758c674..7d9e182a1f51 100644
> > --- a/tools/lib/bpf/.gitignore
> > +++ b/tools/lib/bpf/.gitignore
> > @@ -1,3 +1,4 @@
> >  libbpf_version.h
> > +libbpf.pc
> >  FEATURE-DUMP.libbpf
> >  test_libbpf
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index a05c43468bd0..1df3ebfb3118 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> >  
> >  LIB_FILE = libbpf.a libbpf.so
> > +PC_FILE = libbpf.pc
> >  
> >  VERSION		= $(BPF_VERSION)
> >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > @@ -89,6 +90,7 @@ OBJ		= $@
> >  N		=
> >  
> >  LIBBPF_VERSION =
> > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> > +KERNEL_VERSION = $(shell make --no-print-directory -sC ../../..
> > kernelversion)
> Oh, we do already have LIBBPF_VERSION, why not use that? This way
> you don't need to do anything for out-of-tree libbpf from github.
> 
> I don't remember what was the strategy regarding libbpf versioning,
> but
> that 0.0.1 should be changed to something sensible (be set to the
> kernel
> version upon release?)

[re-sending as reply via phone added html and the list daemon said no-
no]

That looks like the ABI version though, rather than the source version?
The source version is more appropriate for the PC file

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v3] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
  2019-03-19 21:23 ` Stanislav Fomichev
  2019-03-19 23:00 ` [PATCH bpf-next v2] " Luca Boccassi
@ 2019-03-20 13:28 ` luca.boccassi
  2019-03-20 23:58   ` Andrey Ignatov
  2019-03-21 10:25 ` [PATCH bpf-next v4] " luca.boccassi
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 31+ messages in thread
From: luca.boccassi @ 2019-03-20 13:28 UTC (permalink / raw)
  To: netdev; +Cc: sdf

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 18 +++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 61aaacf0cfa1..891fe3da1410 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -209,7 +216,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -219,7 +231,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..0cac2f5f54a6
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include/bpf
+
+Name: libbpf
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+Description: Linux kernel BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 13:22     ` Luca Boccassi
@ 2019-03-20 13:30       ` Luca Boccassi
  2019-03-20 17:21         ` Stanislav Fomichev
  0 siblings, 1 reply; 31+ messages in thread
From: Luca Boccassi @ 2019-03-20 13:30 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev

On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
> On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> > On 03/19, Luca Boccassi wrote:
> > > Generate a libbpf.pc file at build time so that users can rely
> > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > ---
> > > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> > >     save kernel version in its own variable instead of calling
> > >     make inline
> > > 
> > >  tools/lib/bpf/.gitignore         |  1 +
> > >  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> > >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> > >  3 files changed, 28 insertions(+), 3 deletions(-)
> > >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > > 
> > > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > > index 4db74758c674..7d9e182a1f51 100644
> > > --- a/tools/lib/bpf/.gitignore
> > > +++ b/tools/lib/bpf/.gitignore
> > > @@ -1,3 +1,4 @@
> > >  libbpf_version.h
> > > +libbpf.pc
> > >  FEATURE-DUMP.libbpf
> > >  test_libbpf
> > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > > index a05c43468bd0..1df3ebfb3118 100644
> > > --- a/tools/lib/bpf/Makefile
> > > +++ b/tools/lib/bpf/Makefile
> > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> > >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> > >  
> > >  LIB_FILE = libbpf.a libbpf.so
> > > +PC_FILE = libbpf.pc
> > >  
> > >  VERSION		= $(BPF_VERSION)
> > >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > > @@ -89,6 +90,7 @@ OBJ		= $@
> > >  N		=
> > >  
> > >  LIBBPF_VERSION =
> > > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> > > +KERNEL_VERSION = $(shell make --no-print-directory -sC ../../..
> > > kernelversion)
> > Oh, we do already have LIBBPF_VERSION, why not use that? This way
> > you don't need to do anything for out-of-tree libbpf from github.
> > 
> > I don't remember what was the strategy regarding libbpf versioning,
> > but
> > that 0.0.1 should be changed to something sensible (be set to the
> > kernel
> > version upon release?)
> 
> [re-sending as reply via phone added html and the list daemon said
> no-
> no]
> 
> That looks like the ABI version though, rather than the source
> version?
> The source version is more appropriate for the PC file

That said, the versioning looks looks like it could use some love and
it's not really a factor that should gate a pkg-config file and could
be done separately if required, so in v3 I've removed KERNEL_VERSION
and used LIBBPF_VERSION as you suggested.

Thanks for reviewing!

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 13:30       ` Luca Boccassi
@ 2019-03-20 17:21         ` Stanislav Fomichev
  2019-03-20 20:39           ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-20 17:21 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev

On 03/20, Luca Boccassi wrote:
> On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
> > On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> > > On 03/19, Luca Boccassi wrote:
> > > > Generate a libbpf.pc file at build time so that users can rely
> > > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > ---
> > > > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> > > >     save kernel version in its own variable instead of calling
> > > >     make inline
> > > > 
> > > >  tools/lib/bpf/.gitignore         |  1 +
> > > >  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> > > >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> > > >  3 files changed, 28 insertions(+), 3 deletions(-)
> > > >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > > > 
> > > > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > > > index 4db74758c674..7d9e182a1f51 100644
> > > > --- a/tools/lib/bpf/.gitignore
> > > > +++ b/tools/lib/bpf/.gitignore
> > > > @@ -1,3 +1,4 @@
> > > >  libbpf_version.h
> > > > +libbpf.pc
> > > >  FEATURE-DUMP.libbpf
> > > >  test_libbpf
> > > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > > > index a05c43468bd0..1df3ebfb3118 100644
> > > > --- a/tools/lib/bpf/Makefile
> > > > +++ b/tools/lib/bpf/Makefile
> > > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> > > >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> > > >  
> > > >  LIB_FILE = libbpf.a libbpf.so
> > > > +PC_FILE = libbpf.pc
> > > >  
> > > >  VERSION		= $(BPF_VERSION)
> > > >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > > > @@ -89,6 +90,7 @@ OBJ		= $@
> > > >  N		=
> > > >  
> > > >  LIBBPF_VERSION =
> > > > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> > > > +KERNEL_VERSION = $(shell make --no-print-directory -sC ../../..
> > > > kernelversion)
> > > Oh, we do already have LIBBPF_VERSION, why not use that? This way
> > > you don't need to do anything for out-of-tree libbpf from github.
> > > 
> > > I don't remember what was the strategy regarding libbpf versioning,
> > > but
> > > that 0.0.1 should be changed to something sensible (be set to the
> > > kernel
> > > version upon release?)
> > 
> > [re-sending as reply via phone added html and the list daemon said
> > no-
> > no]
> > 
> > That looks like the ABI version though, rather than the source
> > version?
> > The source version is more appropriate for the PC file
> 
> That said, the versioning looks looks like it could use some love and
> it's not really a factor that should gate a pkg-config file and could
> be done separately if required, so in v3 I've removed KERNEL_VERSION
> and used LIBBPF_VERSION as you suggested.
Agree :-) There was some conversation recently about incrementing it per
kernel release vs real api change. I don't remember what the outcome
was exactly.

> Thanks for reviewing!
> 
> -- 
> Kind regards,
> Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 17:21         ` Stanislav Fomichev
@ 2019-03-20 20:39           ` Luca Boccassi
  2019-03-20 20:44             ` Stanislav Fomichev
  0 siblings, 1 reply; 31+ messages in thread
From: Luca Boccassi @ 2019-03-20 20:39 UTC (permalink / raw)
  To: Stanislav Fomichev; +Cc: netdev

On Wed, 2019-03-20 at 10:21 -0700, Stanislav Fomichev wrote:
> On 03/20, Luca Boccassi wrote:
> > On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
> > > On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> > > > On 03/19, Luca Boccassi wrote:
> > > > > Generate a libbpf.pc file at build time so that users can
> > > > > rely
> > > > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > > > 
> > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > ---
> > > > > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> > > > >     save kernel version in its own variable instead of
> > > > > calling
> > > > >     make inline
> > > > > 
> > > > >  tools/lib/bpf/.gitignore         |  1 +
> > > > >  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> > > > >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> > > > >  3 files changed, 28 insertions(+), 3 deletions(-)
> > > > >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > > > > 
> > > > > diff --git a/tools/lib/bpf/.gitignore
> > > > > b/tools/lib/bpf/.gitignore
> > > > > index 4db74758c674..7d9e182a1f51 100644
> > > > > --- a/tools/lib/bpf/.gitignore
> > > > > +++ b/tools/lib/bpf/.gitignore
> > > > > @@ -1,3 +1,4 @@
> > > > >  libbpf_version.h
> > > > > +libbpf.pc
> > > > >  FEATURE-DUMP.libbpf
> > > > >  test_libbpf
> > > > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > > > > index a05c43468bd0..1df3ebfb3118 100644
> > > > > --- a/tools/lib/bpf/Makefile
> > > > > +++ b/tools/lib/bpf/Makefile
> > > > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> > > > >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> > > > >  
> > > > >  LIB_FILE = libbpf.a libbpf.so
> > > > > +PC_FILE = libbpf.pc
> > > > >  
> > > > >  VERSION		= $(BPF_VERSION)
> > > > >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > > > > @@ -89,6 +90,7 @@ OBJ		= $@
> > > > >  N		=
> > > > >  
> > > > >  LIBBPF_VERSION =
> > > > > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> > > > > +KERNEL_VERSION = $(shell make --no-print-directory -sC
> > > > > ../../..
> > > > > kernelversion)
> > > > Oh, we do already have LIBBPF_VERSION, why not use that? This
> > > > way
> > > > you don't need to do anything for out-of-tree libbpf from
> > > > github.
> > > > 
> > > > I don't remember what was the strategy regarding libbpf
> > > > versioning,
> > > > but
> > > > that 0.0.1 should be changed to something sensible (be set to
> > > > the
> > > > kernel
> > > > version upon release?)
> > > 
> > > [re-sending as reply via phone added html and the list daemon
> > > said
> > > no-
> > > no]
> > > 
> > > That looks like the ABI version though, rather than the source
> > > version?
> > > The source version is more appropriate for the PC file
> > 
> > That said, the versioning looks looks like it could use some love
> > and
> > it's not really a factor that should gate a pkg-config file and
> > could
> > be done separately if required, so in v3 I've removed
> > KERNEL_VERSION
> > and used LIBBPF_VERSION as you suggested.
> Agree :-) There was some conversation recently about incrementing it
> per
> kernel release vs real api change. I don't remember what the outcome
> was exactly.

I see, thanks. Anything else you'd like me to change?

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 20:39           ` Luca Boccassi
@ 2019-03-20 20:44             ` Stanislav Fomichev
  2019-03-20 20:54               ` Daniel Borkmann
  0 siblings, 1 reply; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-20 20:44 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev

On 03/20, Luca Boccassi wrote:
> On Wed, 2019-03-20 at 10:21 -0700, Stanislav Fomichev wrote:
> > On 03/20, Luca Boccassi wrote:
> > > On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
> > > > On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> > > > > On 03/19, Luca Boccassi wrote:
> > > > > > Generate a libbpf.pc file at build time so that users can
> > > > > > rely
> > > > > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > > > > 
> > > > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > > > > > ---
> > > > > > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> > > > > >     save kernel version in its own variable instead of
> > > > > > calling
> > > > > >     make inline
> > > > > > 
> > > > > >  tools/lib/bpf/.gitignore         |  1 +
> > > > > >  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> > > > > >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> > > > > >  3 files changed, 28 insertions(+), 3 deletions(-)
> > > > > >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > > > > > 
> > > > > > diff --git a/tools/lib/bpf/.gitignore
> > > > > > b/tools/lib/bpf/.gitignore
> > > > > > index 4db74758c674..7d9e182a1f51 100644
> > > > > > --- a/tools/lib/bpf/.gitignore
> > > > > > +++ b/tools/lib/bpf/.gitignore
> > > > > > @@ -1,3 +1,4 @@
> > > > > >  libbpf_version.h
> > > > > > +libbpf.pc
> > > > > >  FEATURE-DUMP.libbpf
> > > > > >  test_libbpf
> > > > > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > > > > > index a05c43468bd0..1df3ebfb3118 100644
> > > > > > --- a/tools/lib/bpf/Makefile
> > > > > > +++ b/tools/lib/bpf/Makefile
> > > > > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> > > > > >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> > > > > >  
> > > > > >  LIB_FILE = libbpf.a libbpf.so
> > > > > > +PC_FILE = libbpf.pc
> > > > > >  
> > > > > >  VERSION		= $(BPF_VERSION)
> > > > > >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > > > > > @@ -89,6 +90,7 @@ OBJ		= $@
> > > > > >  N		=
> > > > > >  
> > > > > >  LIBBPF_VERSION =
> > > > > > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> > > > > > +KERNEL_VERSION = $(shell make --no-print-directory -sC
> > > > > > ../../..
> > > > > > kernelversion)
> > > > > Oh, we do already have LIBBPF_VERSION, why not use that? This
> > > > > way
> > > > > you don't need to do anything for out-of-tree libbpf from
> > > > > github.
> > > > > 
> > > > > I don't remember what was the strategy regarding libbpf
> > > > > versioning,
> > > > > but
> > > > > that 0.0.1 should be changed to something sensible (be set to
> > > > > the
> > > > > kernel
> > > > > version upon release?)
> > > > 
> > > > [re-sending as reply via phone added html and the list daemon
> > > > said
> > > > no-
> > > > no]
> > > > 
> > > > That looks like the ABI version though, rather than the source
> > > > version?
> > > > The source version is more appropriate for the PC file
> > > 
> > > That said, the versioning looks looks like it could use some love
> > > and
> > > it's not really a factor that should gate a pkg-config file and
> > > could
> > > be done separately if required, so in v3 I've removed
> > > KERNEL_VERSION
> > > and used LIBBPF_VERSION as you suggested.
> > Agree :-) There was some conversation recently about incrementing it
> > per
> > kernel release vs real api change. I don't remember what the outcome
> > was exactly.
> 
> I see, thanks. Anything else you'd like me to change?
No, everything looks good to me, wait for the reply from the bpf
maintainers.

> -- 
> Kind regards,
> Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 20:44             ` Stanislav Fomichev
@ 2019-03-20 20:54               ` Daniel Borkmann
  2019-03-20 21:13                 ` Stanislav Fomichev
  0 siblings, 1 reply; 31+ messages in thread
From: Daniel Borkmann @ 2019-03-20 20:54 UTC (permalink / raw)
  To: Stanislav Fomichev, Luca Boccassi; +Cc: netdev

On 03/20/2019 09:44 PM, Stanislav Fomichev wrote:
> On 03/20, Luca Boccassi wrote:
>> On Wed, 2019-03-20 at 10:21 -0700, Stanislav Fomichev wrote:
>>> On 03/20, Luca Boccassi wrote:
>>>> On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
>>>>> On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
>>>>>> On 03/19, Luca Boccassi wrote:
>>>>>>> Generate a libbpf.pc file at build time so that users can
>>>>>>> rely
>>>>>>> on pkg-config to find the library, its CFLAGS and LDFLAGS.
>>>>>>>
>>>>>>> Signed-off-by: Luca Boccassi <bluca@debian.org>
>>>>>>> ---
>>>>>>> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>>>>>>>     save kernel version in its own variable instead of
>>>>>>> calling
>>>>>>>     make inline
>>>>>>>
>>>>>>>  tools/lib/bpf/.gitignore         |  1 +
>>>>>>>  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
>>>>>>>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
>>>>>>>  3 files changed, 28 insertions(+), 3 deletions(-)
>>>>>>>  create mode 100644 tools/lib/bpf/libbpf.pc.template
>>>>>>>
>>>>>>> diff --git a/tools/lib/bpf/.gitignore
>>>>>>> b/tools/lib/bpf/.gitignore
>>>>>>> index 4db74758c674..7d9e182a1f51 100644
>>>>>>> --- a/tools/lib/bpf/.gitignore
>>>>>>> +++ b/tools/lib/bpf/.gitignore
>>>>>>> @@ -1,3 +1,4 @@
>>>>>>>  libbpf_version.h
>>>>>>> +libbpf.pc
>>>>>>>  FEATURE-DUMP.libbpf
>>>>>>>  test_libbpf
>>>>>>> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
>>>>>>> index a05c43468bd0..1df3ebfb3118 100644
>>>>>>> --- a/tools/lib/bpf/Makefile
>>>>>>> +++ b/tools/lib/bpf/Makefile
>>>>>>> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
>>>>>>>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
>>>>>>>  
>>>>>>>  LIB_FILE = libbpf.a libbpf.so
>>>>>>> +PC_FILE = libbpf.pc
>>>>>>>  
>>>>>>>  VERSION		= $(BPF_VERSION)
>>>>>>>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
>>>>>>> @@ -89,6 +90,7 @@ OBJ		= $@
>>>>>>>  N		=
>>>>>>>  
>>>>>>>  LIBBPF_VERSION =
>>>>>>> $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
>>>>>>> +KERNEL_VERSION = $(shell make --no-print-directory -sC
>>>>>>> ../../..
>>>>>>> kernelversion)
>>>>>> Oh, we do already have LIBBPF_VERSION, why not use that? This
>>>>>> way
>>>>>> you don't need to do anything for out-of-tree libbpf from
>>>>>> github.
>>>>>>
>>>>>> I don't remember what was the strategy regarding libbpf
>>>>>> versioning,
>>>>>> but
>>>>>> that 0.0.1 should be changed to something sensible (be set to
>>>>>> the
>>>>>> kernel
>>>>>> version upon release?)
>>>>>
>>>>> [re-sending as reply via phone added html and the list daemon
>>>>> said
>>>>> no-
>>>>> no]
>>>>>
>>>>> That looks like the ABI version though, rather than the source
>>>>> version?
>>>>> The source version is more appropriate for the PC file
>>>>
>>>> That said, the versioning looks looks like it could use some love
>>>> and
>>>> it's not really a factor that should gate a pkg-config file and
>>>> could
>>>> be done separately if required, so in v3 I've removed
>>>> KERNEL_VERSION
>>>> and used LIBBPF_VERSION as you suggested.
>>> Agree :-) There was some conversation recently about incrementing it
>>> per
>>> kernel release vs real api change. I don't remember what the outcome
>>> was exactly.
>>
>> I see, thanks. Anything else you'd like me to change?
> No, everything looks good to me, wait for the reply from the bpf
> maintainers.

Current workflow regarding libbpf versioning is that version number
increase is synced with kernel release. Meaning, new development cycle
we bump the version when we e.g. add entries into libbpf.map file for
new api functions.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 20:54               ` Daniel Borkmann
@ 2019-03-20 21:13                 ` Stanislav Fomichev
  0 siblings, 0 replies; 31+ messages in thread
From: Stanislav Fomichev @ 2019-03-20 21:13 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Luca Boccassi, netdev

On 03/20, Daniel Borkmann wrote:
> On 03/20/2019 09:44 PM, Stanislav Fomichev wrote:
> > On 03/20, Luca Boccassi wrote:
> >> On Wed, 2019-03-20 at 10:21 -0700, Stanislav Fomichev wrote:
> >>> On 03/20, Luca Boccassi wrote:
> >>>> On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote:
> >>>>> On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote:
> >>>>>> On 03/19, Luca Boccassi wrote:
> >>>>>>> Generate a libbpf.pc file at build time so that users can
> >>>>>>> rely
> >>>>>>> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> >>>>>>>
> >>>>>>> Signed-off-by: Luca Boccassi <bluca@debian.org>
> >>>>>>> ---
> >>>>>>> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> >>>>>>>     save kernel version in its own variable instead of
> >>>>>>> calling
> >>>>>>>     make inline
> >>>>>>>
> >>>>>>>  tools/lib/bpf/.gitignore         |  1 +
> >>>>>>>  tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
> >>>>>>>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> >>>>>>>  3 files changed, 28 insertions(+), 3 deletions(-)
> >>>>>>>  create mode 100644 tools/lib/bpf/libbpf.pc.template
> >>>>>>>
> >>>>>>> diff --git a/tools/lib/bpf/.gitignore
> >>>>>>> b/tools/lib/bpf/.gitignore
> >>>>>>> index 4db74758c674..7d9e182a1f51 100644
> >>>>>>> --- a/tools/lib/bpf/.gitignore
> >>>>>>> +++ b/tools/lib/bpf/.gitignore
> >>>>>>> @@ -1,3 +1,4 @@
> >>>>>>>  libbpf_version.h
> >>>>>>> +libbpf.pc
> >>>>>>>  FEATURE-DUMP.libbpf
> >>>>>>>  test_libbpf
> >>>>>>> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> >>>>>>> index a05c43468bd0..1df3ebfb3118 100644
> >>>>>>> --- a/tools/lib/bpf/Makefile
> >>>>>>> +++ b/tools/lib/bpf/Makefile
> >>>>>>> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> >>>>>>>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> >>>>>>>  
> >>>>>>>  LIB_FILE = libbpf.a libbpf.so
> >>>>>>> +PC_FILE = libbpf.pc
> >>>>>>>  
> >>>>>>>  VERSION		= $(BPF_VERSION)
> >>>>>>>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> >>>>>>> @@ -89,6 +90,7 @@ OBJ		= $@
> >>>>>>>  N		=
> >>>>>>>  
> >>>>>>>  LIBBPF_VERSION =
> >>>>>>> $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
> >>>>>>> +KERNEL_VERSION = $(shell make --no-print-directory -sC
> >>>>>>> ../../..
> >>>>>>> kernelversion)
> >>>>>> Oh, we do already have LIBBPF_VERSION, why not use that? This
> >>>>>> way
> >>>>>> you don't need to do anything for out-of-tree libbpf from
> >>>>>> github.
> >>>>>>
> >>>>>> I don't remember what was the strategy regarding libbpf
> >>>>>> versioning,
> >>>>>> but
> >>>>>> that 0.0.1 should be changed to something sensible (be set to
> >>>>>> the
> >>>>>> kernel
> >>>>>> version upon release?)
> >>>>>
> >>>>> [re-sending as reply via phone added html and the list daemon
> >>>>> said
> >>>>> no-
> >>>>> no]
> >>>>>
> >>>>> That looks like the ABI version though, rather than the source
> >>>>> version?
> >>>>> The source version is more appropriate for the PC file
> >>>>
> >>>> That said, the versioning looks looks like it could use some love
> >>>> and
> >>>> it's not really a factor that should gate a pkg-config file and
> >>>> could
> >>>> be done separately if required, so in v3 I've removed
> >>>> KERNEL_VERSION
> >>>> and used LIBBPF_VERSION as you suggested.
> >>> Agree :-) There was some conversation recently about incrementing it
> >>> per
> >>> kernel release vs real api change. I don't remember what the outcome
> >>> was exactly.
> >>
> >> I see, thanks. Anything else you'd like me to change?
> > No, everything looks good to me, wait for the reply from the bpf
> > maintainers.
> 
> Current workflow regarding libbpf versioning is that version number
> increase is synced with kernel release. Meaning, new development cycle
> we bump the version when we e.g. add entries into libbpf.map file for
> new api functions.
So it will have its own version, not matching the kernel? I thought we
would keep it 0.0.X until we figure things out and then just follow the
kernel. (I'm fine either way, just wondering).

It's still 0.0.1 in Linus's tree, bpf and in bpf-next btw, even though we
already have LIBBPF_0.0.2 in the libbpf.map file :-)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v3] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 13:28 ` [PATCH bpf-next v3] " luca.boccassi
@ 2019-03-20 23:58   ` Andrey Ignatov
  2019-03-21 10:29     ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Andrey Ignatov @ 2019-03-20 23:58 UTC (permalink / raw)
  To: luca.boccassi; +Cc: netdev, sdf

luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Wed, 2019-03-20 06:28 -0700]:
> From: Luca Boccassi <bluca@debian.org>
> 
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>     save kernel version in its own variable instead of calling
>     make inline
> v3: use LIBBPF_VERSION instead of kernel_version
> 
>  tools/lib/bpf/.gitignore         |  1 +
>  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
>  3 files changed, 27 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/bpf/libbpf.pc.template
> 
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index 4db74758c674..7d9e182a1f51 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -1,3 +1,4 @@
>  libbpf_version.h
> +libbpf.pc
>  FEATURE-DUMP.libbpf
>  test_libbpf
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 61aaacf0cfa1..891fe3da1410 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile

Commenting here rather than on v1/v2 discussion.

Makefile on the github mirror is completely different one:
https://github.com/libbpf/libbpf/blob/master/src/Makefile

It was done like this to avoid the need to patch copied Makefile, mirror
as few files as possible and avoid things like kernel & tools UAPI
comparison, "feature" tests and other kernel-tree-only stuff that is not
applicable to out-of-tree code.

I.e. if somebody uses libbpf mirror and wants to support pkg-config they
would need to make similar changes there.

Just wondering if you plan to create a package using kernel tree?

> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
>  
>  LIB_FILE = libbpf.a libbpf.so
> +PC_FILE = libbpf.pc
>  
>  VERSION		= $(BPF_VERSION)
>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
>  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
>  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>  
> -CMD_TARGETS = $(LIB_FILE)
> +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
>  
>  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
>  
> @@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
>  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
>  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
>  
> +$(OUTPUT)libbpf.pc:
> +	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
> +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> +		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
> +		< $@.template > $@
> +
>  check: check_abi
>  
>  check_abi: $(OUTPUT)libbpf.so
> @@ -209,7 +216,12 @@ install_headers:
>  		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
>  		$(call do_install,btf.h,$(prefix)/include/bpf,644);
>  
> -install: install_lib
> +install_pkgconfig: $(PC_FILE)
> +	$(call QUIET_INSTALL, $(PC_FILE)) \
> +		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
> +
> +
> +install: install_lib install_pkgconfig

Should it be part of 'install'? Not everyone needs pc file.  Also pc
template below relies on headers to be installed along with the library
itself, but headers are not installed as part of 'install' target,
they're in a separate 'install_headers' one, so 'install_pkgconfig' and
'install_headers' should probably be consistent in this regard.


>  ### Cleaning rules
>  
> @@ -219,7 +231,7 @@ config-clean:
>  
>  clean:
>  	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
> -		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
> +		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
>  	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
>  
>  
> diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
> new file mode 100644
> index 000000000000..0cac2f5f54a6
> --- /dev/null
> +++ b/tools/lib/bpf/libbpf.pc.template
> @@ -0,0 +1,11 @@
> +prefix=@PREFIX@
> +libdir=@LIBDIR@
> +includedir=${prefix}/include/bpf

I guess it should be includedir=${prefix}/include.

Paths in '#include' are usually provided relative to ${prefix}/include,
e.g. all programs I have access to and that use libbpf do this:

  #include <bpf/bpf.h>
  #include <bpf/libbpf.h>


But `includedir=${prefix}/include/bpf` will force it to be:
  #include <bpf.h>
  #include <libbpf.h>

, what may create inconsistency with already written code.

I also checked .pc files on my devbox and this is what I see:

  % grep -h includedir /usr/share/pkgconfig/*.pc | sort | uniq -c
       28 Cflags: -I${includedir}
        1 Cflags: -I${includedir}/X11/dri
       29 includedir=/usr/include


> +
> +Name: libbpf
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> +Description: Linux kernel BPF library
> +Version: @VERSION@
> +Libs: -L${libdir} -lbpf
> +Requires.private: libelf
> +Cflags: -I${includedir}
> -- 
> 2.20.1
> 

-- 
Andrey Ignatov

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
                   ` (2 preceding siblings ...)
  2019-03-20 13:28 ` [PATCH bpf-next v3] " luca.boccassi
@ 2019-03-21 10:25 ` luca.boccassi
  2019-03-21 16:00   ` Andrey Ignatov
  2019-03-21 22:27 ` [PATCH bpf-next v5] " luca.boccassi
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 31+ messages in thread
From: luca.boccassi @ 2019-03-21 10:25 UTC (permalink / raw)
  To: netdev; +Cc: rdna

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version
v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
    in the Cflags field as requested, to keep consistency with
    how the headers are used now and to avoid a dependency from
    the pc file to the headers installation

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 18 +++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 61aaacf0cfa1..891fe3da1410 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -209,7 +216,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -219,7 +231,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..0ecd334c109f
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libbpf
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+Description: Linux kernel BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v3] tools/bpf: generate pkg-config file for libbpf
  2019-03-20 23:58   ` Andrey Ignatov
@ 2019-03-21 10:29     ` Luca Boccassi
  0 siblings, 0 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-21 10:29 UTC (permalink / raw)
  To: Andrey Ignatov; +Cc: netdev, sdf

On Wed, 2019-03-20 at 23:58 +0000, Andrey Ignatov wrote:
> luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Wed, 2019-03-20
> 06:28 -0700]:
> > From: Luca Boccassi <bluca@debian.org>
> > 
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> >     save kernel version in its own variable instead of calling
> >     make inline
> > v3: use LIBBPF_VERSION instead of kernel_version
> > 
> >  tools/lib/bpf/.gitignore         |  1 +
> >  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
> >  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
> >  3 files changed, 27 insertions(+), 3 deletions(-)
> >  create mode 100644 tools/lib/bpf/libbpf.pc.template
> > 
> > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > index 4db74758c674..7d9e182a1f51 100644
> > --- a/tools/lib/bpf/.gitignore
> > +++ b/tools/lib/bpf/.gitignore
> > @@ -1,3 +1,4 @@
> >  libbpf_version.h
> > +libbpf.pc
> >  FEATURE-DUMP.libbpf
> >  test_libbpf
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index 61aaacf0cfa1..891fe3da1410 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> 
> Commenting here rather than on v1/v2 discussion.
> 
> Makefile on the github mirror is completely different one:
> https://github.com/libbpf/libbpf/blob/master/src/Makefile
> 
> It was done like this to avoid the need to patch copied Makefile,
> mirror
> as few files as possible and avoid things like kernel & tools UAPI
> comparison, "feature" tests and other kernel-tree-only stuff that is
> not
> applicable to out-of-tree code.
> 
> I.e. if somebody uses libbpf mirror and wants to support pkg-config
> they
> would need to make similar changes there.

I'm happy to work on a patch for that tree as well, once this one is
accepted.

> Just wondering if you plan to create a package using kernel tree?

Debian already is distributing a libbpf package built from the kernel
source tree, it will be part of Debian 10 (note: I'm not a Debian
kernel maintainer):

https://packages.debian.org/buster/libbpf4.19

> > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
> >  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
> >  
> >  LIB_FILE = libbpf.a libbpf.so
> > +PC_FILE = libbpf.pc
> >  
> >  VERSION		= $(BPF_VERSION)
> >  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> > @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide
> > $(BPF_IN) | \
> >  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so
> > | \
> >  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |
> > sort -u | wc -l)
> >  
> > -CMD_TARGETS = $(LIB_FILE)
> > +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
> >  
> >  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
> >  
> > @@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
> >  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
> >  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
> >  
> > +$(OUTPUT)libbpf.pc:
> > +	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
> > +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> > +		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
> > +		< $@.template > $@
> > +
> >  check: check_abi
> >  
> >  check_abi: $(OUTPUT)libbpf.so
> > @@ -209,7 +216,12 @@ install_headers:
> >  		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
> >  		$(call do_install,btf.h,$(prefix)/include/bpf,644);
> >  
> > -install: install_lib
> > +install_pkgconfig: $(PC_FILE)
> > +	$(call QUIET_INSTALL, $(PC_FILE)) \
> > +		$(call
> > do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
> > +
> > +
> > +install: install_lib install_pkgconfig
> 
> Should it be part of 'install'? Not everyone needs pc file.  Also pc
> template below relies on headers to be installed along with the
> library
> itself, but headers are not installed as part of 'install' target,
> they're in a separate 'install_headers' one, so 'install_pkgconfig'
> and
> 'install_headers' should probably be consistent in this regard.

I believe it should be part of the install rule - if somebody does not
need the pc file, they can simply ignore it - it's just a small text
file, it won't break anything. The vast majority of libraries that have
a pc file just ship it, and users that don't want to use them, just
don't.

The reason to always ship it is so that downstream projects can rely on
it existing if libbpf is installed, without having to do awkward dances
and fallbacks if packagers forget or fail to notice that there's an
additional special install rule. In other words, a Meson project can
rely on "dependency('libbpf')" and an autotools project can rely on
"PKG_CHECK_MODULES([libbpf], [libbpf]" being accurate and
authoritative. Which doesn't mean it's mandatory to use - just that
there are strong guarantees for users and distributors, if they choose
to use those macros and tools. It makes things simpler and nicer for
them, and "just work" in the most common use case.

And it's not dependent on install_headers if we change the include flag
- -I/usr/include actually gets automatically pruned by pkg-config --
cflags. It is dependent on it if we keep -I/usr/include/bpf, but I'll
change it as you suggested, more on that below.

> >  ### Cleaning rules
> >  
> > @@ -219,7 +231,7 @@ config-clean:
> >  
> >  clean:
> >  	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET)
> > \
> > -		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
> > +		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
> >  	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-
> > DUMP.libbpf
> >  
> >  
> > diff --git a/tools/lib/bpf/libbpf.pc.template
> > b/tools/lib/bpf/libbpf.pc.template
> > new file mode 100644
> > index 000000000000..0cac2f5f54a6
> > --- /dev/null
> > +++ b/tools/lib/bpf/libbpf.pc.template
> > @@ -0,0 +1,11 @@
> > +prefix=@PREFIX@
> > +libdir=@LIBDIR@
> > +includedir=${prefix}/include/bpf
> 
> I guess it should be includedir=${prefix}/include.
> 
> Paths in '#include' are usually provided relative to
> ${prefix}/include,
> e.g. all programs I have access to and that use libbpf do this:
> 
>   #include <bpf/bpf.h>
>   #include <bpf/libbpf.h>
> 
> 
> But `includedir=${prefix}/include/bpf` will force it to be:
>   #include <bpf.h>
>   #include <libbpf.h>
> 
> , what may create inconsistency with already written code.

Given /usr/include is always included by the compiler, one can actually
use both ways, even in the same program, and it seems to work fine
(just tested to be 100% sure) - so there's no breakage, but there is
certainly inconsistency, especially as you say with existing code, as
the pc file was not there from day 1. And I like consistency too :-)

> I also checked .pc files on my devbox and this is what I see:
> 
>   % grep -h includedir /usr/share/pkgconfig/*.pc | sort | uniq -c
>        28 Cflags: -I${includedir}
>         1 Cflags: -I${includedir}/X11/dri
>        29 includedir=/usr/include

pkg-config files from libraries are installed under
/usr/lib/*/pkgconfig, rather than /usr/share, if you run the command
there you'll see:

$ grep -h includedir /usr/lib/*/pkgconfig/*.pc | sort | uniq -c
      2 archincludedir=${includedir}/${arch}
     85 Cflags: -I${includedir}
      9 Cflags: -I${includedir} 
      1 Cflags: -I${includedir}  
      1 Cflags: -I${includedir}/atk-1.0
      1 Cflags: -I${includedir}/at-spi-2.0
      1 Cflags: -I${includedir}/at-spi2-atk/2.0
      1 Cflags: -I${includedir}/blkid
      1 Cflags: -I${includedir}/cairo
     13 Cflags: -I${includedir}/cairo 
      1 Cflags: -I${includedir}/dbus-1.0
      1 Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include 
      3 Cflags: -I${includedir} -D_REENTRANT
      1 Cflags: -I${includedir}/et -I${includedir}
      1 Cflags: -I${includedir}/freetype2
      1 Cflags: -I${includedir}/fribidi
      1 Cflags: -I${includedir}/gck-1
      2 Cflags: -I${includedir}/gcr-3
      2 Cflags: -I${includedir}/gdk-pixbuf-2.0
      1 Cflags: -I${includedir}/gio-unix-2.0
      1 Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
      2 Cflags: -I${includedir}/gtk-2.0 
      2 Cflags: -I${includedir}/gtk-2.0 -I${libdir}/gtk-2.0/include 
      8 Cflags: -I${includedir}/gtk-3.0 
      1 Cflags: -I${includedir}/gtk-3.0/unix-print
      1 Cflags: -I${includedir}/gtk-unix-print-2.0
      3 Cflags: -I${includedir}/harfbuzz
      1 Cflags: -I${includedir} -I${includedir}/alsa
      4 Cflags: -I${includedir} -I${includedir}/libdrm
      1 Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau
      1 Cflags: -I${includedir}/libmount
      2 Cflags: -I${includedir}/libnl3
      1 Cflags: -I${includedir}/libnm
      1 Cflags: -I${includedir}/libsecret-1
      1 Cflags: -I${includedir}/libxml2 
      1 Cflags: -I${includedir}/p11-kit-1
      4 Cflags: -I${includedir}/pango-1.0
      1 Cflags: -I${includedir}/pgm-5.2
      1 Cflags: -I${includedir}/pixman-1
      3 Cflags: -I${includedir} -pthread
      3 Cflags: -I${includedir}/python2.7  -I${includedir}/x86_64-linux-gnu/python2.7
      3 Cflags: -I${includedir}/python3.7m -I${includedir}/x86_64-linux-gnu/python3.7m
      1 Cflags: -I${includedir}/SDL -D_GNU_SOURCE=1 -D_REENTRANT
      1 Cflags: -I${includedir}/uuid
      6 Cflags: -isystem ${includedir}
      1 Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY
      1 # -I${includedir}/alsa below is just for backward compatibility
      3 includedir = ${prefix}/include
    171 includedir=${prefix}/include
      1 includedir=${prefix}/include/ayatana-messaging-menu
      2 includedir=${prefix}/include/libpng16
      6 includedir=${prefix}/include/mit-krb5
      1 includedir=${prefix}/include/PCSC
      4 includedir=${prefix}/include/x86_64-linux-gnu
     19 includedir=/usr/include
      2 rubyarchhdrdir=${archincludedir}/${RUBY_VERSION_NAME}
      2 rubyhdrdir=${includedir}/${RUBY_VERSION_NAME}
      2 sitearchhdrdir=${sitearchincludedir}/${RUBY_VERSION_NAME}/site_ruby
      2 sitearchincludedir=${includedir}/${sitearch}
      2 vendorarchhdrdir=${sitearchincludedir}/${RUBY_VERSION_NAME}/vendor_ruby

$ grep -h includedir /usr/lib/pkgconfig/*.pc | sort | uniq -c
      1 Cflags: -I${includedir}/libpurple
      1 Cflags: -I${includedir}/pidgin
      2 includedir=${prefix}/include


The vast majority does just include the canonical /usr/include path,
but it's not uncommon to include the subdirectory as well. That's done
so that users can include just the headers, which will work on any
platform, and also when there are multiple source versions of the same
library available on the system at the same time, and then a user picks
the right pkg-config to parse at build time - the code doesn't have to
change the include path. But it is by no mean a hard rule, and it's up
to the individual developers.

Having said that, none of those apply at the moment and I don't see
that they will in the future - certainly there's no multi-platform
requirement, and hopefully there won't be backward-incompatible API
breakages, hint hint :-)

And there is a good reason to just include /usr/include - so that pkg-
config omits it by default, and there's no dependency on the headers
actually being installed (if -I/usr/include/bpf is passed, then
compiling with werror fails if the directory doesn't exist).

So I've changed the path in v4 to just -I${prefix}/include.

Thanks for the review!

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 10:25 ` [PATCH bpf-next v4] " luca.boccassi
@ 2019-03-21 16:00   ` Andrey Ignatov
  2019-03-21 22:01     ` Alexei Starovoitov
  0 siblings, 1 reply; 31+ messages in thread
From: Andrey Ignatov @ 2019-03-21 16:00 UTC (permalink / raw)
  To: luca.boccassi; +Cc: netdev

luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Thu, 2019-03-21 03:26 -0700]:
> From: Luca Boccassi <bluca@debian.org>
> 
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>     save kernel version in its own variable instead of calling
>     make inline
> v3: use LIBBPF_VERSION instead of kernel_version
> v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
>     in the Cflags field as requested, to keep consistency with
>     how the headers are used now and to avoid a dependency from
>     the pc file to the headers installation

Thanks for the change Luca!
The other part about install target is nit, so no strong preference.

Acked-by: Andrey Ignatov <rdna@fb.com>


>  tools/lib/bpf/.gitignore         |  1 +
>  tools/lib/bpf/Makefile           | 18 +++++++++++++++---
>  tools/lib/bpf/libbpf.pc.template | 11 +++++++++++
>  3 files changed, 27 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/bpf/libbpf.pc.template
> 
> diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> index 4db74758c674..7d9e182a1f51 100644
> --- a/tools/lib/bpf/.gitignore
> +++ b/tools/lib/bpf/.gitignore
> @@ -1,3 +1,4 @@
>  libbpf_version.h
> +libbpf.pc
>  FEATURE-DUMP.libbpf
>  test_libbpf
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 61aaacf0cfa1..891fe3da1410 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
>  libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
>  
>  LIB_FILE = libbpf.a libbpf.so
> +PC_FILE = libbpf.pc
>  
>  VERSION		= $(BPF_VERSION)
>  PATCHLEVEL	= $(BPF_PATCHLEVEL)
> @@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
>  VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
>  			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>  
> -CMD_TARGETS = $(LIB_FILE)
> +CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
>  
>  CXX_TEST_TARGET = $(OUTPUT)test_libbpf
>  
> @@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
>  $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
>  	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
>  
> +$(OUTPUT)libbpf.pc:
> +	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
> +		-e "s|@LIBDIR@|$(libdir_SQ)|" \
> +		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
> +		< $@.template > $@
> +
>  check: check_abi
>  
>  check_abi: $(OUTPUT)libbpf.so
> @@ -209,7 +216,12 @@ install_headers:
>  		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
>  		$(call do_install,btf.h,$(prefix)/include/bpf,644);
>  
> -install: install_lib
> +install_pkgconfig: $(PC_FILE)
> +	$(call QUIET_INSTALL, $(PC_FILE)) \
> +		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
> +
> +
> +install: install_lib install_pkgconfig
>  
>  ### Cleaning rules
>  
> @@ -219,7 +231,7 @@ config-clean:
>  
>  clean:
>  	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
> -		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
> +		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
>  	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
>  
>  
> diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
> new file mode 100644
> index 000000000000..0ecd334c109f
> --- /dev/null
> +++ b/tools/lib/bpf/libbpf.pc.template
> @@ -0,0 +1,11 @@
> +prefix=@PREFIX@
> +libdir=@LIBDIR@
> +includedir=${prefix}/include
> +
> +Name: libbpf
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> +Description: Linux kernel BPF library
> +Version: @VERSION@
> +Libs: -L${libdir} -lbpf
> +Requires.private: libelf
> +Cflags: -I${includedir}
> -- 
> 2.20.1
> 

-- 
Andrey Ignatov

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 16:00   ` Andrey Ignatov
@ 2019-03-21 22:01     ` Alexei Starovoitov
  2019-03-21 22:19       ` Daniel Borkmann
  2019-03-21 22:23       ` Luca Boccassi
  0 siblings, 2 replies; 31+ messages in thread
From: Alexei Starovoitov @ 2019-03-21 22:01 UTC (permalink / raw)
  To: Andrey Ignatov; +Cc: luca.boccassi, netdev, bpf, daniel

On Thu, Mar 21, 2019 at 04:00:46PM +0000, Andrey Ignatov wrote:
> luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Thu, 2019-03-21 03:26 -0700]:
> > From: Luca Boccassi <bluca@debian.org>
> > 
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
...
> > diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
> > new file mode 100644
> > index 000000000000..0ecd334c109f
> > --- /dev/null
> > +++ b/tools/lib/bpf/libbpf.pc.template
> > @@ -0,0 +1,11 @@
> > +prefix=@PREFIX@
> > +libdir=@LIBDIR@
> > +includedir=${prefix}/include
> > +
> > +Name: libbpf
> > +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > +Description: Linux kernel BPF library

github/libbpf/libbpf is a true mirror of kernel's libbpf.
I think if we start shipping libbpf.so from kernel and from github
it will be very confusing to the users...
Which one is the true libbpf?
Also the package should mention the license.
And the license for libbpf is dual lgpl/bsd.
But if we point to the url above it will not make much sense.
I think the packages URL should point to github/libbpf/libbpf
and packaging scripts should be in github only.

Daniel,
what do you think?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 22:01     ` Alexei Starovoitov
@ 2019-03-21 22:19       ` Daniel Borkmann
  2019-03-21 22:34         ` Luca Boccassi
  2019-03-21 22:23       ` Luca Boccassi
  1 sibling, 1 reply; 31+ messages in thread
From: Daniel Borkmann @ 2019-03-21 22:19 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrey Ignatov; +Cc: luca.boccassi, netdev, bpf

On 03/21/2019 11:01 PM, Alexei Starovoitov wrote:
> On Thu, Mar 21, 2019 at 04:00:46PM +0000, Andrey Ignatov wrote:
>> luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Thu, 2019-03-21 03:26 -0700]:
>>> From: Luca Boccassi <bluca@debian.org>
>>>
>>> Generate a libbpf.pc file at build time so that users can rely
>>> on pkg-config to find the library, its CFLAGS and LDFLAGS.
>>>
>>> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ...
>>> diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
>>> new file mode 100644
>>> index 000000000000..0ecd334c109f
>>> --- /dev/null
>>> +++ b/tools/lib/bpf/libbpf.pc.template
>>> @@ -0,0 +1,11 @@
>>> +prefix=@PREFIX@
>>> +libdir=@LIBDIR@
>>> +includedir=${prefix}/include
>>> +
>>> +Name: libbpf
>>> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>> +Description: Linux kernel BPF library
> 
> github/libbpf/libbpf is a true mirror of kernel's libbpf.
> I think if we start shipping libbpf.so from kernel and from github
> it will be very confusing to the users...
> Which one is the true libbpf?
> Also the package should mention the license.
> And the license for libbpf is dual lgpl/bsd.
> But if we point to the url above it will not make much sense.
> I think the packages URL should point to github/libbpf/libbpf
> and packaging scripts should be in github only.
> 
> Daniel,
> what do you think?

Looking at [0], I don't see where license would be part of the keyword. Given
this is just a pkg-config file where folks using it care mainly about the
needed cflags/libs, it would make sense to me to ship it and have it under
tools/lib/bpf/ in kernel tree (since this is distro independent). If the URL
and Description causes confusion, I would probably just remove the URL field
since it's not mandatory either. And description, I'd put something like
'official BPF library' or such, so it's generic enough.

  [0] https://autotools.io/pkgconfig/file-format.html
      https://dev.gentoo.org/~mgorny/pkg-config-spec.html#keywords

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 22:01     ` Alexei Starovoitov
  2019-03-21 22:19       ` Daniel Borkmann
@ 2019-03-21 22:23       ` Luca Boccassi
  1 sibling, 0 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-21 22:23 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrey Ignatov; +Cc: netdev, bpf, daniel

[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]

On Thu, 2019-03-21 at 15:01 -0700, Alexei Starovoitov wrote:
> On Thu, Mar 21, 2019 at 04:00:46PM +0000, Andrey Ignatov wrote:
> > luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Thu, 2019-03-21
> > 03:26 -0700]:
> > > From: Luca Boccassi <bluca@debian.org>
> > > 
> > > Generate a libbpf.pc file at build time so that users can rely
> > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > 
> > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> ...
> > > diff --git a/tools/lib/bpf/libbpf.pc.template
> > > b/tools/lib/bpf/libbpf.pc.template
> > > new file mode 100644
> > > index 000000000000..0ecd334c109f
> > > --- /dev/null
> > > +++ b/tools/lib/bpf/libbpf.pc.template
> > > @@ -0,0 +1,11 @@
> > > +prefix=@PREFIX@
> > > +libdir=@LIBDIR@
> > > +includedir=${prefix}/include
> > > +
> > > +Name: libbpf
> > > +URL: 
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > > +Description: Linux kernel BPF library
> 
> github/libbpf/libbpf is a true mirror of kernel's libbpf.
> I think if we start shipping libbpf.so from kernel and from github
> it will be very confusing to the users...
> Which one is the true libbpf?

I'm afraid that ship already sailed :-) Users and distributions are
already consuming libbpf from the kernel tree.

> Also the package should mention the license.
> And the license for libbpf is dual lgpl/bsd.

I followed the template from the other pkgconfig file (in traceevent)
which does not have it, but I can add it in v5.

> But if we point to the url above it will not make much sense.
> I think the packages URL should point to github/libbpf/libbpf
> and packaging scripts should be in github only.

If only one side ships the pc file, then you'll have half the users
installing libbpf without a pc file, and the other half with it, so it
would defeat the point of having one in the first place.

> Daniel,
> what do you think?
> 
-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v5] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
                   ` (3 preceding siblings ...)
  2019-03-21 10:25 ` [PATCH bpf-next v4] " luca.boccassi
@ 2019-03-21 22:27 ` luca.boccassi
  2019-03-21 22:33 ` [PATCH bpf-next v6] " luca.boccassi
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 31+ messages in thread
From: luca.boccassi @ 2019-03-21 22:27 UTC (permalink / raw)
  To: netdev; +Cc: alexei.starovoitov

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrey Ignatov <rdna@fb.com>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version
v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
    in the Cflags field as requested, to keep consistency with
    how the headers are used now and to avoid a dependency from
    the pc file to the headers installation
v5: add acked-by, add SPDX line to pc file

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 18 +++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 13 +++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 61aaacf0cfa1..891fe3da1410 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -209,7 +216,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -219,7 +231,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..73e9f321f84f
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libbpf
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+Description: Linux kernel BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v6] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
                   ` (4 preceding siblings ...)
  2019-03-21 22:27 ` [PATCH bpf-next v5] " luca.boccassi
@ 2019-03-21 22:33 ` luca.boccassi
  2019-03-21 22:43   ` Alexei Starovoitov
  2019-03-21 23:09 ` [PATCH bpf-next v7] " luca.boccassi
  2019-03-28 11:33 ` [PATCH bpf-next v8] " luca.boccassi
  7 siblings, 1 reply; 31+ messages in thread
From: luca.boccassi @ 2019-03-21 22:33 UTC (permalink / raw)
  To: netdev; +Cc: alexei.starovoitov, daniel

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrey Ignatov <rdna@fb.com>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version
v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
    in the Cflags field as requested, to keep consistency with
    how the headers are used now and to avoid a dependency from
    the pc file to the headers installation
v5: add acked-by, add SPDX line to pc file
v6: remove URL field, generalize Description field

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 18 +++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 12 ++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 61aaacf0cfa1..891fe3da1410 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -137,7 +138,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -180,6 +181,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< $@.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -209,7 +216,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -219,7 +231,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..ac17fcef2108
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libbpf
+Description: BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v4] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 22:19       ` Daniel Borkmann
@ 2019-03-21 22:34         ` Luca Boccassi
  0 siblings, 0 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-21 22:34 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrey Ignatov; +Cc: netdev, bpf

On Thu, 2019-03-21 at 23:19 +0100, Daniel Borkmann wrote:
> On 03/21/2019 11:01 PM, Alexei Starovoitov wrote:
> > On Thu, Mar 21, 2019 at 04:00:46PM +0000, Andrey Ignatov wrote:
> > > luca.boccassi@gmail.com <luca.boccassi@gmail.com> [Thu, 2019-03-
> > > 21 03:26 -0700]:
> > > > From: Luca Boccassi <bluca@debian.org>
> > > > 
> > > > Generate a libbpf.pc file at build time so that users can rely
> > > > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > > > 
> > > > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ...
> > > > diff --git a/tools/lib/bpf/libbpf.pc.template
> > > > b/tools/lib/bpf/libbpf.pc.template
> > > > new file mode 100644
> > > > index 000000000000..0ecd334c109f
> > > > --- /dev/null
> > > > +++ b/tools/lib/bpf/libbpf.pc.template
> > > > @@ -0,0 +1,11 @@
> > > > +prefix=@PREFIX@
> > > > +libdir=@LIBDIR@
> > > > +includedir=${prefix}/include
> > > > +
> > > > +Name: libbpf
> > > > +URL: 
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > > > +Description: Linux kernel BPF library
> > 
> > github/libbpf/libbpf is a true mirror of kernel's libbpf.
> > I think if we start shipping libbpf.so from kernel and from github
> > it will be very confusing to the users...
> > Which one is the true libbpf?
> > Also the package should mention the license.
> > And the license for libbpf is dual lgpl/bsd.
> > But if we point to the url above it will not make much sense.
> > I think the packages URL should point to github/libbpf/libbpf
> > and packaging scripts should be in github only.
> > 
> > Daniel,
> > what do you think?
> 
> Looking at [0], I don't see where license would be part of the
> keyword. Given
> this is just a pkg-config file where folks using it care mainly about
> the
> needed cflags/libs, it would make sense to me to ship it and have it
> under
> tools/lib/bpf/ in kernel tree (since this is distro independent). If
> the URL
> and Description causes confusion, I would probably just remove the
> URL field
> since it's not mandatory either. And description, I'd put something
> like
> 'official BPF library' or such, so it's generic enough.
> 
>   [0] https://autotools.io/pkgconfig/file-format.html
>       https://dev.gentoo.org/~mgorny/pkg-config-spec.html#keywords

I assumed the license referred to the file itself, so I added the SDPX
comment. It's not too uncommon for pc files to have the license comment
at the top.

Removed URL and changed Descriptin in v6, thanks for reviewing!

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v6] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 22:33 ` [PATCH bpf-next v6] " luca.boccassi
@ 2019-03-21 22:43   ` Alexei Starovoitov
  2019-03-21 23:10     ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Alexei Starovoitov @ 2019-03-21 22:43 UTC (permalink / raw)
  To: luca.boccassi; +Cc: netdev, daniel

On Thu, Mar 21, 2019 at 10:33:17PM +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <bluca@debian.org>
> 
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Andrey Ignatov <rdna@fb.com>
> ---
> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>     save kernel version in its own variable instead of calling
>     make inline
> v3: use LIBBPF_VERSION instead of kernel_version
> v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
>     in the Cflags field as requested, to keep consistency with
>     how the headers are used now and to avoid a dependency from
>     the pc file to the headers installation
> v5: add acked-by, add SPDX line to pc file
> v6: remove URL field, generalize Description field

It fails to build:
make -C ../../../lib/bpf OUTPUT=/data/users/ast/bpf-next/tools/testing/selftests/bpf/
make[1]: Entering directory `/data/users/ast/bpf-next/tools/lib/bpf'
make[2]: *** No rule to make target `libbpf.pc', needed by `all_cmd'.  Stop.
make[1]: *** [all] Error 2
make[1]: Leaving directory `/data/users/ast/bpf-next/tools/lib/bpf'


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v7] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
                   ` (5 preceding siblings ...)
  2019-03-21 22:33 ` [PATCH bpf-next v6] " luca.boccassi
@ 2019-03-21 23:09 ` luca.boccassi
  2019-03-26 20:12   ` Alexei Starovoitov
  2019-03-28 11:33 ` [PATCH bpf-next v8] " luca.boccassi
  7 siblings, 1 reply; 31+ messages in thread
From: luca.boccassi @ 2019-03-21 23:09 UTC (permalink / raw)
  To: netdev; +Cc: alexei.starovoitov, daniel

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrey Ignatov <rdna@fb.com>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version
v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
    in the Cflags field as requested, to keep consistency with
    how the headers are used now and to avoid a dependency from
    the pc file to the headers installation
v5: add acked-by, add SPDX line to pc file
v6: remove URL field, generalize Description field
v7: fix build with make OUTPUT=/foo/bar/ by prefixing $(OUTPUT)
    to the pc file variable

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 12 ++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 61aaacf0cfa1..96e9571b0a2e 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir))
 libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 
 LIB_FILE = libbpf.a libbpf.so
+PC_FILE = libbpf.pc
 
 VERSION		= $(BPF_VERSION)
 PATCHLEVEL	= $(BPF_PATCHLEVEL)
@@ -130,6 +131,7 @@ include $(srctree)/tools/build/Makefile.include
 
 BPF_IN    := $(OUTPUT)libbpf-in.o
 LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
+PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE))
 VERSION_SCRIPT := libbpf.map
 
 GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
@@ -137,7 +139,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_FILE)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -180,6 +182,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< libbpf.pc.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -209,7 +217,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -219,7 +232,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..ac17fcef2108
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libbpf
+Description: BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v6] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 22:43   ` Alexei Starovoitov
@ 2019-03-21 23:10     ` Luca Boccassi
  0 siblings, 0 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-21 23:10 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: netdev, daniel

On Thu, 2019-03-21 at 15:43 -0700, Alexei Starovoitov wrote:
> On Thu, Mar 21, 2019 at 10:33:17PM +0000, luca.boccassi@gmail.com
> wrote:
> > From: Luca Boccassi <bluca@debian.org>
> > 
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > Acked-by: Andrey Ignatov <rdna@fb.com>
> > ---
> > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> >     save kernel version in its own variable instead of calling
> >     make inline
> > v3: use LIBBPF_VERSION instead of kernel_version
> > v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
> >     in the Cflags field as requested, to keep consistency with
> >     how the headers are used now and to avoid a dependency from
> >     the pc file to the headers installation
> > v5: add acked-by, add SPDX line to pc file
> > v6: remove URL field, generalize Description field
> 
> It fails to build:
> make -C ../../../lib/bpf OUTPUT=/data/users/ast/bpf-
> next/tools/testing/selftests/bpf/
> make[1]: Entering directory `/data/users/ast/bpf-next/tools/lib/bpf'
> make[2]: *** No rule to make target `libbpf.pc', needed by
> `all_cmd'.  Stop.
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/data/users/ast/bpf-next/tools/lib/bpf'

Thanks, the $(OUTPUT) prefix was missing so the out of tree build
didn't work, fixed in v7.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v7] tools/bpf: generate pkg-config file for libbpf
  2019-03-21 23:09 ` [PATCH bpf-next v7] " luca.boccassi
@ 2019-03-26 20:12   ` Alexei Starovoitov
  2019-03-26 20:17     ` Luca Boccassi
  0 siblings, 1 reply; 31+ messages in thread
From: Alexei Starovoitov @ 2019-03-26 20:12 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: Network Development, Daniel Borkmann

On Thu, Mar 21, 2019 at 4:09 PM <luca.boccassi@gmail.com> wrote:
>
> From: Luca Boccassi <bluca@debian.org>
>
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Andrey Ignatov <rdna@fb.com>
> ---
> v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
>     save kernel version in its own variable instead of calling
>     make inline
> v3: use LIBBPF_VERSION instead of kernel_version
> v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
>     in the Cflags field as requested, to keep consistency with
>     how the headers are used now and to avoid a dependency from
>     the pc file to the headers installation
> v5: add acked-by, add SPDX line to pc file
> v6: remove URL field, generalize Description field
> v7: fix build with make OUTPUT=/foo/bar/ by prefixing $(OUTPUT)
>     to the pc file variable

Applied. Thanks

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v7] tools/bpf: generate pkg-config file for libbpf
  2019-03-26 20:12   ` Alexei Starovoitov
@ 2019-03-26 20:17     ` Luca Boccassi
  0 siblings, 0 replies; 31+ messages in thread
From: Luca Boccassi @ 2019-03-26 20:17 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: Network Development, Daniel Borkmann

On Tue, 2019-03-26 at 13:12 -0700, Alexei Starovoitov wrote:
> On Thu, Mar 21, 2019 at 4:09 PM <
> luca.boccassi@gmail.com
> > wrote:
> > From: Luca Boccassi <
> > bluca@debian.org
> > >
> > 
> > Generate a libbpf.pc file at build time so that users can rely
> > on pkg-config to find the library, its CFLAGS and LDFLAGS.
> > 
> > Signed-off-by: Luca Boccassi <
> > bluca@debian.org
> > >
> > Acked-by: Andrey Ignatov <
> > rdna@fb.com
> > >
> > ---
> > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
> >     save kernel version in its own variable instead of calling
> >     make inline
> > v3: use LIBBPF_VERSION instead of kernel_version
> > v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
> >     in the Cflags field as requested, to keep consistency with
> >     how the headers are used now and to avoid a dependency from
> >     the pc file to the headers installation
> > v5: add acked-by, add SPDX line to pc file
> > v6: remove URL field, generalize Description field
> > v7: fix build with make OUTPUT=/foo/bar/ by prefixing $(OUTPUT)
> >     to the pc file variable
> 
> Applied. Thanks

Thank you! I'll send a patch to the Github mirror as soon as possible.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH bpf-next v8] tools/bpf: generate pkg-config file for libbpf
  2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
                   ` (6 preceding siblings ...)
  2019-03-21 23:09 ` [PATCH bpf-next v7] " luca.boccassi
@ 2019-03-28 11:33 ` luca.boccassi
  2019-03-28 16:09   ` Daniel Borkmann
  7 siblings, 1 reply; 31+ messages in thread
From: luca.boccassi @ 2019-03-28 11:33 UTC (permalink / raw)
  To: netdev; +Cc: alexei.starovoitov

From: Luca Boccassi <bluca@debian.org>

Generate a libbpf.pc file at build time so that users can rely
on pkg-config to find the library, its CFLAGS and LDFLAGS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrey Ignatov <rdna@fb.com>
---
v2: use QUIET_GEN instead of QUIET_LINK to generate pc file,
    save kernel version in its own variable instead of calling
    make inline
v3: use LIBBPF_VERSION instead of kernel_version
v4: use -I${prefix}/include rather than -I${prefix}/include/bpf
    in the Cflags field as requested, to keep consistency with
    how the headers are used now and to avoid a dependency from
    the pc file to the headers installation
v5: add acked-by, add SPDX line to pc file
v6: remove URL field, generalize Description field
v7: fix build with make OUTPUT=/foo/bar/ by prefixing $(OUTPUT)
    to the pc file variable
v8: rebased on latest bpf-next to solve merge conflict
    (not that indentation looks wrong on 2 lines because the
    "+" added by the diff makes the first tab start at the 8th
    column rather than the 7th, it align once applied though)

 tools/lib/bpf/.gitignore         |  1 +
 tools/lib/bpf/Makefile           | 19 ++++++++++++++++---
 tools/lib/bpf/libbpf.pc.template | 12 ++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/bpf/libbpf.pc.template

diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index 4db74758c674..7d9e182a1f51 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,3 +1,4 @@
 libbpf_version.h
+libbpf.pc
 FEATURE-DUMP.libbpf
 test_libbpf
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 5bf8e52c41fc..0fe54fe4cc04 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -90,6 +90,7 @@ LIBBPF_VERSION	= $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
 
 LIB_TARGET	= libbpf.a libbpf.so.$(LIBBPF_VERSION)
 LIB_FILE	= libbpf.a libbpf.so*
+PC_FILE		= libbpf.pc
 
 # Set compile option CFLAGS
 ifdef EXTRA_CFLAGS
@@ -134,13 +135,14 @@ VERSION_SCRIPT	:= libbpf.map
 
 LIB_TARGET	:= $(addprefix $(OUTPUT),$(LIB_TARGET))
 LIB_FILE	:= $(addprefix $(OUTPUT),$(LIB_FILE))
+PC_FILE		:= $(addprefix $(OUTPUT),$(PC_FILE))
 
 GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
 			   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {s++} END{print s}')
 VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
-CMD_TARGETS = $(LIB_TARGET)
+CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
 
 CXX_TEST_TARGET = $(OUTPUT)test_libbpf
 
@@ -187,6 +189,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
 $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
 	$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
 
+$(OUTPUT)libbpf.pc:
+	$(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \
+		-e "s|@LIBDIR@|$(libdir_SQ)|" \
+		-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+		< libbpf.pc.template > $@
+
 check: check_abi
 
 check_abi: $(OUTPUT)libbpf.so
@@ -223,7 +231,12 @@ install_headers:
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644);
 		$(call do_install,btf.h,$(prefix)/include/bpf,644);
 
-install: install_lib
+install_pkgconfig: $(PC_FILE)
+	$(call QUIET_INSTALL, $(PC_FILE)) \
+		$(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
 
 ### Cleaning rules
 
@@ -233,7 +246,7 @@ config-clean:
 
 clean:
 	$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
-		*.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd LIBBPF-CFLAGS
+		*.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd *.pc LIBBPF-CFLAGS
 	$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
 
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..ac17fcef2108
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+
+prefix=@PREFIX@
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libbpf
+Description: BPF library
+Version: @VERSION@
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH bpf-next v8] tools/bpf: generate pkg-config file for libbpf
  2019-03-28 11:33 ` [PATCH bpf-next v8] " luca.boccassi
@ 2019-03-28 16:09   ` Daniel Borkmann
  0 siblings, 0 replies; 31+ messages in thread
From: Daniel Borkmann @ 2019-03-28 16:09 UTC (permalink / raw)
  To: luca.boccassi, netdev; +Cc: alexei.starovoitov

On 03/28/2019 12:33 PM, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <bluca@debian.org>
> 
> Generate a libbpf.pc file at build time so that users can rely
> on pkg-config to find the library, its CFLAGS and LDFLAGS.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Andrey Ignatov <rdna@fb.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2019-03-28 16:10 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 21:06 [PATCH bpf-next] tools/bpf: generate pkg-config file for libbpf Luca Boccassi
2019-03-19 21:23 ` Stanislav Fomichev
2019-03-19 23:02   ` Luca Boccassi
2019-03-19 23:12     ` Stanislav Fomichev
2019-03-19 23:00 ` [PATCH bpf-next v2] " Luca Boccassi
2019-03-19 23:17   ` Stanislav Fomichev
2019-03-20 13:22     ` Luca Boccassi
2019-03-20 13:30       ` Luca Boccassi
2019-03-20 17:21         ` Stanislav Fomichev
2019-03-20 20:39           ` Luca Boccassi
2019-03-20 20:44             ` Stanislav Fomichev
2019-03-20 20:54               ` Daniel Borkmann
2019-03-20 21:13                 ` Stanislav Fomichev
2019-03-20 13:28 ` [PATCH bpf-next v3] " luca.boccassi
2019-03-20 23:58   ` Andrey Ignatov
2019-03-21 10:29     ` Luca Boccassi
2019-03-21 10:25 ` [PATCH bpf-next v4] " luca.boccassi
2019-03-21 16:00   ` Andrey Ignatov
2019-03-21 22:01     ` Alexei Starovoitov
2019-03-21 22:19       ` Daniel Borkmann
2019-03-21 22:34         ` Luca Boccassi
2019-03-21 22:23       ` Luca Boccassi
2019-03-21 22:27 ` [PATCH bpf-next v5] " luca.boccassi
2019-03-21 22:33 ` [PATCH bpf-next v6] " luca.boccassi
2019-03-21 22:43   ` Alexei Starovoitov
2019-03-21 23:10     ` Luca Boccassi
2019-03-21 23:09 ` [PATCH bpf-next v7] " luca.boccassi
2019-03-26 20:12   ` Alexei Starovoitov
2019-03-26 20:17     ` Luca Boccassi
2019-03-28 11:33 ` [PATCH bpf-next v8] " luca.boccassi
2019-03-28 16:09   ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.