118 lines
3.3 KiB
TOML
118 lines
3.3 KiB
TOML
[source]
|
|
git = "https://gitlab.redox-os.org/redox-os/gcc"
|
|
branch = "redox-13.2.0"
|
|
shallow_clone = true
|
|
script = """
|
|
DYNAMIC_INIT
|
|
if command -v autoreconf2.69 >/dev/null 2>&1; then
|
|
COOKBOOK_AUTORECONF=autoreconf2.69
|
|
export COOKBOOK_AUTORECONF
|
|
autotools_recursive_regenerate -I"$(realpath ./config)"
|
|
fi
|
|
LIBTOOL_BUILD_AUX="${COOKBOOK_LIBTOOL_DIR:-$COOKBOOK_HOST_SYSROOT}"/share/libtool/build-aux
|
|
cp -fpv "$LIBTOOL_BUILD_AUX"/{config.sub,config.guess,install-sh} libiberty/
|
|
"""
|
|
|
|
[build]
|
|
template = "custom"
|
|
dependencies = [
|
|
"libgmp",
|
|
"libmpfr",
|
|
"mpc",
|
|
# TODO: this zlib get linked when boostrapping gcc
|
|
# "zlib"
|
|
]
|
|
script = """
|
|
DYNAMIC_STATIC_INIT
|
|
CROSS_GNU_TARGET=${COOKBOOK_CROSS_GNU_TARGET:-$GNU_TARGET}
|
|
|
|
# The GCC configure probe can see the host's sys/sdt.h while building a Redox
|
|
# target. Redox does not provide SystemTap probes, so keep libgcc from enabling
|
|
# HAVE_SYS_SDT_H and then failing to include a non-existent target header.
|
|
export gcc_cv_sys_sdt_h=no
|
|
|
|
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
|
|
# not specifying --enable-shared as it will link shared deps
|
|
COOKBOOK_STAGE+="/usr"
|
|
COOKBOOK_CONFIGURE_FLAGS=(
|
|
--prefix=""
|
|
--host="${GNU_TARGET}"
|
|
--program-prefix="${CROSS_GNU_TARGET}-"
|
|
--with-native-system-header-dir="/include"
|
|
--disable-hosted-libstdcxx
|
|
--with-sysroot
|
|
--with-build-sysroot="${COOKBOOK_CROSS_SYSROOT:-$COOKBOOK_SYSROOT}"
|
|
--disable-bootstrap
|
|
)
|
|
else
|
|
export CFLAGS_FOR_TARGET="${CPPFLAGS}" CXXFLAGS_FOR_TARGET="${CPPFLAGS}" LDFLAGS_FOR_TARGET="${LDFLAGS}"
|
|
export CC_FOR_BUILD="$CC_WRAPPER gcc" CXX_FOR_BUILD="$CC_WRAPPER g++"
|
|
unset CFLAGS CPPFLAGS LDFLAGS
|
|
COOKBOOK_CONFIGURE_FLAGS+=(
|
|
--with-sysroot=/
|
|
--with-gmp="${COOKBOOK_SYSROOT}/usr"
|
|
--with-mpfr="${COOKBOOK_SYSROOT}/usr"
|
|
--with-mpc="${COOKBOOK_SYSROOT}/usr"
|
|
)
|
|
fi
|
|
|
|
if [ "${CROSS_GNU_TARGET}" = "riscv64gc-unknown-redox" ]; then
|
|
COOKBOOK_CONFIGURE_FLAGS+=(
|
|
--with-arch=rv64gc
|
|
--with-abi=lp64d
|
|
)
|
|
fi
|
|
|
|
if [ "${CROSS_GNU_TARGET}" != "i586-unknown-redox" ]; then
|
|
COOKBOOK_CONFIGURE_FLAGS+=(
|
|
--enable-frame-pointer
|
|
)
|
|
fi
|
|
|
|
COOKBOOK_CONFIGURE_FLAGS+=(
|
|
--target="${CROSS_GNU_TARGET}"
|
|
--with-linker-hash-style=gnu
|
|
--enable-languages=c,c++,lto
|
|
--enable-initfini-array
|
|
--disable-nls
|
|
--disable-multilib
|
|
# --with-system-zlib
|
|
--enable-host-shared
|
|
--enable-threads=posix
|
|
--enable-libstdcxx-threads
|
|
--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}"
|
|
|
|
# requires relibc which is not available on bootstrapping
|
|
if [ "${COOKBOOK_HOST_SYSROOT}" != "/usr" ]; then
|
|
|
|
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-target-libgcc all-target-libstdc++-v3
|
|
"${COOKBOOK_MAKE}" install-target-libgcc install-target-libstdc++-v3 DESTDIR="${COOKBOOK_STAGE}"
|
|
ln -s "gcc" "${COOKBOOK_STAGE}/usr/bin/cc"
|
|
# Avoid conflict with libgcc & libstdcxx
|
|
rm -f "${COOKBOOK_STAGE}"/usr/lib/libgcc_s.so* "${COOKBOOK_STAGE}"/usr/lib/libstdc++.so*
|
|
|
|
fi
|
|
"""
|
|
|
|
[package]
|
|
dependencies = [
|
|
"gnu-binutils"
|
|
]
|
|
|
|
[[optional-packages]]
|
|
name = "cxx"
|
|
dependencies = []
|
|
files = [
|
|
"usr/bin/*c++",
|
|
"usr/bin/*g++",
|
|
"usr/include/c++/**",
|
|
"usr/lib/*c++*",
|
|
"usr/libexec/gcc/**/cc1plus",
|
|
"usr/share/gcc-*/python/libstdcxx/**",
|
|
]
|