redox/recipes/dev/gcc13/recipe.toml
Anhad Singh 3ee1f4da00 feat(cookbook): add the option to prefer static
By default all libraries and applications that can be dynamically linked
will be dynamically linked. You can override this behaviour by setting
the `COOKBOOK_PREFER_STATIC` environment variable. Note that if you
perviously did not use this flag, it might (most likely will) require a
complete userland sysroot recompilation.

It will look like this:
```bash
$ make clean
$ COOKBOOK_PREFER_STATIC=yes make image
```

For testing, the following will also work:
```bash
$ COOKBOOK_PREFER_STATIC=yes make cr.{PACKAGE_NAME} # obviously replace
                                                    # PACKAGE_NAME with
                                                    # the name of a package :)
```

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-01-20 19:55:37 +11:00

66 lines
1.5 KiB
TOML

[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"
)
if [[ -n "$COOKBOOK_PREFER_STATIC" ]]; then
COOKBOOK_CONFIGURE_FLAGS+=(
--enable-static
--disable-shared
)
else
COOKBOOK_CONFIGURE_FLAGS+=(
--enable-shared
--disable-static
)
fi
"${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"
]