feat(gcc13): dynamic

Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
Anhad Singh 2025-01-14 00:21:59 +11:00
parent 4958040529
commit 61b536c275
3 changed files with 71 additions and 67 deletions

View File

@ -1,56 +0,0 @@
VERSION="13.2.0"
TAR="https://gitlab.redox-os.org/redox-os/gcc/-/archive/redox-${VERSION}/gcc-redox-${VERSION}.tar.gz"
#GIT=https://gitlab.redox-os.org/redox-os/gcc.git
#GIT_UPSTREAM=https://gcc.gnu.org/git/gcc.git
#BRANCH="redox-${VERSION}"
BUILD_DEPENDS=(relibc)
DEPENDS="gnu-binutils relibc"
function recipe_version {
echo "${VERSION}"
skip=1
}
function recipe_build {
./contrib/download_prerequisites
cp config.sub gmp/config.sub
cp config.sub isl/config.sub
cp config.sub mpfr/config.sub
cp -f config.sub mpc/config.sub
sysroot="$(realpath ../sysroot)"
mkdir -p "$sysroot/usr"
ln -sf "$sysroot/include" "$sysroot/usr/include"
ln -sf "$sysroot/lib" "$sysroot/usr/lib"
export LDFLAGS="--static"
./configure \
--build=${BUILD} \
--host=${HOST} \
--target=${HOST} \
--prefix=/ \
--with-sysroot=/ \
--with-build-sysroot="$sysroot" \
--with-static-standard-libraries \
--disable-dlopen \
--disable-lto \
--disable-nls \
--enable-languages=c,c++ \
--enable-shared \
--enable-static \
--enable-threads=posix
"$REDOX_MAKE" -j "$(nproc)" all-gcc all-target-libgcc all-target-libstdc++-v3
skip=1
}
function recipe_clean {
"$REDOX_MAKE" clean
skip=1
}
function recipe_stage {
dest="$(realpath $1)"
"$REDOX_MAKE" DESTDIR="$dest" install-gcc install-target-libgcc install-target-libstdc++-v3
find "$dest"/{bin,libexec} -exec $STRIP {} ';' 2> /dev/null
ln -s "gcc" "$1/bin/cc"
skip=1
}

View File

@ -0,0 +1,53 @@
[source]
tar = "https://gitlab.redox-os.org/redox-os/gcc/-/archive/redox-13.2.0/gcc-redox-13.2.0.tar.gz"
[build]
template = "custom"
dependencies = [
"libgmp",
"libmpfr",
"mpc",
"zlib"
]
script = """
DYNAMIC_INIT
mkdir -p "${COOKBOOK_SYSROOT}/usr"
ln -sf "${COOKBOOK_SYSROOT}/include" "${COOKBOOK_SYSROOT}/usr/include"
ln -sf "${COOKBOOK_SYSROOT}/lib" "${COOKBOOK_SYSROOT}/usr/lib"
pushd $COOKBOOK_SOURCE
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/
popd # pushd $COOKBOOK_SOURCE
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--target="${GNU_TARGET}"
--prefix=/
--enable-shared
--disable-static
--with-sysroot=/
--with-build-sysroot="${COOKBOOK_SYSROOT}"
--enable-languages=c,c++,lto
--enable-initfini-array
--disable-multilib
--with-system-zlib
--enable-host-shared
--with-bugurl="https://gitlab.redox-os.org/redox-os/gcc/-/issues"
)
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-gcc
"${COOKBOOK_MAKE}" install-gcc DESTDIR="${COOKBOOK_STAGE}"
ln -s "gcc" "${COOKBOOK_STAGE}/bin/cc"
"""
[package]
dependencies = [
"libgcc",
"libgmp",
"libmpfr",
"mpc",
"zlib"
]

View File

@ -20,21 +20,28 @@ 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
--target="${GNU_TARGET}"
--disable-werror
--disable-dependency-tracking
--disable-nls
--enable-colored-disassembly
--enable-gdb
--with-system-zlib
--with-multilib
--with-interwork
--with-pic
--with-expat
)
cookbook_configure
"""
[package]
dependencies = ["zlib"]
dependencies = [
"libgcc",
"expat",
"libgmp",
"libmpfr",
"zlib",
]