* [Buildroot] [PATCH v2 1/1] package/libtalloc: new package
@ 2020-03-27 15:02 Jared Bents
2020-03-29 19:45 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Jared Bents @ 2020-03-27 15:02 UTC (permalink / raw)
To: buildroot
libtalloc is a hierarchical, reference counted memory pool
system with destructors. It is the core memory allocator
used in Samba.
Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
--
v2: - updated commit message to fit new package standard
- updated to waf package type
- added developers entry
- added toolchain dependencies
- license and license file updates
- removed TARGET_NLS_LIBS dependency
- removed empty python_LDFLAGS and python_LIBDIR
---
DEVELOPERS | 1 +
package/Config.in | 1 +
package/libtalloc/Config.in | 20 +++++++++
package/libtalloc/libtalloc.hash | 4 ++
package/libtalloc/libtalloc.mk | 72 ++++++++++++++++++++++++++++++++
5 files changed, 98 insertions(+)
create mode 100644 package/libtalloc/Config.in
create mode 100644 package/libtalloc/libtalloc.hash
create mode 100644 package/libtalloc/libtalloc.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index fd312a44af..afad4fad12 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1166,6 +1166,7 @@ F: package/zynq-boot-bin/
N: Jared Bents <jared.bents@rockwellcollins.com>
F: package/davici/
+F: package/libtalloc/
N: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
F: package/quota/
diff --git a/package/Config.in b/package/Config.in
index 091f5d39f7..37c2c3df12 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1769,6 +1769,7 @@ menu "Other"
source "package/libsigc/Config.in"
source "package/libsigsegv/Config.in"
source "package/libspatialindex/Config.in"
+ source "package/libtalloc/Config.in"
source "package/libtasn1/Config.in"
source "package/libtommath/Config.in"
source "package/libtpl/Config.in"
diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
new file mode 100644
index 0000000000..333d7305ac
--- /dev/null
+++ b/package/libtalloc/Config.in
@@ -0,0 +1,20 @@
+comment "libtalloc needs a uClibc or glibc toolchain w/ wchar, dynamic library, NPTL"
+ depends on BR2_TOOLCHAIN_HAS_SYNC_4
+ depends on !BR2_USE_WCHAR || BR2_TOOLCHAIN_USES_MUSL \
+ || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
+ depends on BR2_USE_MMU
+
+config BR2_PACKAGE_LIBTALLOC
+ bool "libtalloc"
+ depends on BR2_USE_MMU # fork()
+ depends on BR2_USE_WCHAR # python
+ depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # python -> libffi
+ depends on !BR2_STATIC_LIBS # cmocka, python, gnutls
+ depends on BR2_TOOLCHAIN_HAS_SYNC_4
+ depends on !BR2_TOOLCHAIN_USES_MUSL
+ help
+ talloc is a hierarchical, reference counted memory pool
+ system with destructors. It is the core memory allocator
+ used in Samba.
+
+ https://talloc.samba.org/talloc/doc/html/index.html
diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
new file mode 100644
index 0000000000..34e41ddd9f
--- /dev/null
+++ b/package/libtalloc/libtalloc.hash
@@ -0,0 +1,4 @@
+# Locally calculated after checking pgp signature
+sha256 ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77 talloc-2.3.1.tar.gz
+sha256 15c2767545d1e43dc35832736253bde5be956f8ffec0474a6d0f70349b646ed3 talloc.h
+sha256 8742f2dad3aaf885c7b4b699c20bfa0e9edeab380689f91a88aa90af03e6947b pytalloc.h
diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
new file mode 100644
index 0000000000..c050cf2033
--- /dev/null
+++ b/package/libtalloc/libtalloc.mk
@@ -0,0 +1,72 @@
+################################################################################
+#
+# libtalloc
+#
+################################################################################
+
+LIBTALLOC_VERSION = 2.3.1
+LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
+LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
+LIBTALLOC_LICENSE = LGPL-3.0+, GPL-3.0+
+LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
+LIBTALLOC_INSTALL_STAGING = YES
+LIBTALLOC_CFLAGS = $(TARGET_CFLAGS)
+LIBTALLOC_LDFLAGS = $(TARGET_LDFLAGS)
+LIBTALLOC_CONF_ENV = \
+ CFLAGS="$(LIBTALLOC_CFLAGS)" \
+ LDFLAGS="$(LIBTALLOC_LDFLAGS)" \
+ XSLTPROC=false \
+ WAF_NO_PREFORK=1
+
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+LIBTALLOC_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
+LIBTALLOC_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
+LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+LIBTALLOC_PYTHON = \
+ PYTHON="$(HOST_DIR)/bin/python3" \
+ PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
+LIBTALLOC_DEPENDENCIES += host-python3 python3
+LIBTALLOC_CONF_ENV += \
+ $(LIBTALLOC_PYTHON)
+# There is not a --enable-python configuration option
+else
+LIBTALLOC_CONF_OPTS += --disable-python
+endif
+
+define LIBTALLOC_CONFIGURE_CMDS
+ $(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt;
+ echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
+ (cd $(@D); \
+ $(TARGET_CONFIGURE_OPTS) \
+ $(LIBTALLOC_CONF_ENV) \
+ ./buildtools/bin/waf configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --with-libiconv=$(STAGING_DIR)/usr \
+ --cross-compile \
+ --cross-answers=$(@D)/cache.txt \
+ --hostcc=gcc \
+ --disable-rpath \
+ --disable-rpath-install \
+ --bundled-libraries='!asn1_compile,!compile_et' \
+ $(LIBTALLOC_CONF_OPTS) \
+ )
+endef
+
+define LIBTALLOC_BUILD_CMDS
+ $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D)
+endef
+
+define LIBTALLOC_INSTALL_STAGING_CMDS
+ $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
+endef
+
+define LIBTALLOC_INSTALL_TARGET_CMDS
+ $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(waf-package))
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH v2 1/1] package/libtalloc: new package
2020-03-27 15:02 [Buildroot] [PATCH v2 1/1] package/libtalloc: new package Jared Bents
@ 2020-03-29 19:45 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2020-03-29 19:45 UTC (permalink / raw)
To: buildroot
Hello Jared,
On Fri, 27 Mar 2020 10:02:25 -0500
Jared Bents <jared.bents@rockwellcollins.com> wrote:
> libtalloc is a hierarchical, reference counted memory pool
> system with destructors. It is the core memory allocator
> used in Samba.
>
> Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
Thanks for this new iteration.
> +config BR2_PACKAGE_LIBTALLOC
> + bool "libtalloc"
> + depends on BR2_USE_MMU # fork()
> + depends on BR2_USE_WCHAR # python
> + depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # python -> libffi
> + depends on !BR2_STATIC_LIBS # cmocka, python, gnutls
> + depends on BR2_TOOLCHAIN_HAS_SYNC_4
> + depends on !BR2_TOOLCHAIN_USES_MUSL
I don't understand why you have added these gazillions of dependencies.
BR2_USE_MMU is indeed needed, as fork() is used.
But the other dependencies, I don't understand:
- Python is only an optional dependency of your package, so there's no
reason to replicate Python's dependencies.
- cmocka and gnutls are not dependencies either.
- It builds fine with musl.
So, unless you have a good justification (a build failure), please drop
all those dependencies, and keep only the BR2_USE_MMU.
Of course, if that's indeed the case, you can drop the Config.in
comment as well.
> +define LIBTALLOC_CONFIGURE_CMDS
> + $(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt;
Final semi-colon not needed.
> + echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
Final semi-colon not needed.
I am not sure it is such a great idea to share the waf options cache
with Samba though.
> + (cd $(@D); \
> + $(TARGET_CONFIGURE_OPTS) \
> + $(LIBTALLOC_CONF_ENV) \
> + ./buildtools/bin/waf configure \
> + --prefix=/usr \
> + --sysconfdir=/etc \
> + --localstatedir=/var \
> + --with-libiconv=$(STAGING_DIR)/usr \
> + --cross-compile \
> + --cross-answers=$(@D)/cache.txt \
> + --hostcc=gcc \
> + --disable-rpath \
> + --disable-rpath-install \
> + --bundled-libraries='!asn1_compile,!compile_et' \
> + $(LIBTALLOC_CONF_OPTS) \
> + )
> +endef
Here, we're not using the waf-package infrastructure properly. In fact,
you almost don't use anything of it.
One thing that makes it not possible to use it as-is is that the waf
script is not in ./waf, but in ./buildtools/bin/waf. To make this work,
add a preparation patch that does this in pkg-waf.mk:
diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
index a32d5dab33..5579f2bef0 100644
--- a/package/pkg-waf.mk
+++ b/package/pkg-waf.mk
@@ -46,7 +46,7 @@ ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
$(2)_DEPENDENCIES += host-waf
$(2)_WAF = $$(HOST_DIR)/bin/waf
else
-$(2)_WAF = ./waf
+$(2)_WAF ?= ./waf
endif
$(2)_BUILD_OPTS ?=
Then in libtalloc.mk, you can do:
LIBTALLOC_WAF = ./buildtools/bin/waf
and then, drop your custom LIBTALLOC_CONFIGURE_CMDS.
> +
> +define LIBTALLOC_BUILD_CMDS
> + $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D)
> +endef
Why don't you use waf here ?
> +define LIBTALLOC_INSTALL_STAGING_CMDS
> + $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
> +endef
> +
> +define LIBTALLOC_INSTALL_TARGET_CMDS
> + $(TARGET_MAKE_ENV) $(LIBTALLOC_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> +endef
Same question.
At the end, your libtalloc.mk should look like this:
################################################################################
#
# libtalloc
#
################################################################################
LIBTALLOC_VERSION = 2.3.1
LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
LIBTALLOC_LICENSE = LGPL-3.0+, GPL-3.0+
LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
LIBTALLOC_INSTALL_STAGING = YES
LIBTALLOC_CFLAGS = $(TARGET_CFLAGS)
LIBTALLOC_LDFLAGS = $(TARGET_LDFLAGS)
LIBTALLOC_CONF_ENV = \
CFLAGS="$(LIBTALLOC_CFLAGS)" \
LDFLAGS="$(LIBTALLOC_LDFLAGS)" \
XSLTPROC=false \
WAF_NO_PREFORK=1
LIBTALLOC_CONF_OPTS = \
--sysconfdir=/etc \
--localstatedir=/var \
--with-libiconv=$(STAGING_DIR)/usr \
--cross-compile \
--cross-answers=$(@D)/cache.txt \
--hostcc=gcc \
--disable-rpath \
--disable-rpath-install \
--bundled-libraries='!asn1_compile,!compile_et'
ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
LIBTALLOC_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
LIBTALLOC_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
LIBTALLOC_PYTHON = \
PYTHON="$(HOST_DIR)/bin/python3" \
PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
LIBTALLOC_DEPENDENCIES += host-python3 python3
LIBTALLOC_CONF_ENV += \
$(LIBTALLOC_PYTHON)
# There is not a --enable-python configuration option
else
LIBTALLOC_CONF_OPTS += --disable-python
endif
LIBTALLOC_WAF = ./buildtools/bin/waf
define LIBTALLOC_POPULATE_WAF_CACHE
$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt
echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt
endef
LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
$(eval $(waf-package))
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-29 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 15:02 [Buildroot] [PATCH v2 1/1] package/libtalloc: new package Jared Bents
2020-03-29 19:45 ` Thomas Petazzoni
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.