From a1c6409153140e6a2756d566ac3192226fb9a869 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Fri, 27 Dec 2024 03:05:08 +1100 Subject: [PATCH] feat(gnu-binutils): dynamic * dynamic * shell to toml recipe Signed-off-by: Anhad Singh --- recipes/tools/gnu-binutils/01_build_fix.patch | 24 ++++++++++ recipes/tools/gnu-binutils/recipe.sh | 47 ------------------- recipes/tools/gnu-binutils/recipe.toml | 40 ++++++++++++++++ 3 files changed, 64 insertions(+), 47 deletions(-) create mode 100644 recipes/tools/gnu-binutils/01_build_fix.patch delete mode 100644 recipes/tools/gnu-binutils/recipe.sh create mode 100644 recipes/tools/gnu-binutils/recipe.toml diff --git a/recipes/tools/gnu-binutils/01_build_fix.patch b/recipes/tools/gnu-binutils/01_build_fix.patch new file mode 100644 index 000000000..9bf0ddacd --- /dev/null +++ b/recipes/tools/gnu-binutils/01_build_fix.patch @@ -0,0 +1,24 @@ +diff '--color=auto' -ur source/gprofng/libcollector/configure.ac source-new/gprofng/libcollector/configure.ac +--- source/gprofng/libcollector/configure.ac 2024-08-17 09:00:00.000000000 +1000 ++++ source-new/gprofng/libcollector/configure.ac 2024-12-04 15:59:58.407412951 +1100 +@@ -18,7 +18,7 @@ + + m4_include([../../bfd/version.m4]) + AC_INIT([gprofng], [BFD_VERSION]) +-AC_CONFIG_MACRO_DIRS([../../config ../..]) ++#AC_CONFIG_MACRO_DIRS([../../config ../..]) + AC_CONFIG_AUX_DIR(../..) + AC_CANONICAL_TARGET + AM_INIT_AUTOMAKE +diff '--color=auto' -ur source/libiberty/configure.ac source-new/libiberty/configure.ac +--- source/libiberty/configure.ac 2024-08-17 09:00:00.000000000 +1000 ++++ source-new/libiberty/configure.ac 2024-12-04 15:59:31.572203764 +1100 +@@ -37,7 +37,7 @@ + libiberty_topdir="${srcdir}/.." + fi + AC_SUBST(libiberty_topdir) +-AC_CONFIG_AUX_DIR($libiberty_topdir) ++AC_CONFIG_AUX_DIR([.]) + + dnl Very limited version of automake's enable-maintainer-mode + diff --git a/recipes/tools/gnu-binutils/recipe.sh b/recipes/tools/gnu-binutils/recipe.sh deleted file mode 100644 index f87b12bc8..000000000 --- a/recipes/tools/gnu-binutils/recipe.sh +++ /dev/null @@ -1,47 +0,0 @@ -GIT=https://gitlab.redox-os.org/redox-os/binutils-gdb.git -BRANCH=redox-2.41 -GIT_UPSTREAM=https://sourceware.org/git/binutils-gdb.git -BUILD_DEPENDS=(expat libgmp libmpfr) - -function recipe_version { - printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" - skip=1 -} - -function recipe_build { - sysroot="$(realpath ../sysroot)" - mkdir -p "$sysroot/usr" - ln -sf "$sysroot/include" "$sysroot/usr/include" - ln -sf "$sysroot/lib" "$sysroot/usr/lib" - export CPPFLAGS="-I$sysroot/include -pie -fPIC -g" - export LDFLAGS="-L$sysroot/lib --static -g" - ./configure \ - --build=${BUILD} \ - --host=${HOST} \ - --target=${HOST} \ - --prefix=/ \ - --with-sysroot=/ \ - --with-build-sysroot="$sysroot" \ - --enable-gdb \ - --with-expat \ - --with-multilib \ - --with-interwork \ - --enable-targets="${TARGET}" \ - --disable-lto \ - --disable-nls \ - --disable-werror - "$REDOX_MAKE" -j"$($NPROC)" - skip=1 -} - -function recipe_clean { - "$REDOX_MAKE" clean - skip=1 -} - -function recipe_stage { - dest="$(realpath $1)" - "$REDOX_MAKE" DESTDIR="$dest" install - find "$dest/bin" -exec $STRIP {} ';' 2> /dev/null - skip=1 -} diff --git a/recipes/tools/gnu-binutils/recipe.toml b/recipes/tools/gnu-binutils/recipe.toml new file mode 100644 index 000000000..aead0fef4 --- /dev/null +++ b/recipes/tools/gnu-binutils/recipe.toml @@ -0,0 +1,40 @@ +[source] +tar = "https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz" +patches = ["01_build_fix.patch"] +script = """ +DYNAMIC_INIT + +COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)" +cp -fpv ${COOKBOOK_HOST_SYSROOT}/share/libtool/build-aux/{config.sub,config.guess,install-sh} libiberty/ +""" + +[build] +template = "custom" +dependencies = [ + "expat", + "libgmp", + "libmpfr", + "zlib", +] +script = """ +DYNAMIC_INIT + +COOKBOOK_CONFIGURE_FLAGS+=( + --target="${GNU_TARGET}" + --disable-werror + --disable-dependency-tracking + --disable-nls + --enable-colored-disassembly + --enable-gdb + --with-system-zlib + --with-multilib + --with-interwork + --with-pic +) + +cookbook_configure +""" + +[package] +dependencies = ["zlib"] +