live-bootstrap/steps/gcc-10.4.0/pass1.sh
fosslinux 6ed2e09f3a Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
2023-12-15 21:43:19 +11:00

100 lines
2.8 KiB
Bash
Executable file

# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
# Remove vendored zlib
rm -r zlib/
# Regen gperf file (because GCC's make rules suck)
rm gcc/cp/cfns.h
# (taken directly from gcc/cp/Make-lang.in)
gperf -o -C -E -k '1-6,$' -j1 -D -N 'libc_name_p' -L C++ \
gcc/cp/cfns.gperf --output-file gcc/cp/cfns.h
# Regenerate autogen stuff
autogen Makefile.def
pushd fixincludes
./genfixes
popd
# Regenerate autotools
# configure
find . -name configure | sed 's:/configure::' | while read d; do
pushd "${d}"
AUTOMAKE=automake-1.15 ACLOCAL=aclocal-1.15 autoreconf-2.69 -fiv
popd
done
# Because GCC is stupid, copy depcomp back in
cp "${PREFIX}/share/automake-1.15/depcomp" .
# Makefile.in only
BACK="${PWD}"
find . -type d \
-exec test -e "{}/Makefile.am" -a ! -e "{}/configure" \; \
-print | while read d; do
d="$(readlink -f "${d}")"
cd "${d}"
# Find the appropriate configure script for automake
while [ ! -e configure ]; do
cd ..
done
automake-1.15 -fai "${d}/Makefile"
cd "${BACK}"
done
# Remove bison generated files
rm intl/plural.c
# Remove flex generated files
rm gcc/gengtype-lex.c
# Remove unused generated files
rm -r libgfortran/generated
# intl/ Makefile is a bit broken because of new gettext
sed -i 's/@USE_INCLUDED_LIBINTL@/no/' intl/Makefile.in
# Regenerate crc table in libiberty/crc32.c
pushd libiberty
sed -n -e '38,65p' crc32.c > crcgen.c
gcc -o crcgen crcgen.c
head -n 69 crc32.c > crc32.c.new
./crcgen >> crc32.c.new
tail -n +138 crc32.c >> crc32.c.new
mv crc32.c.new crc32.c
popd
# Remove docs/translation
find . -name "*.gmo" -delete
find . -name "*.info" -delete
}
src_configure() {
mkdir build
cd build
# std=gnu11 is the default for GCC10, so that is what it makes most
# sense to build with. (default, std=gnu90 is too outdated).
# For this GCC, we only build one stage, as extra is superfluous,
# since we build GCC 12 straight after.
CFLAGS="-std=gnu11" \
LDFLAGS="-static" \
../configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--build=i386-unknown-linux-musl \
--target=i386-unknown-linux-musl \
--host=i386-unknown-linux-musl \
--disable-bootstrap \
--enable-static \
--program-transform-name= \
--enable-languages=c,c++ \
--with-system-zlib \
--disable-sjlj-exceptions \
--disable-multilib \
--enable-threads=posix \
--disable-libsanitizer \
--disable-libssp
}