diff mbox series

[1/4] package/libtraceevent: new package

Message ID 20230130144655.1193660-2-maxime.chevallier@bootlin.com
State Changes Requested
Headers show
Series introduce the rtla package and its dependencies | expand

Commit Message

Maxime Chevallier Jan. 30, 2023, 2:46 p.m. UTC
Introduce the libtraceevent library, that used to be bundled with the
trace-cmd tool. This library is now used by several tools and libraries
such as trace-cmd, libtracefs and rtla.

This package tries to install libraries in /usr/local/lib by default,
hence the redefinition of the "prefix" variable, so that the library
gets installed in "/usr/lib" instead.

The same applies to the pkgconfig handling of the proved Makefile, which
installs the .pc files in the /usr/local area by default, hence the
redefinition of the pkgconfig_dir to either the correct directory within the
staging area, or to empty value for the target to avoid installing the .pc
in that case.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 DEVELOPERS                             |  3 +++
 package/Config.in                      |  1 +
 package/libtraceevent/Config.in        |  9 +++++++
 package/libtraceevent/libtraceevent.mk | 33 ++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 package/libtraceevent/Config.in
 create mode 100644 package/libtraceevent/libtraceevent.mk

Comments

Yann E. MORIN May 14, 2023, 2:01 p.m. UTC | #1
Maxime, All,

On 2023-01-30 15:46 +0100, Maxime Chevallier via buildroot spake thusly:
> Introduce the libtraceevent library, that used to be bundled with the
> trace-cmd tool. This library is now used by several tools and libraries
> such as trace-cmd, libtracefs and rtla.
> 
> This package tries to install libraries in /usr/local/lib by default,
> hence the redefinition of the "prefix" variable, so that the library
> gets installed in "/usr/lib" instead.
> 
> The same applies to the pkgconfig handling of the proved Makefile, which
> installs the .pc files in the /usr/local area by default, hence the
> redefinition of the pkgconfig_dir to either the correct directory within the
> staging area, or to empty value for the target to avoid installing the .pc
> in that case.
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
>  DEVELOPERS                             |  3 +++
>  package/Config.in                      |  1 +
>  package/libtraceevent/Config.in        |  9 +++++++
>  package/libtraceevent/libtraceevent.mk | 33 ++++++++++++++++++++++++++

Missing hash file, see:
    https://buildroot.org/downloads/manual/manual.html#adding-packages-hash

[--SNIP--]
> diff --git a/package/libtraceevent/libtraceevent.mk b/package/libtraceevent/libtraceevent.mk
> new file mode 100644
> index 0000000000..0125023508
> --- /dev/null
> +++ b/package/libtraceevent/libtraceevent.mk
> @@ -0,0 +1,33 @@
> +################################################################################
> +#
> +# libtraceevent
> +#
> +################################################################################
> +
> +LIBTRACEEVENT_VERSION = 1.7.1
> +LIBTRACEEVENT_SITE = https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot

Are the snapshots generated by git.kernel.org reproducible? I'd prefer
in this case, that we use the git download method.

> +LIBTRACEEVENT_INSTALL_STAGING = YES
> +LIBTRACEEVENT_LICENSE = GPL-2.0, LGPL-2.1
> +LIBTRACEEVENT_LICENSE_FILES = LICENSES/GPL-2.0 LICENSES/LGPL-2.1
> +
> +define LIBTRACEEVENT_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)

Please, try to keep the ordering of common options the same across the
various _CMDS. For example, in _BUILD_CMDS, you have;
    $(TARGET_CONFIGURE_OPTS) -C $(@D)

while in _INSTALL_*_CMDS, you have:
    -C $(@D) $(TARGET_CONFIGURE_OPTS)

> +endef
> +
> +define LIBTRACEEVENT_INSTALL_STAGING_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
> +	DESTDIR=$(STAGING_DIR) \
> +	pkgconfig_dir="/usr/lib/pkgconfig" \
> +	prefix="/usr" \
> +	install

Addiotnally indent continuation lines, i.e.:

    \t  $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
    \t  \t  $(TARGET_CONFIGURE_OPTS) \
    \t  \t  DESTDIR=$(STAGING_DIR) \
    \t  \t  pkgconfig_dir="/usr/lib/pkgconfig" \
    \t  \t  prefix="/usr" \
    \t  \t  install

Why do we need MAKE1 in the install steps, and not in the build step?

Also, don't we need to also pass prefix=/usr at build time? Hmm, the
Makefile gnerates the .pc file at install time, not at build time (this
is not clean, but explains why we don;t need prefix at build time,
maybe?).

Regards,
Yann E. MORIN.

> +endef
> +
> +define LIBTRACEEVENT_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
> +	DESTDIR=$(TARGET_DIR) \
> +	pkgconfig_dir="" \
> +	prefix="/usr" \
> +	install
> +endef
> +
> +$(eval $(generic-package))
> -- 
> 2.39.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 706ee80ece..fcf05e0aa0 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2106,6 +2106,9 @@  F:	package/postgresql/
 F:	package/protozero/
 F:	package/timescaledb/
 
+N:	Maxime Chevallier <maxime.chevallier@bootlin.com>
+F:	package/libtraceevent/
+
 N:	Michael Durrant <mdurrant@arcturusnetworks.com>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
diff --git a/package/Config.in b/package/Config.in
index 83fddf316f..2f0e6dcb18 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -117,6 +117,7 @@  menu "Debugging, profiling and benchmark"
 	source "package/kyua/Config.in"
 	source "package/latencytop/Config.in"
 	source "package/libbpf/Config.in"
+	source "package/libtraceevent/Config.in"
 	source "package/lmbench/Config.in"
 	source "package/lsof/Config.in"
 	source "package/ltp-testsuite/Config.in"
diff --git a/package/libtraceevent/Config.in b/package/libtraceevent/Config.in
new file mode 100644
index 0000000000..d351e3b4de
--- /dev/null
+++ b/package/libtraceevent/Config.in
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_LIBTRACEEVENT
+	bool "libtraceevent"
+	help
+	  libtraceevent is a library that interfaces with the ftrace
+	  subsystem in the linux kernel.
+	  It used to be bundled directly in the trace-cmd
+	  tool, but it was eventually extracted so that it can be used
+	  by multiple other tools and libraries, such as libtracefs and
+	  rtla.
diff --git a/package/libtraceevent/libtraceevent.mk b/package/libtraceevent/libtraceevent.mk
new file mode 100644
index 0000000000..0125023508
--- /dev/null
+++ b/package/libtraceevent/libtraceevent.mk
@@ -0,0 +1,33 @@ 
+################################################################################
+#
+# libtraceevent
+#
+################################################################################
+
+LIBTRACEEVENT_VERSION = 1.7.1
+LIBTRACEEVENT_SITE = https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot
+LIBTRACEEVENT_INSTALL_STAGING = YES
+LIBTRACEEVENT_LICENSE = GPL-2.0, LGPL-2.1
+LIBTRACEEVENT_LICENSE_FILES = LICENSES/GPL-2.0 LICENSES/LGPL-2.1
+
+define LIBTRACEEVENT_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
+endef
+
+define LIBTRACEEVENT_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(STAGING_DIR) \
+	pkgconfig_dir="/usr/lib/pkgconfig" \
+	prefix="/usr" \
+	install
+endef
+
+define LIBTRACEEVENT_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	pkgconfig_dir="" \
+	prefix="/usr" \
+	install
+endef
+
+$(eval $(generic-package))