redox/recipes/dev/gcc13/recipe.toml
Konstantin Shabanov a2f375d0ef nix: native: Fix gcc(-freestanding)-install
Provide ACLOCAL_PATH explicitly to avoid the error:

+ autoreconf2.69 -fvi -I/mnt/redox/recipes/dev/gcc13/source/config -I/usr/share/aclocal
+ for f in $(find . -name configure.ac -o -name configure.in -type f | sort)
++ dirname ./zlib/contrib/minizip/configure.ac
+ echo '* autotools regen in '\''./zlib/contrib/minizip'\''...'
* autotools regen in './zlib/contrib/minizip'...
++ dirname ./zlib/contrib/minizip/configure.ac
+ cd ./zlib/contrib/minizip
+ autoreconf2.69 -fvi
-I/mnt/redox/recipes/dev/gcc13/source/config
-I/usr/share/aclocal
Makefile.am:1: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:1:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:1:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:1:
Makefile.am:1:   If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:1:   its definition is in aclocal's search path.
Makefile.am:1:
Makefile.am:1:   If you install Automake in its own prefix,
Makefile.am:1:   you'll need to arrange for the Libtool m4 files
Makefile.am:1:   to be found by aclocal.  For info on this, see:
Makefile.am:1:     https://gnu.org/s/automake/manual/automake.html#Libtool-library-used-but-LIBTOOL-is-undefined
autoreconf: automake failed with exit status: 1
cook host:gcc13 - failed
Failed to run [cd "recipes/dev/gcc13/source" && "bash" "-ex"]: exited with status exit status: 1
make: *** [mk/prefix.mk:250: prefix/x86_64-unknown-redox/gcc-freestanding-install] Error 1
missing LT_INIT
2026-07-30 22:29:48 +07:00

112 lines
3.1 KiB
TOML

[source]
git = "https://gitlab.redox-os.org/redox-os/gcc"
branch = "redox-13.2.0"
shallow_clone = true
script = """
DYNAMIC_INIT
COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)"
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/
cp -fpv "$LIBTOOL_BUILD_AUX"/{config.sub,config.guess,install-sh} zlib/contrib/minizip/
"""
[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}
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*
# Avoid rebuilding problem
rm -f ./gcc/libgcc_s.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/**",
]