All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs
@ 2021-11-12 13:12 Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 1/5] package/alchemy: new host package Herve Codina
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, Thomas Petazzoni

Hi,

This patch series introduces the Parrot Alchemy build system as a
host tool (patch 1).
This tool is then used to build several libs (patch 2, 3 and 4).
Finaly (patch 5), a test is provided to check that the binaries
were correctly built.

As it was mentionned by Thomas Peteazzoni in the previous review,
a new package infrastructure was not added for the Alchemy build system.
Indeed, we do not expect to have a significant number of packages that
will rely on the Alchemy build system.

Of course, should we have more of these packages in the future, we can
consider adding a package infrastructure.

Best regards,
Hervé Codina

Herve Codina (5):
  package/alchemy: new host package
  package/ulog: new package
  package/libfutils: new package
  package/libshdata: new package
  support/testing/tests/package/test_libshdata: new test

 DEVELOPERS                                    |  5 ++
 package/Config.in                             |  3 +
 ...lchains-remove-hash-style-management.patch | 36 ++++++++++
 package/alchemy/alchemy.hash                  |  4 ++
 package/alchemy/alchemy.mk                    | 71 +++++++++++++++++++
 package/libfutils/Config.in                   | 15 ++++
 package/libfutils/libfutils.hash              |  3 +
 package/libfutils/libfutils.mk                | 50 +++++++++++++
 ...01-backend-Add-missing-include-files.patch | 47 ++++++++++++
 package/libshdata/Config.in                   | 25 +++++++
 package/libshdata/libshdata.hash              |  3 +
 package/libshdata/libshdata.mk                | 58 +++++++++++++++
 package/ulog/Config.in                        | 12 ++++
 package/ulog/ulog.hash                        |  3 +
 package/ulog/ulog.mk                          | 44 ++++++++++++
 .../testing/tests/package/test_libshdata.py   | 25 +++++++
 16 files changed, 404 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/libfutils/Config.in
 create mode 100644 package/libfutils/libfutils.hash
 create mode 100644 package/libfutils/libfutils.mk
 create mode 100644 package/libshdata/0001-backend-Add-missing-include-files.patch
 create mode 100644 package/libshdata/Config.in
 create mode 100644 package/libshdata/libshdata.hash
 create mode 100644 package/libshdata/libshdata.mk
 create mode 100644 package/ulog/Config.in
 create mode 100644 package/ulog/ulog.hash
 create mode 100644 package/ulog/ulog.mk
 create mode 100644 support/testing/tests/package/test_libshdata.py

-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 1/5] package/alchemy: new host package
  2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
@ 2021-11-12 13:12 ` Herve Codina
  2022-01-01 15:50   ` Yann E. MORIN
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 2/5] package/ulog: new package Herve Codina
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, 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

 DEVELOPERS                                    |  1 +
 ...lchains-remove-hash-style-management.patch | 36 ++++++++++
 package/alchemy/alchemy.hash                  |  4 ++
 package/alchemy/alchemy.mk                    | 72 +++++++++++++++++++
 4 files changed, 113 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 70262eac8c..ebb60cdef9 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1149,6 +1149,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..63d5a941c5
