diff mbox series

[1/1] package/uftrace: new package

Message ID 20201027151407.2870851-2-gabibbo97@gmail.com
State Changes Requested
Headers show
Series [1/1] package/uftrace: new package | expand

Commit Message

Giacomo Longo Oct. 27, 2020, 3:14 p.m. UTC
Signed-off-by: Giacomo Longo <gabibbo97@gmail.com>
---
 DEVELOPERS                   |  3 +++
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 24 ++++++++++++++++++++++++
 package/uftrace/uftrace.hash |  3 +++
 package/uftrace/uftrace.mk   | 35 +++++++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk

Comments

Thomas Petazzoni Nov. 3, 2020, 8:39 p.m. UTC | #1
Hello,

On Tue, 27 Oct 2020 16:14:08 +0100
Giacomo Longo <gabibbo97@gmail.com> wrote:


> diff --git a/package/uftrace/Config.in b/package/uftrace/Config.in
> new file mode 100644
> index 0000000000..4349a5778e
> --- /dev/null
> +++ b/package/uftrace/Config.in
> @@ -0,0 +1,24 @@
> +config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
> +	bool
> +	default y if BR2_aarch64
> +	default y if BR2_arm
> +	default y if BR2_i386
> +	default y if BR2_x86_64
> +
> +config BR2_PACKAGE_UFTRACE
> +	bool "uftrace"
> +	depends on BR2_TOOLCHAIN_USES_GLIBC

In fact the reason why you can only use glibc is two-fold:

 * You select elfutils, and elfutils does not build on musl.

 * uftrace uses ADDR_NO_RANDOMIZE, which isn't supported in uClibc

So it would be good to write something like this:

	# elfutils not available for musl, uClibc-ng does not 
	# provide ADDR_NO_RANDOMIZE, so only glibc is supported
	depends on BR2_TOOLCHAIN_USES_GLIBC

> +comment "uftrace needs a glibc toolchain w/ C++, dynamic library, threads, wchar"
> +	depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
> +	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR

Could you cut this line at ~80 characters, using a backslash ? See
other packages.

> diff --git a/package/uftrace/uftrace.hash b/package/uftrace/uftrace.hash
> new file mode 100644
> index 0000000000..8f38e7431d
> --- /dev/null
> +++ b/package/uftrace/uftrace.hash
> @@ -0,0 +1,3 @@
> +# Locally computed:
> +sha512 f73ad4461051b9c61668161e077897d118ac556d234ff204e32bf14ecdc2c0df148da30ea5d5054641e79ea20b29261d6f637908f5047f5669207ef244865358 uftrace-v0.9.4.tar.gz
> +sha512 aee80b1f9f7f4a8a00dcf6e6ce6c41988dcaedc4de19d9d04460cbfb05d99829ffe8f9d038468eabbfba4d65b38e8dbef5ecf5eb8a1b891d9839cda6c48ee957 COPYING

Could you use sha256 hashes instead ?

> +UFTRACE_VERSION = v0.9.4
> +UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))

Please don't encode the "v" in the version field. So please do:

UFTRACE_VERSION = 0.9.4
UFTRACE_SITE = $(call github,namhyung,uftrace,v$(UFTRACE_VERSION))

Indeed, this will allow UFTRACE_VERSION to be used to check if new
uftrace releases are available, using release-monitoring.org.

> +UFTRACE_LICENSE = GPL-2.0+
> +UFTRACE_LICENSE_FILES = COPYING
> +UFTRACE_DEPENDENCIES = elfutils
> +
> +UFTRACE_CONF_OPTS = \
> +	--without-capstone \
> +	--without-libpython
> +
> +ifeq ($(BR2_aarch64),y)
> +UFTRACE_CONF_OPTS += --arch=aarch64
> +else ifeq ($(BR2_arm),y)
> +UFTRACE_CONF_OPTS += --arch=arm
> +else ifeq ($(BR2_i386),y)
> +UFTRACE_CONF_OPTS += --arch=i386
> +else ifeq ($(BR2_x86_64),y)
> +UFTRACE_CONF_OPTS += --arch=x86_64
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LUAJIT),n)

BR2_PACKAGE_LUAJIT is never going to be "n", so this condition will
never be true. Also, if luajit *is* there, you want luajit to be
compiled before uftrace. So you want something like this:

# No --with-<option> available
ifeq ($(BR2_PACKAGE_LUAJIT),y)
UFTRACE_DEPENDENCIES += luajit
else
UFTRACE_CONF_OPTS += --without-libluajit
endif

> +ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),n)
> +UFTRACE_CONF_OPTS += --without-libncurses
> +endif

Same comment as above.

> +$(eval $(autotools-package))

This is not an autotools-based package: it uses a hand-written
configure script, not one that is generated by autoconf. For example,
this explains why it doesn't support --with-<foo>, but only
--without-<foo>.

So, please use the generic-package infrastructure in this sort of
cases. Using autotools-package should really only be done for packages
that do use autoconf.

Could you adjust your package according to this ?

Thanks a lot!

Thomas
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index ceb9cc9160..1c63e693b3 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -980,6 +980,9 @@  N:	Gerome Burlats <gerome.burlats@smile.fr>
 F:	board/qemu/
 F:	configs/qemu_*
 
+N:	Giacomo Longo <gabibbo97@gmail.com>
+F:	package/uftrace/
+
 N:	Gilles Talis <gilles.talis@gmail.com>
 F:	board/freescale/imx8mmevk/
 F:	configs/freescale_imx8mmevk_defconfig
diff --git a/package/Config.in b/package/Config.in
index ee05467479..b9c51dc3f1 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -140,6 +140,7 @@  menu "Debugging, profiling and benchmark"
 	source "package/trace-cmd/Config.in"
 	source "package/trinity/Config.in"
 	source "package/uclibc-ng-test/Config.in"
+	source "package/uftrace/Config.in"
 	source "package/valgrind/Config.in"
 	source "package/vmtouch/Config.in"
 	source "package/whetstone/Config.in"
diff --git a/package/uftrace/Config.in b/package/uftrace/Config.in
new file mode 100644
index 0000000000..4349a5778e
--- /dev/null
+++ b/package/uftrace/Config.in
@@ -0,0 +1,24 @@ 
+config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
+	bool
+	default y if BR2_aarch64
+	default y if BR2_arm
+	default y if BR2_i386
+	default y if BR2_x86_64
+
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_USE_WCHAR # elfutils
+	depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils
+	select BR2_PACKAGE_ELFUTILS
+	help
+	  Tool to trace and analyze execution of a program.
+
+	  https://uftrace.github.io/slide
+
+comment "uftrace needs a glibc toolchain w/ C++, dynamic library, threads, wchar"
+	depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
diff --git a/package/uftrace/uftrace.hash b/package/uftrace/uftrace.hash
new file mode 100644
index 0000000000..8f38e7431d
--- /dev/null
+++ b/package/uftrace/uftrace.hash
@@ -0,0 +1,3 @@ 
+# Locally computed:
+sha512 f73ad4461051b9c61668161e077897d118ac556d234ff204e32bf14ecdc2c0df148da30ea5d5054641e79ea20b29261d6f637908f5047f5669207ef244865358 uftrace-v0.9.4.tar.gz
+sha512 aee80b1f9f7f4a8a00dcf6e6ce6c41988dcaedc4de19d9d04460cbfb05d99829ffe8f9d038468eabbfba4d65b38e8dbef5ecf5eb8a1b891d9839cda6c48ee957 COPYING
diff --git a/package/uftrace/uftrace.mk b/package/uftrace/uftrace.mk
new file mode 100644
index 0000000000..bce98888de
--- /dev/null
+++ b/package/uftrace/uftrace.mk
@@ -0,0 +1,35 @@ 
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = v0.9.4
+UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))
+UFTRACE_LICENSE = GPL-2.0+
+UFTRACE_LICENSE_FILES = COPYING
+UFTRACE_DEPENDENCIES = elfutils
+
+UFTRACE_CONF_OPTS = \
+	--without-capstone \
+	--without-libpython
+
+ifeq ($(BR2_aarch64),y)
+UFTRACE_CONF_OPTS += --arch=aarch64
+else ifeq ($(BR2_arm),y)
+UFTRACE_CONF_OPTS += --arch=arm
+else ifeq ($(BR2_i386),y)
+UFTRACE_CONF_OPTS += --arch=i386
+else ifeq ($(BR2_x86_64),y)
+UFTRACE_CONF_OPTS += --arch=x86_64
+endif
+
+ifeq ($(BR2_PACKAGE_LUAJIT),n)
+UFTRACE_CONF_OPTS += --without-libluajit
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),n)
+UFTRACE_CONF_OPTS += --without-libncurses
+endif
+
+$(eval $(autotools-package))