[Buildroot] [PATCH v2 1/5] package/alchemy: new host package

Herve Codina herve.codina at bootlin.com
Fri Nov 12 13:12:54 UTC 2021


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 at 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 at henriquecamargo.com>
 F:	package/json-glib/
 
 N:	Hervé Codina <herve.codina at 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 at 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 at 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



More information about the buildroot mailing list