--- /dev/null
+++ b/package/alchemy/alchemy.mk
@@ -0,0 +1,72 @@
+################################################################################
+#
+# 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_SDK_BASEDIR = $(STAGING_DIR)/usr/lib/alchemy/sdk
+
+define HOST_ALCHEMY_INSTALL_CMDS
+	rm -rf $(HOST_DIR)/opt/alchemy
+	mkdir -p $(HOST_DIR)/opt/alchemy
+	cp -rf $(@D)/* $(HOST_DIR)/opt/alchemy/
+endef
+
+$(eval $(host-generic-package))
+
+# Variables used by other packages
+
+ALCHEMY_HOME = $(HOST_DIR)/opt/alchemy
+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
+define ALCHEMY_INSTALL_LIB_SDK_FILE
+	mkdir -p $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))
+	( \
+		echo 'LOCAL_PATH := $$(call my-dir)'; \
+		echo 'include $$(CLEAR_VARS)'; \
+		echo 'LOCAL_MODULE := $(strip $(2))'; \
+		echo 'LOCAL_SDK := $(STAGING_DIR)'; \
+		echo 'LOCAL_DESTDIR := usr/lib'; \
+		echo 'LOCAL_MODULE_FILENAME := $(strip $(3))'; \
+		echo 'include $$(BUILD_LIBRARY)'; \
+	) > $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))/atom.mk
+endef
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 2/5] package/ulog: new package
  2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 1/5] package/alchemy: new host package Herve Codina
@ 2021-11-12 13:12 ` Herve Codina
  2022-01-01 16:05   ` Yann E. MORIN
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 3/5] package/libfutils: " Herve Codina
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, 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

 DEVELOPERS             |  1 +
 package/Config.in      |  1 +
 package/ulog/Config.in | 12 ++++++++++++
 package/ulog/ulog.hash |  3 +++
 package/ulog/ulog.mk   | 44 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 61 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 ebb60cdef9..004eb17cd4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1154,6 +1154,7 @@ F:	package/dtbocfg/
 F:	package/libdbi/
 F:	package/libdbi-drivers/
 F:	package/lua-augeas/
+F:	package/ulog/
 F:	support/testing/tests/package/test_dtbocfg.py
 F:	support/testing/tests/package/test_lua_augeas.py
 
diff --git a/package/Config.in b/package/Config.in
index cb94e30be3..cb4acd3cf0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1706,6 +1706,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..fab16e80d8
--- /dev/null
+++ b/package/ulog/ulog.mk
@@ -0,0 +1,44 @@
+################################################################################
+#
+# 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
+
+define ULOG_INSTALL_STATIC_LIBS
+	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libulog.a $(1)/usr/lib/
+endef
+
+define ULOG_INSTALL_HEADERS
+	cp -Raf $(@D)/libulog/include/* $(1)/usr/include/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define ULOG_INSTALL_SHARED_LIBS
+	$(INSTALL) -m 755 $(@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.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 3/5] package/libfutils: new package
  2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 1/5] package/alchemy: new host package Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 2/5] package/ulog: new package Herve Codina
@ 2021-11-12 13:12 ` Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 4/5] package/libshdata: " Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 5/5] support/testing/tests/package/test_libshdata: new test Herve Codina
  4 siblings, 0 replies; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, 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

 DEVELOPERS                       |  1 +
 package/Config.in                |  1 +
 package/libfutils/Config.in      | 15 ++++++++++
 package/libfutils/libfutils.hash |  3 ++
 package/libfutils/libfutils.mk   | 50 ++++++++++++++++++++++++++++++++
 5 files changed, 70 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 004eb17cd4..792aae625f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1153,6 +1153,7 @@ F:	package/alchemy/
 F:	package/dtbocfg/
 F:	package/libdbi/
 F:	package/libdbi-drivers/
+F:	package/libfutils/
 F:	package/lua-augeas/
 F:	package/ulog/
 F:	support/testing/tests/package/test_dtbocfg.py
diff --git a/package/Config.in b/package/Config.in
index cb4acd3cf0..89d928c0e7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1950,6 +1950,7 @@ menu "Other"
 	source "package/libevdev/Config.in"
 	source "package/libevent/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..ac4ad69d71
--- /dev/null
+++ b/package/libfutils/libfutils.mk
@@ -0,0 +1,50 @@
+################################################################################
+#
+# 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
+
+define LIBFUTILS_INSTALL_STATIC_LIBS
+	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libfutils.a $(1)/usr/lib/
+endef
+
+define LIBFUTILS_INSTALL_HEADERS
+	cp -Raf $(@D)/include/* $(1)/usr/include/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define LIBFUTILS_INSTALL_SHARED_LIBS
+	$(INSTALL) -m 755 $(@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)
+endef
+
+$(eval $(generic-package))
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 4/5] package/libshdata: new package
  2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
                   ` (2 preceding siblings ...)
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 3/5] package/libfutils: " Herve Codina
@ 2021-11-12 13:12 ` Herve Codina
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 5/5] support/testing/tests/package/test_libshdata: new test Herve Codina
  4 siblings, 0 replies; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, Thomas Petazzoni

The libshdata library provides lock free shared-memory tools.

https://github.com/Parrot-Developers/libshdata

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

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...01-backend-Add-missing-include-files.patch | 47 +++++++++++++++
 package/libshdata/Config.in                   | 25 ++++++++
 package/libshdata/libshdata.hash              |  3 +
 package/libshdata/libshdata.mk                | 58 +++++++++++++++++++
 6 files changed, 135 insertions(+)
 create mode 100644 package/libshdata/0001-backend-Add-missing-include-files.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 792aae625f..461c987b94 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1154,6 +1154,7 @@ F:	package/dtbocfg/
 F:	package/libdbi/
 F:	package/libdbi-drivers/
 F:	package/libfutils/
+F:	package/libshdata/
 F:	package/lua-augeas/
 F:	package/ulog/
 F:	support/testing/tests/package/test_dtbocfg.py
diff --git a/package/Config.in b/package/Config.in
index 89d928c0e7..e2a8f64fb1 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1991,6 +1991,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/Config.in b/package/libshdata/Config.in
new file mode 100644
index 0000000000..89d4e1393a
--- /dev/null
+++ b/package/libshdata/Config.in
@@ -0,0 +1,25 @@
+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
+	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"
+	help
+	  Install libshdata-stress binary as well
+
+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..ed9b4579a5
--- /dev/null
+++ b/package/libshdata/libshdata.mk
@@ -0,0 +1,58 @@
+################################################################################
+#
+# 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 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_MAKE) $(LIBSHDATA_TARGETS)
+endef
+
+define LIBSHDATA_INSTALL_STATIC_LIBS
+	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata.a $(1)/usr/lib/
+	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libshdata-section-lookup.a $(1)/usr/lib/
+endef
+
+define LIBSHDATA_INSTALL_HEADERS
+	cp -Raf $(@D)/include/* $(1)/usr/include/
+endef
+
+ifeq ($(BR2_STATIC_LIBS),)
+define LIBSHDATA_INSTALL_SHARED_LIBS
+	$(INSTALL) -m 755 $(@D)/alchemy-out/staging/usr/lib/libshdata.so* $(1)/usr/lib/
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_LIBSHDATA_STRESS),y)
+define LIBSHDATA_INSTALL_BIN
+	$(INSTALL) -m 755 $(@D)/alchemy-out/staging/usr/bin/libshdata-stress $(1)/usr/bin/
+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)
+endef
+
+$(eval $(generic-package))
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2 5/5] support/testing/tests/package/test_libshdata: new test
  2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
                   ` (3 preceding siblings ...)
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 4/5] package/libshdata: " Herve Codina
@ 2021-11-12 13:12 ` Herve Codina
  4 siblings, 0 replies; 10+ messages in thread
From: Herve Codina @ 2021-11-12 13:12 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, 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

 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 461c987b94..4a03086653 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1158,6 +1158,7 @@ F:	package/libshdata/
 F:	package/lua-augeas/
 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
 
 N:	Hervé Codina <herve.codina@bootlin.com>
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.31.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 1/5] package/alchemy: new host package
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 1/5] package/alchemy: new host package Herve Codina
@ 2022-01-01 15:50   ` Yann E. MORIN
  2022-01-09 15:17     ` Herve Codina
  0 siblings, 1 reply; 10+ messages in thread
From: Yann E. MORIN @ 2022-01-01 15:50 UTC (permalink / raw)
  To: Herve Codina; +Cc: Thomas Petazzoni, buildroot

Hervé, All,

On 2021-11-12 14:12 +0100, Herve Codina spake thusly:
> 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>

I was about to push this, with a few changes, but I have some questions
about the packages, so here's the patch of the changes I did:

    [yann.morin.1998@free.fr:
      - use ALCHEMY_HOME everywhere rather than repeating the location in
        the install macro
      - don't remove install dir before installing
      - use a template for atom.mk, not in-line in alchemy.mk
    ]

    diff --git a/package/alchemy/alchemy.mk b/package/alchemy/alchemy.mk
    index 63d5a941c5..f802c62425 100644
    --- a/package/alchemy/alchemy.mk
    +++ b/package/alchemy/alchemy.mk
    @@ -10,19 +10,19 @@ 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
    -	rm -rf $(HOST_DIR)/opt/alchemy
    -	mkdir -p $(HOST_DIR)/opt/alchemy
    -	cp -rf $(@D)/* $(HOST_DIR)/opt/alchemy/
    +	mkdir -p $(ALCHEMY_HOME)
    +	cp -rf $(@D)/* $(ALCHEMY_HOME)
    +	cp $(ALCHEMY_PKGDIR)/atom.mk.in $(ALCHEMY_HOM	E)/atom.mk.in
     endef
     
     $(eval $(host-generic-package))
     
     # Variables used by other packages
     
    -ALCHEMY_HOME = $(HOST_DIR)/opt/alchemy
     ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake
     
     # TARGET_ARCH is set to 'xxx' to avoid Alchemy managing the architecture.
    @@ -59,14 +59,11 @@ endif
     # $2: Alchemy module name
     # $3: Alchemy module file name
     define ALCHEMY_INSTALL_LIB_SDK_FILE
    -	mkdir -p $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))
    -	( \
    -		echo 'LOCAL_PATH := $$(call my-dir)'; \
    -		echo 'include $$(CLEAR_VARS)'; \
    -		echo 'LOCAL_MODULE := $(strip $(2))'; \
    -		echo 'LOCAL_SDK := $(STAGING_DIR)'; \
    -		echo 'LOCAL_DESTDIR := usr/lib'; \
    -		echo 'LOCAL_MODULE_FILENAME := $(strip $(3))'; \
    -		echo 'include $$(BUILD_LIBRARY)'; \
    -	) > $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))/atom.mk
    +	$(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))#' \
    +		$(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..30eb6d5e23
    --- /dev/null
    +++ b/package/alchemy/atom.mk.in
    @@ -0,0 +1,7 @@
    +LOCAL_PATH := $(call my-dir)
    +include $(CLEAR_VARS)
    +LOCAL_MODULE := @MODULE@
    +LOCAL_SDK := @STAGING_DIR@
    +LOCAL_DESTDIR := usr/lib
    +LOCAL_MODULE_FILENAME := @MODULE_FILENAME@
    +include $(BUILD_LIBRARY)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 2/5] package/ulog: new package
  2021-11-12 13:12 ` [Buildroot] [PATCH v2 2/5] package/ulog: new package Herve Codina
@ 2022-01-01 16:05   ` Yann E. MORIN
  2022-01-10  9:02     ` Herve Codina
  0 siblings, 1 reply; 10+ messages in thread
From: Yann E. MORIN @ 2022-01-01 16:05 UTC (permalink / raw)
  To: Herve Codina; +Cc: Thomas Petazzoni, buildroot

Hervé, All,

On 2021-11-12 14:12 +0100, Herve Codina spake thusly:
> 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>
[--SNIP--]
> diff --git a/package/ulog/ulog.mk b/package/ulog/ulog.mk
> new file mode 100644
> index 0000000000..fab16e80d8
> --- /dev/null
> +++ b/package/ulog/ulog.mk
> @@ -0,0 +1,44 @@
> +################################################################################
> +#
> +# 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
> +
> +define ULOG_INSTALL_STATIC_LIBS
> +	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libulog.a $(1)/usr/lib/
> +endef

So, it looks like you are always going to install the static library,
but the package does not have:  depends on !BR2_STATIC_LIBS

> +
> +define ULOG_INSTALL_HEADERS
> +	cp -Raf $(@D)/libulog/include/* $(1)/usr/include/
> +endef
> +
> +ifeq ($(BR2_STATIC_LIBS),)
> +define ULOG_INSTALL_SHARED_LIBS
> +	$(INSTALL) -m 755 $(@D)/alchemy-out/staging/usr/lib/libulog.so* $(1)/usr/lib/

Although it is very improbable that the destination directory does not
already exist, that is still a possibility, especially in target/. And
for consistency with all the other packages, you must create the
destination directory first before you start copying multiple files in
there.

Also for consistency, use either 'cp' or '$(INSTALL)', not both , in the
same .mk (you used 'cp' for headers, and '$(INSTALL)' for libs, although
I don't see a reason not to use them consistently).

Oh, and shared libraries do not need to be +x, so -m 644 is enough.

> +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)

So, what happens with BR2_STATIC_LIBS=y? The .so would not exist in that
case, would it? But then, this is what would be registered in the
atom.mk...

And with BR2_STATIC_LIBS not set, then the .a should not be built (or at
least not installed!), yet the installation of the static lib is
unconditional (and see the first comment too).

It is difficult to understand if all of the static-shared combinations
are supported, so could you please check/clarify this?

If the three combinations are indeed supported, then both the shared and
the staic install macros should be conditional. Otherwise, proper guards
should be added in the Config.in.

Those comments apply to all the pakcages in this series.

Regards,
Yann E. MORIN.

> +endef
> +
> +$(eval $(generic-package))
> -- 
> 2.31.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 1/5] package/alchemy: new host package
  2022-01-01 15:50   ` Yann E. MORIN
@ 2022-01-09 15:17     ` Herve Codina
  0 siblings, 0 replies; 10+ messages in thread
From: Herve Codina @ 2022-01-09 15:17 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Thomas Petazzoni, buildroot

Hi Yann,

On Sat, 1 Jan 2022 16:50:22 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Hervé, All,
> 
> On 2021-11-12 14:12 +0100, Herve Codina spake thusly:
> > 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>  
> 
> I was about to push this, with a few changes, but I have some questions
> about the packages, so here's the patch of the changes I did:
> 
>     [yann.morin.1998@free.fr:
>       - use ALCHEMY_HOME everywhere rather than repeating the location in
>         the install macro
>       - don't remove install dir before installing
>       - use a template for atom.mk, not in-line in alchemy.mk
>     ]
> 
>     diff --git a/package/alchemy/alchemy.mk b/package/alchemy/alchemy.mk
>     index 63d5a941c5..f802c62425 100644
>     --- a/package/alchemy/alchemy.mk
>     +++ b/package/alchemy/alchemy.mk
>     @@ -10,19 +10,19 @@ 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
>     -	rm -rf $(HOST_DIR)/opt/alchemy
>     -	mkdir -p $(HOST_DIR)/opt/alchemy
>     -	cp -rf $(@D)/* $(HOST_DIR)/opt/alchemy/
>     +	mkdir -p $(ALCHEMY_HOME)
>     +	cp -rf $(@D)/* $(ALCHEMY_HOME)
>     +	cp $(ALCHEMY_PKGDIR)/atom.mk.in $(ALCHEMY_HOM	E)/atom.mk.in
>      endef
>      
>      $(eval $(host-generic-package))
>      
>      # Variables used by other packages
>      
>     -ALCHEMY_HOME = $(HOST_DIR)/opt/alchemy
>      ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake
>      
>      # TARGET_ARCH is set to 'xxx' to avoid Alchemy managing the architecture.
>     @@ -59,14 +59,11 @@ endif
>      # $2: Alchemy module name
>      # $3: Alchemy module file name
>      define ALCHEMY_INSTALL_LIB_SDK_FILE
>     -	mkdir -p $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))
>     -	( \
>     -		echo 'LOCAL_PATH := $$(call my-dir)'; \
>     -		echo 'include $$(CLEAR_VARS)'; \
>     -		echo 'LOCAL_MODULE := $(strip $(2))'; \
>     -		echo 'LOCAL_SDK := $(STAGING_DIR)'; \
>     -		echo 'LOCAL_DESTDIR := usr/lib'; \
>     -		echo 'LOCAL_MODULE_FILENAME := $(strip $(3))'; \
>     -		echo 'include $$(BUILD_LIBRARY)'; \
>     -	) > $(ALCHEMY_SDK_BASEDIR)/$(strip $(1))/atom.mk
>     +	$(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))#' \
>     +		$(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..30eb6d5e23
>     --- /dev/null
>     +++ b/package/alchemy/atom.mk.in
>     @@ -0,0 +1,7 @@
>     +LOCAL_PATH := $(call my-dir)
>     +include $(CLEAR_VARS)
>     +LOCAL_MODULE := @MODULE@
>     +LOCAL_SDK := @STAGING_DIR@
>     +LOCAL_DESTDIR := usr/lib
>     +LOCAL_MODULE_FILENAME := @MODULE_FILENAME@
>     +include $(BUILD_LIBRARY)
> 

I take these modifications with a few changes.
They will be part of the v3 series.

Thanks,
Hervé


-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 2/5] package/ulog: new package
  2022-01-01 16:05   ` Yann E. MORIN
@ 2022-01-10  9:02     ` Herve Codina
  0 siblings, 0 replies; 10+ messages in thread
From: Herve Codina @ 2022-01-10  9:02 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Thomas Petazzoni, buildroot

Hi Yann,

On Sat, 1 Jan 2022 17:05:33 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Hervé, All,
> 
> On 2021-11-12 14:12 +0100, Herve Codina spake thusly:
> > 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>  
> [--SNIP--]
> > diff --git a/package/ulog/ulog.mk b/package/ulog/ulog.mk
> > new file mode 100644
> > index 0000000000..fab16e80d8
> > --- /dev/null
> > +++ b/package/ulog/ulog.mk
> > @@ -0,0 +1,44 @@
> > +################################################################################
> > +#
> > +# 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
> > +
> > +define ULOG_INSTALL_STATIC_LIBS
> > +	$(INSTALL) -m 644 $(@D)/alchemy-out/staging/usr/lib/libulog.a $(1)/usr/lib/
> > +endef  
> 
> So, it looks like you are always going to install the static library,
> but the package does not have:  depends on !BR2_STATIC_LIBS

The v3 series will take care of BR2_STATIC_LIBS.

> 
> > +
> > +define ULOG_INSTALL_HEADERS
> > +	cp -Raf $(@D)/libulog/include/* $(1)/usr/include/
> > +endef
> > +
> > +ifeq ($(BR2_STATIC_LIBS),)
> > +define ULOG_INSTALL_SHARED_LIBS
> > +	$(INSTALL) -m 755 $(@D)/alchemy-out/staging/usr/lib/libulog.so* $(1)/usr/lib/  
> 
> Although it is very improbable that the destination directory does not
> already exist, that is still a possibility, especially in target/. And
> for consistency with all the other packages, you must create the
> destination directory first before you start copying multiple files in
> there.

Will be fixed in v3

> 
> Also for consistency, use either 'cp' or '$(INSTALL)', not both , in the
> same .mk (you used 'cp' for headers, and '$(INSTALL)' for libs, although
> I don't see a reason not to use them consistently).
> 
> Oh, and shared libraries do not need to be +x, so -m 644 is enough.

Ok, I will use '$(INSTALL) -m 644 ' in v3 series

> 
> > +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)  
> 
> So, what happens with BR2_STATIC_LIBS=y? The .so would not exist in that
> case, would it? But then, this is what would be registered in the
> atom.mk...

The file passed to Alchemy must be the .so.
Internally, the static name will be deduced by replacing the shared
suffix (.so) by the static suffix (.a)

> 
> And with BR2_STATIC_LIBS not set, then the .a should not be built (or at
> least not installed!), yet the installation of the static lib is
> unconditional (and see the first comment too).
> 
> It is difficult to understand if all of the static-shared combinations
> are supported, so could you please check/clarify this?
> 
> If the three combinations are indeed supported, then both the shared and
> the staic install macros should be conditional. Otherwise, proper guards
> should be added in the Config.in.

In the next version (v3) of this series, I will install .a and .so according
to flags set (BR2_{STATIC,SHARED}_LIBS).

I will have one exception: libshdata, libshdata-section-lookup.a.
This static lib is needed to use libshdata and cannot be a shared library.
It is forced as static in libshdata atom.mk file (include $(BUILD_STATIC_LIBRARY))

So, I choose to install it even if we supposed to be shared library only (ie
BR2_SHARED_LIBS=y)


> 
> Those comments apply to all the pakcages in this series.
> 

Thanks for the review,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-01-10  9:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 13:12 [Buildroot] [PATCH v2 0/5] Add Alchemy build system and some related libs Herve Codina
2021-11-12 13:12 ` [Buildroot] [PATCH v2 1/5] package/alchemy: new host package Herve Codina
2022-01-01 15:50   ` Yann E. MORIN
2022-01-09 15:17     ` Herve Codina
2021-11-12 13:12 ` [Buildroot] [PATCH v2 2/5] package/ulog: new package Herve Codina
2022-01-01 16:05   ` Yann E. MORIN
2022-01-10  9:02     ` Herve Codina
2021-11-12 13:12 ` [Buildroot] [PATCH v2 3/5] package/libfutils: " Herve Codina
2021-11-12 13:12 ` [Buildroot] [PATCH v2 4/5] package/libshdata: " Herve Codina
2021-11-12 13:12 ` [Buildroot] [PATCH v2 5/5] support/testing/tests/package/test_libshdata: new test Herve Codina

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.