* [Buildroot] [PATCH v3 1/5] package/alchemy: new host package
2022-01-10 14:50 [Buildroot] [PATCH v3 0/5] Add Alchemy build system and some related libs Herve Codina
@ 2022-01-10 14:50 ` Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 2/5] package/ulog: new package Herve Codina
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2022-01-10 14:50 UTC (permalink / raw)
To: buildroot; +Cc: Hervé Codina, Yann E . MORIN, Thomas Petazzoni
Alchemy is a build system developed by Parrot.
It is a new build system based on the one used in Android.
A central makefile instance scans a workspace to find user
makefiles, includes them and register modules to be built.
https://github.com/Parrot-Developers/alchemy
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changes v1 -> v2
- Fixed missing license information related to kconfig
- Installed Alchemy in $(HOST_DIR)/opt/alchemy
- Renamed ALCHEMY_TARGET_CONFIGURE_ENV to ALCHEMY_TARGET_ENV
- Removed ALCHEMY_TARGET_CONFIGURE_SDKS macro
Changes v2 -> v3
- Introduced atom.mk.in as suggested by Yann
- Added LIBRARIES in atom.mk.in to set Alchemy dependencies chain.
This is needed to have a complete .a file list for the link
command in case of static lib only.
DEVELOPERS | 1 +
...lchains-remove-hash-style-management.patch | 36 ++++++++++
package/alchemy/alchemy.hash | 4 ++
package/alchemy/alchemy.mk | 71 +++++++++++++++++++
package/alchemy/atom.mk.in | 8 +++
5 files changed, 120 insertions(+)
create mode 100644 package/alchemy/0001-toolchains-remove-hash-style-management.patch
create mode 100644 package/alchemy/alchemy.hash
create mode 100644 package/alchemy/alchemy.mk
create mode 100644 package/alchemy/atom.mk.in
diff --git a/DEVELOPERS b/DEVELOPERS
index cd0b54b041..79b33e9f22 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1187,6 +1187,7 @@ N: Henrique Camargo <henrique@henriquecamargo.com>
F: package/json-glib/
N: Hervé Codina <herve.codina@bootlin.com>
+F: package/alchemy/
F: package/dtbocfg/
F: package/libdbi/
F: package/libdbi-drivers/
diff --git a/package/alchemy/0001-toolchains-remove-hash-style-management.patch b/package/alchemy/0001-toolchains-remove-hash-style-management.patch
new file mode 100644
index 0000000000..522766b977
--- /dev/null
+++ b/package/alchemy/0001-toolchains-remove-hash-style-management.patch
@@ -0,0 +1,36 @@
+From 4cb9681ab99db3d8e330ac789e17ec69583aecd4 Mon Sep 17 00:00:00 2001
+From: Herve Codina <herve.codina@bootlin.com>
+Date: Thu, 28 Oct 2021 18:39:18 +0200
+Subject: [PATCH] toolchains: remove --hash-style management
+
+Using an external toolchain, with an external configuration given
+using TARGET_GLOBAL_XXXX variables, having '--hash-style=both'
+in Alchemy toolchains can lead to compilation failure.
+
+This patch simply removes all --hash-style settings.
+
+Signed-off-by: Herve Codina <herve.codina@bootlin.com>
+---
+ toolchains/linux/eglibc/flags.mk | 9 +--------
+ 1 file changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/toolchains/linux/eglibc/flags.mk b/toolchains/linux/eglibc/flags.mk
+index 95c0a46..4474729 100644
+--- a/toolchains/linux/eglibc/flags.mk
++++ b/toolchains/linux/eglibc/flags.mk
+@@ -11,11 +11,4 @@ TARGET_GLOBAL_LDLIBS += -pthread -lrt
+ TARGET_GLOBAL_CFLAGS += -funwind-tables
+
+ # Enable link optimization for binutils's ld.
+-# gnu hash not supported by mips ABI
+-ifeq ("$(TARGET_ARCH)","mips")
+- TARGET_GLOBAL_LDFLAGS += -Wl,-O1
+-else ifeq ("$(TARGET_ARCH)","mips64")
+- TARGET_GLOBAL_LDFLAGS += -Wl,-O1
+-else
+- TARGET_GLOBAL_LDFLAGS += -Wl,-O1,--hash-style=both
+-endif
++TARGET_GLOBAL_LDFLAGS += -Wl,-O1
+--
+2.31.1
+
diff --git a/package/alchemy/alchemy.hash b/package/alchemy/alchemy.hash
new file mode 100644
index 0000000000..33895263cc
--- /dev/null
+++ b/package/alchemy/alchemy.hash
@@ -0,0 +1,4 @@
+# Locally computed:
+sha256 346c06b9317691a9371d878b850e61f8bcec4f20132ac95340b9d2571be25ee8 alchemy-d95b3c38cd37814a1b98d0bbf813de7adaaecfbc.tar.gz
+sha256 542f44eecd9f8806ec1ae285201e442ab547c82d9f8c70e44c977d6332a2bea0 COPYING
+sha256 49872815ee3de163f07a83737c996e77a5bffa186d06b1e3bb969bfb68c251df README
diff --git a/package/alchemy/alchemy.mk b/package/alchemy/alchemy.mk
new file mode 100644
index 0000000000..33d40478b7
--- /dev/null
+++ b/package/alchemy/alchemy.mk
@@ -0,0 +1,71 @@
+################################################################################
+#
+# alchemy
+#
+################################################################################
+
+ALCHEMY_VERSION = d95b3c38cd37814a1b98d0bbf813de7adaaecfbc
+ALCHEMY_SITE = $(call github,Parrot-Developers,alchemy,$(ALCHEMY_VERSION))
+ALCHEMY_LICENSE = BSD-3-Clause (Alchemy), GPL-2.0 (kconfig)
+ALCHEMY_LICENSE_FILES = COPYING README
+HOST_ALCHEMY_DEPENDENCIES = host-python3
+
+ALCHEMY_HOME = $(HOST_DIR)/opt/alchemy
+ALCHEMY_SDK_BASEDIR = $(STAGING_DIR)/usr/lib/alchemy/sdk
+
+define HOST_ALCHEMY_INSTALL_CMDS
+ mkdir -p $(ALCHEMY_HOME)
+ cp -rf $(@D)/* $(ALCHEMY_HOME)
+ cp $(HOST_ALCHEMY_PKGDIR)/atom.mk.in $(ALCHEMY_HOME)/atom.mk.in
+endef
+
+$(eval $(host-generic-package))
+
+# Variables used by other packages
+
+ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake
+
+# TARGET_ARCH is set to 'xxx' to avoid Alchemy managing the architecture.
+# When Alchemy manages the architecture, it can add some flags to CFGLAGS and
+# can lead to incorrect result with the toolchain provided in TARGET_CROSS.
+# 'xxx' is an unknown architecture for Alchemy. Using this value is a simple
+# way to disable the Alchemy architecture management.
+ALCHEMY_TARGET_ENV = \
+ $(TARGET_MAKE_ENV) \
+ ALCHEMY_HOME=$(ALCHEMY_HOME) \
+ ALCHEMY_WORKSPACE_DIR="$(@D)" \
+ ALCHEMY_TARGET_OUT=alchemy-out \
+ TARGET_OS=linux \
+ TARGET_OS_FLAVOUR=buildroot \
+ TARGET_CROSS="$(TARGET_CROSS)" \
+ TARGET_ARCH=xxx \
+ TARGET_GLOBAL_CXXFLAGS="$(TARGET_CXXFLAGS)" \
+ TARGET_GLOBAL_LDFLAGS="$(TARGET_LDFLAGS)" \
+ TARGET_GLOBAL_FFLAGS="$(TARGET_FCFLAGS)" \
+ TARGET_GLOBAL_FCFLAGS="$(TARGET_FCFLAGS)"
+
+ifeq ($(BR2_STATIC_LIBS),y)
+ALCHEMY_TARGET_ENV += \
+ TARGET_FORCE_STATIC=1 \
+ TARGET_GLOBAL_CFLAGS="$(TARGET_CFLAGS)"
+else
+ALCHEMY_TARGET_ENV += \
+ TARGET_GLOBAL_CFLAGS="$(TARGET_CFLAGS) -fPIC"
+endif
+
+# Install an Alchemy SDK file.
+# This macro can be used by Alchemy packages
+# $1: Buildroot package name
+# $2: Alchemy module name
+# $3: Alchemy module file name
+# $4: Alchemy module libraries this module depends on
+define ALCHEMY_INSTALL_LIB_SDK_FILE
+ $(INSTALL) -m 0644 -D \
+ $(ALCHEMY_HOME)/atom.mk.in \
+ $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))/atom.mk
+ $(SED) 's#@STAGING_DIR@#$(STAGING_DIR)#' \
+ -e 's#@MODULE@#$(strip $(2))#' \
+ -e 's#@MODULE_FILENAME@#$(strip $(3))#' \
+ -e 's#@LIBRARIES@#$(strip $(4))#' \
+ $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))/atom.mk
+endef
diff --git a/package/alchemy/atom.mk.in b/package/alchemy/atom.mk.in
new file mode 100644
index 0000000000..084ae0e89f
--- /dev/null
+++ b/package/alchemy/atom.mk.in
@@ -0,0 +1,8 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_MODULE := @MODULE@
+LOCAL_SDK := @STAGING_DIR@
+LOCAL_DESTDIR := usr/lib
+LOCAL_MODULE_FILENAME := @MODULE_FILENAME@
+LOCAL_LIBRARIES := @LIBRARIES@
+include $(BUILD_LIBRARY)
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 2/5] package/ulog: new package
2022-01-10 14:50 [Buildroot] [PATCH v3 0/5] Add Alchemy build system and some related libs Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 1/5] package/alchemy: new host package Herve Codina
@ 2022-01-10 14:50 ` Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 3/5] package/libfutils: " Herve Codina
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2022-01-10 14:50 UTC (permalink / raw)
To: buildroot; +Cc: Hervé Codina, Yann E . MORIN, Thomas Petazzoni
The ulog library is a minimalistic logging library derived from
Android logger.
https://github.com/Parrot-Developers/ulog
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changes v1 -> v2
- Renamed ALCHEMY_TARGET_CONFIGURE_ENV to ALCHEMY_TARGET_ENV
- Removed $(strip ...)
- Fixed indentation
Changes v2 -> v3
- Installed .a files when needed (ie not shared lib only)
- Used $(INSTALL) in all installation commands
- Created installation directories when needed
DEVELOPERS | 1 +
package/Config.in | 1 +
package/ulog/Config.in | 12 ++++++++++
package/ulog/ulog.hash | 3 +++
package/ulog/ulog.mk | 50 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 67 insertions(+)
create mode 100644 package/ulog/Config.in
create mode 100644 package/ulog/ulog.hash
create mode 100644 package/ulog/ulog.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 79b33e9f22..31ca7bf608 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1197,6 +1197,7 @@ F: package/php-apcu/
F: package/php-lua/
F: package/php-pam/
F: package/php-pecl-dbus/
+F: package/ulog/
F: support/testing/tests/package/test_dtbocfg.py
F: support/testing/tests/package/test_lua_augeas.py
F: support/testing/tests/package/test_php_apcu.py
diff --git a/package/Config.in b/package/Config.in
index 3a2ad30df9..39a98fcc66 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1738,6 +1738,7 @@ menu "Logging"
source "package/log4qt/Config.in"
source "package/opentracing-cpp/Config.in"
source "package/spdlog/Config.in"
+ source "package/ulog/Config.in"
source "package/zlog/Config.in"
endmenu
diff --git a/package/ulog/Config.in b/package/ulog/Config.in
new file mode 100644
index 0000000000..ef155005c2
--- /dev/null
+++ b/package/ulog/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_ULOG
+ bool "ulog"
+ depends on BR2_INSTALL_LIBSTDCPP
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ help
+ This is a minimalistic logging library derived from
+ Android logger.
+
+ https://github.com/Parrot-Developers/ulog
+
+comment "ulog needs a toolchain w/ C++, threads"
+ depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/ulog/ulog.hash b/package/ulog/ulog.hash
new file mode 100644
index 0000000000..47adc093b9
--- /dev/null
+++ b/package/ulog/ulog.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 14e5773b32a79fa5380bdc7ac73a39a7cd3ab182830f57cf6f2994fb49cf38dc ulog-0389d243352255f6182326dccdae3d56dadc078f.tar.gz
+sha256 cbb97dd2528af2aa2b9aee6c1b3ff1caed758044c17b2c811cf44b2528c496da COPYING
diff --git a/package/ulog/ulog.mk b/package/ulog/ulog.mk
new file mode 100644
index 0000000000..4bfb913499
--- /dev/null
+++ b/package/ulog/ulog.mk
@@ -0,0 +1,50 @@
+################################################################################
+#
+# ulog
+#
+################################################################################
+
+ULOG_VERSION = 0389d243352255f6182326dccdae3d56dadc078f
+ULOG_SITE = $(call github,Parrot-Developers,ulog,$(ULOG_VERSION))
+ULOG_LICENSE = Apache-2.0
+ULOG_LICENSE_FILES = COPYING
+ULOG_DEPENDENCIES = host-alchemy
+ULOG_INSTALL_STAGING = YES
+
+define ULOG_BUILD_CMDS
+ $(ALCHEMY_TARGET_ENV) \
+ $(ALCHEMY_MAKE) libulog
+endef
+
+ifeq ($(BR2_SHARED_LIBS),)
+define ULOG_INSTALL_STATIC_LIBS
+ $(INSTALL) -D -m 644 $(@D)/alchemy-out/staging/usr/lib/libulog.a \
+ $(1)/usr/lib/libulog.a
+endef
+endif
+
+define ULOG_INSTALL_HEADERS
+ mkdir -p $(1)/usr/include/
+ $(INSTALL) -m 644 $(@D)/libulog/include/* $(1)/usr/include/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define ULOG_INSTALL_SHARED_LIBS
+ mkdir -p $(1)/usr/lib/
+ $(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libulog.so* \
+ $(1)/usr/lib/
+endef
+endif
+
+define ULOG_INSTALL_TARGET_CMDS
+ $(call ULOG_INSTALL_SHARED_LIBS, $(TARGET_DIR))
+endef
+
+define ULOG_INSTALL_STAGING_CMDS
+ $(call ULOG_INSTALL_STATIC_LIBS, $(STAGING_DIR))
+ $(call ULOG_INSTALL_SHARED_LIBS, $(STAGING_DIR))
+ $(call ULOG_INSTALL_HEADERS, $(STAGING_DIR))
+ $(call ALCHEMY_INSTALL_LIB_SDK_FILE, ulog, libulog, libulog.so)
+endef
+
+$(eval $(generic-package))
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 3/5] package/libfutils: new package
2022-01-10 14:50 [Buildroot] [PATCH v3 0/5] Add Alchemy build system and some related libs Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 1/5] package/alchemy: new host package Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 2/5] package/ulog: new package Herve Codina
@ 2022-01-10 14:50 ` Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 4/5] package/libshdata: " Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 5/5] support/testing/tests/package/test_libshdata: new test Herve Codina
4 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2022-01-10 14:50 UTC (permalink / raw)
To: buildroot; +Cc: Hervé Codina, Yann E . MORIN, Thomas Petazzoni
The libfutils library is a library that contains some common
useful functions (list, hash, time).
https://github.com/Parrot-Developers/libfutils
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changes v1 -> v2
- Renamed ALCHEMY_TARGET_CONFIGURE_ENV to ALCHEMY_TARGET_ENV
- Removed ALCHEMY_TARGET_CONFIGURE_SDKS and set ALCHEMY_TARGET_SDK_DIRS
- Removed $(strip ...)
- Fixed indentation
- Added missing "depends on" in Config.in comment
Changes v2 -> v3
- Installed .a files when needed (ie not shared lib only)
- Used $(INSTALL) in all installation commands
- Created installation directories when needed
- Fixed dependencies chain in Alchemy atom.mk
DEVELOPERS | 1 +
package/Config.in | 1 +
package/libfutils/Config.in | 15 +++++++++
package/libfutils/libfutils.hash | 3 ++
package/libfutils/libfutils.mk | 56 ++++++++++++++++++++++++++++++++
5 files changed, 76 insertions(+)
create mode 100644 package/libfutils/Config.in
create mode 100644 package/libfutils/libfutils.hash
create mode 100644 package/libfutils/libfutils.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 31ca7bf608..ecb0837398 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1191,6 +1191,7 @@ F: package/alchemy/
F: package/dtbocfg/
F: package/libdbi/
F: package/libdbi-drivers/
+F: package/libfutils/
F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
diff --git a/package/Config.in b/package/Config.in
index 39a98fcc66..163fd53e12 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1986,6 +1986,7 @@ menu "Other"
source "package/libevent/Config.in"
source "package/libexecinfo/Config.in"
source "package/libffi/Config.in"
+ source "package/libfutils/Config.in"
source "package/libgee/Config.in"
source "package/libgeos/Config.in"
source "package/libglib2/Config.in"
diff --git a/package/libfutils/Config.in b/package/libfutils/Config.in
new file mode 100644
index 0000000000..7f795fc7e0
--- /dev/null
+++ b/package/libfutils/Config.in
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_LIBFUTILS
+ bool "libfutils"
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC
+ depends on BR2_INSTALL_LIBSTDCPP # ulog
+ depends on BR2_TOOLCHAIN_HAS_THREADS # ulog
+ select BR2_PACKAGE_ULOG
+ help
+ This library contains some common useful functions (list,
+ hash, time)
+
+ https://github.com/Parrot-Developers/libfutils
+
+comment "libfutils needs a toolchain w/ C++, threads"
+ depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC
diff --git a/package/libfutils/libfutils.hash b/package/libfutils/libfutils.hash
new file mode 100644
index 0000000000..1fdcd84b13
--- /dev/null
+++ b/package/libfutils/libfutils.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 b38d40c46b83e448d8c1716ddfb04b7ecd384f5cd2cb773db5c26c0589accdb3 libfutils-c326ce0cc2a7354381265a7664bb215be587fac6.tar.gz
+sha256 eca11a1c62fae8d64a1247d93271375baecff8396141d7ff8d89671ee7e3ed0d COPYING
diff --git a/package/libfutils/libfutils.mk b/package/libfutils/libfutils.mk
new file mode 100644
index 0000000000..0772d16ad7
--- /dev/null
+++ b/package/libfutils/libfutils.mk
@@ -0,0 +1,56 @@
+################################################################################
+#
+# libfutils
+#
+################################################################################
+
+LIBFUTILS_VERSION = c326ce0cc2a7354381265a7664bb215be587fac6
+LIBFUTILS_SITE = $(call github,Parrot-Developers,libfutils,$(LIBFUTILS_VERSION))
+LIBFUTILS_LICENSE = BSD-3-Clause
+LIBFUTILS_LICENSE_FILES = COPYING
+LIBFUTILS_DEPENDENCIES = ulog host-alchemy
+LIBFUTILS_INSTALL_STAGING = YES
+
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+LIBFUTILS_CONF_ENV += TARGET_GLOBAL_LDLIBS='-latomic'
+endif
+
+define LIBFUTILS_BUILD_CMDS
+ $(ALCHEMY_TARGET_ENV) \
+ ALCHEMY_TARGET_SDK_DIRS="$(ALCHEMY_SDK_BASEDIR)/ulog" \
+ $(LIBFUTILS_CONF_ENV) \
+ $(ALCHEMY_MAKE) libfutils
+endef
+
+ifeq ($(BR2_SHARED_LIBS),)
+define LIBFUTILS_INSTALL_STATIC_LIBS
+ $(INSTALL) -D -m 644 $(@D)/alchemy-out/staging/usr/lib/libfutils.a \
+ $(1)/usr/lib/libfutils.a
+endef
+endif
+
+define LIBFUTILS_INSTALL_HEADERS
+ mkdir -p $(1)/usr/include/futils
+ $(INSTALL) -m 644 $(@D)/include/futils/* $(1)/usr/include/futils/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define LIBFUTILS_INSTALL_SHARED_LIBS
+ mkdir -p $(1)/usr/lib/
+ $(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libfutils.so* \
+ $(1)/usr/lib/
+endef
+endif
+
+define LIBFUTILS_INSTALL_TARGET_CMDS
+ $(call LIBFUTILS_INSTALL_SHARED_LIBS, $(TARGET_DIR))
+endef
+
+define LIBFUTILS_INSTALL_STAGING_CMDS
+ $(call LIBFUTILS_INSTALL_STATIC_LIBS, $(STAGING_DIR))
+ $(call LIBFUTILS_INSTALL_SHARED_LIBS, $(STAGING_DIR))
+ $(call LIBFUTILS_INSTALL_HEADERS, $(STAGING_DIR))
+ $(call ALCHEMY_INSTALL_LIB_SDK_FILE, libfutils, libfutils, libfutils.so, libulog)
+endef
+
+$(eval $(generic-package))
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 4/5] package/libshdata: new package
2022-01-10 14:50 [Buildroot] [PATCH v3 0/5] Add Alchemy build system and some related libs Herve Codina
` (2 preceding siblings ...)
2022-01-10 14:50 ` [Buildroot] [PATCH v3 3/5] package/libfutils: " Herve Codina
@ 2022-01-10 14:50 ` Herve Codina
2022-01-10 14:50 ` [Buildroot] [PATCH v3 5/5] support/testing/tests/package/test_libshdata: new test Herve Codina
4 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2022-01-10 14:50 UTC (permalink / raw)
To: buildroot; +Cc: Hervé Codina, Yann E . MORIN, Thomas Petazzoni
The libshdata library provides lock free shared-memory tools.
https://github.com/Parrot-Developers/libshdata
libshdata-stress utility does not compile using static libs
only (BR2_STATIC_LIBS=y). The issue was raised upstream:
https://github.com/Parrot-Developers/libshdata/issues/2
For now, libshdata-stress simply depends on !BR2_STATIC_LIBS.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changes v1 -> v2
- Added comment related to "patch submitted upstream" in the patch itself
- Renamed ALCHEMY_TARGET_CONFIGURE_ENV to ALCHEMY_TARGET_ENV
- Removed ALCHEMY_TARGET_CONFIGURE_SDKS and set ALCHEMY_TARGET_SDK_DIRS
- Removed $(strip ...)
- Fixed indentation
- Added missing "depends on" in Config.in comment
- Moved the Config.in "comment" block after the if...endif block
- Removed unneeded LIBSHDATA_CONF_ENV
Changes v2 -> v3
- Installed .a files when needed (ie not shared lib only)
- Used $(INSTALL) in all installation commands
- Created installation directories when needed
- Added ulog as buildroot package dependency and fixed the
dependencies chain in Alchemy atom.mk
- Added 0002-examples-stress_test-Fix-build-with-musl-libc.patch
- Added 'depends on !BR2_STATIC_LIBS' for libshdata-stress
DEVELOPERS | 1 +
package/Config.in | 1 +
...01-backend-Add-missing-include-files.patch | 47 ++++++++++++
...stress_test-Fix-build-with-musl-libc.patch | 37 +++++++++
package/libshdata/Config.in | 30 ++++++++
package/libshdata/libshdata.hash | 3 +
package/libshdata/libshdata.mk | 75 +++++++++++++++++++
7 files changed, 194 insertions(+)
create mode 100644 package/libshdata/0001-backend-Add-missing-include-files.patch
create mode 100644 package/libshdata/0002-examples-stress_test-Fix-build-with-musl-libc.patch
create mode 100644 package/libshdata/Config.in
create mode 100644 package/libshdata/libshdata.hash
create mode 100644 package/libshdata/libshdata.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index ecb0837398..8d0258d7e8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1192,6 +1192,7 @@ F: package/dtbocfg/
F: package/libdbi/
F: package/libdbi-drivers/
F: package/libfutils/
+F: package/libshdata/
F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
diff --git a/package/Config.in b/package/Config.in
index 163fd53e12..2a1bc0dfb8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2030,6 +2030,7 @@ comment "linux-pam plugins"
source "package/libpam-tacplus/Config.in"
endif
source "package/liquid-dsp/Config.in"
+ source "package/libshdata/Config.in"
source "package/llvm/Config.in"
source "package/lttng-libust/Config.in"
source "package/matio/Config.in"
diff --git a/package/libshdata/0001-backend-Add-missing-include-files.patch b/package/libshdata/0001-backend-Add-missing-include-files.patch
new file mode 100644
index 0000000000..78c9e669c3
--- /dev/null
+++ b/package/libshdata/0001-backend-Add-missing-include-files.patch
@@ -0,0 +1,47 @@
+From 3eaf11bd957555674f5993435ef79dd4717ce890 Mon Sep 17 00:00:00 2001
+From: Herve Codina <herve.codina@bootlin.com>
+Date: Tue, 26 Oct 2021 08:45:10 +0200
+Subject: [PATCH] backend: Add missing include files
+
+With some libc library (musl), shd_dev_mem.c and shd_shm.c do not
+compile. Indeed, open() needs <fcntl.h> (Cf. man open).
+
+This patch fixes the compilation issue adding this
+include file.
+
+This patch was submitted upstream.
+https://github.com/Parrot-Developers/libshdata/issues/1
+
+Signed-off-by: Herve Codina <herve.codina@bootlin.com>
+---
+ src/backend/shd_dev_mem.c | 1 +
+ src/backend/shd_shm.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/backend/shd_dev_mem.c b/src/backend/shd_dev_mem.c
+index 14573c1..a65f052 100644
+--- a/src/backend/shd_dev_mem.c
++++ b/src/backend/shd_dev_mem.c
+@@ -33,6 +33,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <unistd.h> /* For ftruncate */
++#include <fcntl.h> /* For open */
+ #include <sys/file.h> /* for flock */
+ #include <sys/mman.h> /* For shm and PROT flags */
+ #include <futils/fdutils.h>
+diff --git a/src/backend/shd_shm.c b/src/backend/shd_shm.c
+index 117bf01..1e5a38c 100644
+--- a/src/backend/shd_shm.c
++++ b/src/backend/shd_shm.c
+@@ -35,6 +35,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <unistd.h> /* For ftruncate */
++#include <fcntl.h> /* For open */
+ #include <limits.h> /* For NAME_MAX macro */
+ #include <sys/file.h> /* for flock */
+ #include <sys/mman.h> /* For shm and PROT flags */
+--
+2.31.1
+
diff --git a/package/libshdata/0002-examples-stress_test-Fix-build-with-musl-libc.patch b/package/libshdata/0002-examples-stress_test-Fix-build-with-musl-libc.patch
new file mode 100644
index 0000000000..c2a8e5f240
--- /dev/null
+++ b/package/libshdata/0002-examples-stress_test-Fix-build-with-musl-libc.patch
@@ -0,0 +1,37 @@
+From ddded7337812a2797d31f276624da98932d8e17f Mon Sep 17 00:00:00 2001
+From: Herve Codina <herve.codina@bootlin.com>
+Date: Sun, 9 Jan 2022 14:59:27 +0100
+Subject: [PATCH] examples/stress_test: Fix build with musl libc
+
+The musl C library uses sched_priority instead of
+__sched_priority as GNU libc and uClibc do.
+Use sched_priority instead.
+
+This does not break compilation with GNU libc and uClibc
+because they both define in sched.h:
+ #define sched_priority __sched_priority
+
+This patch was submitted upstream.
+https://github.com/Parrot-Developers/libshdata/issues/3
+
+Signed-off-by: Herve Codina <herve.codina@bootlin.com>
+---
+ examples/stress_test.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/examples/stress_test.c b/examples/stress_test.c
+index a859115..cfb5418 100644
+--- a/examples/stress_test.c
++++ b/examples/stress_test.c
+@@ -617,7 +617,7 @@ static void launch_test(int timer_fd, struct test_setup *setup)
+ if (ret < 0)
+ ULOGI("Error setting the timer : %s", strerror(errno));
+ struct sched_param sched_params;
+- sched_params.__sched_priority = sched_get_priority_max(SCHED_RR);
++ sched_params.sched_priority = sched_get_priority_max(SCHED_RR);
+
+ pid_t pid = fork();
+
+--
+2.33.1
+
diff --git a/package/libshdata/Config.in b/package/libshdata/Config.in
new file mode 100644
index 0000000000..b2c24c94c5
--- /dev/null
+++ b/package/libshdata/Config.in
@@ -0,0 +1,30 @@
+config BR2_PACKAGE_LIBSHDATA
+ bool "libshdata"
+ depends on BR2_TOOLCHAIN_HAS_SYNC_4
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC # libfutils
+ depends on BR2_INSTALL_LIBSTDCPP # libfutils
+ depends on BR2_TOOLCHAIN_HAS_THREADS # libfutils
+ select BR2_PACKAGE_LIBFUTILS
+ select BR2_PACKAGE_ULOG
+ help
+ This library provides lock free shared-memory tools
+
+ https://github.com/Parrot-Developers/libshdata
+
+if BR2_PACKAGE_LIBSHDATA
+
+config BR2_PACKAGE_LIBSHDATA_STRESS
+ bool "libshdata-stress binary"
+ depends on !BR2_STATIC_LIBS
+ help
+ Install libshdata-stress binary as well
+
+comment "libshdata-stress needs a toolchain w/ dynamic library"
+ depends on BR2_STATIC_LIBS
+
+endif
+
+comment "libshdata needs a toolchain w/ C++, threads"
+ depends on BR2_TOOLCHAIN_HAS_SYNC_4
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC
+ depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/libshdata/libshdata.hash b/package/libshdata/libshdata.hash
new file mode 100644
index 0000000000..880404cf52
--- /dev/null
+++ b/package/libshdata/libshdata.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 1ae83ac73c2b5b17c726067737b8d446b99f190e16fe6198eb464368796ecce3 libshdata-d9ec4bdba834d8f3daf6bf9aa6da374bc462961f.tar.gz
+sha256 eca11a1c62fae8d64a1247d93271375baecff8396141d7ff8d89671ee7e3ed0d COPYING
diff --git a/package/libshdata/libshdata.mk b/package/libshdata/libshdata.mk
new file mode 100644
index 0000000000..dc0937e11e
--- /dev/null
+++ b/package/libshdata/libshdata.mk
@@ -0,0 +1,75 @@
+################################################################################
+#
+# libshdata
+#
+################################################################################
+
+LIBSHDATA_VERSION = d9ec4bdba834d8f3daf6bf9aa6da374bc462961f
+LIBSHDATA_SITE = $(call github,Parrot-Developers,libshdata,$(LIBSHDATA_VERSION))
+LIBSHDATA_LICENSE = BSD-3-Clause
+LIBSHDATA_LICENSE_FILES = COPYING
+LIBSHDATA_DEPENDENCIES = libfutils ulog host-alchemy
+LIBSHDATA_INSTALL_STAGING = YES
+
+LIBSHDATA_TARGETS = libshdata
+ifeq ($(BR2_PACKAGE_LIBSHDATA_STRESS),y)
+LIBSHDATA_TARGETS += libshdata-stress
+endif
+
+define LIBSHDATA_BUILD_CMDS
+ $(ALCHEMY_TARGET_ENV) \
+ ALCHEMY_TARGET_SDK_DIRS="$(ALCHEMY_SDK_BASEDIR)/libfutils \
+ $(ALCHEMY_SDK_BASEDIR)/ulog" \
+ $(ALCHEMY_MAKE) $(LIBSHDATA_TARGETS)
+endef
+
+ifeq ($(BR2_SHARED_LIBS),)
+define LIBSHDATA_INSTALL_STATIC_LIBS
+ $(INSTALL) -D -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata.a \
+ $(1)/usr/lib/libshdata.a
+ $(INSTALL) -D -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata-section-lookup.a \
+ $(1)/usr/lib/libshdata-section-lookup.a
+endef
+else
+# We should be dynamic libraries only but libshdata-section-lookup is only
+# build as a static lib (include $(BUILD_STATIC_LIBRARY) in atom.mk) and it
+# is needed for libshdata usage.
+define LIBSHDATA_INSTALL_STATIC_LIBS
+ $(INSTALL) -D -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata-section-lookup.a \
+ $(1)/usr/lib/libshdata-section-lookup.a
+endef
+endif
+
+define LIBSHDATA_INSTALL_HEADERS
+ mkdir -p $(1)/usr/include/
+ $(INSTALL) -m 644 $(@D)/include/* $(1)/usr/include/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define LIBSHDATA_INSTALL_SHARED_LIBS
+ mkdir -p $(1)/usr/lib/
+ $(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata.so* \
+ $(1)/usr/lib/
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_LIBSHDATA_STRESS),y)
+define LIBSHDATA_INSTALL_BIN
+ $(INSTALL) -D -m 755 $(@D)/alchemy-out/staging/usr/bin/libshdata-stress \
+ $(1)/usr/bin/libshdata-stress
+endef
+endif
+
+define LIBSHDATA_INSTALL_TARGET_CMDS
+ $(call LIBSHDATA_INSTALL_SHARED_LIBS, $(TARGET_DIR))
+ $(call LIBSHDATA_INSTALL_BIN, $(TARGET_DIR))
+endef
+
+define LIBSHDATA_INSTALL_STAGING_CMDS
+ $(call LIBSHDATA_INSTALL_STATIC_LIBS, $(STAGING_DIR))
+ $(call LIBSHDATA_INSTALL_SHARED_LIBS, $(STAGING_DIR))
+ $(call LIBSHDATA_INSTALL_HEADERS, $(STAGING_DIR))
+ $(call ALCHEMY_INSTALL_LIB_SDK_FILE, libshdata, libshdata, libshdata.so, libfutils, libulog)
+endef
+
+$(eval $(generic-package))
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 5/5] support/testing/tests/package/test_libshdata: new test
2022-01-10 14:50 [Buildroot] [PATCH v3 0/5] Add Alchemy build system and some related libs Herve Codina
` (3 preceding siblings ...)
2022-01-10 14:50 ` [Buildroot] [PATCH v3 4/5] package/libshdata: " Herve Codina
@ 2022-01-10 14:50 ` Herve Codina
4 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2022-01-10 14:50 UTC (permalink / raw)
To: buildroot; +Cc: Hervé Codina, Yann E . MORIN, Thomas Petazzoni
This new test ensures that libraries and binaries generated
using Parrot Alchemy build system are correct.
Indeed, the test uses libshdata-stress.
This binary depends on libshdata.
libshdata depends on libfutils and libfutils depends on ulog.
All of these binaries and libraries are built using Alchemy.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
Changed v1 -> v2:
none
Changed v2 -> v3:
none
DEVELOPERS | 1 +
.../testing/tests/package/test_libshdata.py | 25 +++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 support/testing/tests/package/test_libshdata.py
diff --git a/DEVELOPERS b/DEVELOPERS
index 8d0258d7e8..68d66e08a7 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1201,6 +1201,7 @@ F: package/php-pam/
F: package/php-pecl-dbus/
F: package/ulog/
F: support/testing/tests/package/test_dtbocfg.py
+F: support/testing/tests/package/test_libshdata.py
F: support/testing/tests/package/test_lua_augeas.py
F: support/testing/tests/package/test_php_apcu.py
F: support/testing/tests/package/test_php_lua.py
diff --git a/support/testing/tests/package/test_libshdata.py b/support/testing/tests/package/test_libshdata.py
new file mode 100644
index 0000000000..80b032ac69
--- /dev/null
+++ b/support/testing/tests/package/test_libshdata.py
@@ -0,0 +1,25 @@
+import os
+
+import infra.basetest
+
+
+class TestLibshdata(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ """
+ BR2_PACKAGE_LIBSHDATA=y
+ BR2_PACKAGE_LIBSHDATA_STRESS=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def test_run(self):
+ img = os.path.join(self.builddir, "images", "rootfs.cpio")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-initrd", img])
+ self.emulator.login()
+
+ # Just run libshdata-stress.
+ # This ensures that library are well compiled and that all dependencies
+ # are met using Parrot Alchemy build system.
+ self.assertRunOk("libshdata-stress")
--
2.33.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread