Skip to content

Commit

Permalink
core: gcc,glibc,m4 added
Browse files Browse the repository at this point in the history
  • Loading branch information
Vouivre committed Jul 5, 2020
1 parent 6bc54eb commit 6b3e32f
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 0 deletions.
77 changes: 77 additions & 0 deletions core/gcc/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh -e

# Make sure gmp is built with generic options.
cp gcc/gmp/configfsf.guess gcc/gmp/config.guess
cp gcc/gmp/configfsf.sub gcc/gmp/config.sub

# Use lib not lib64 by default.
sed -i '/m64=/s/lib64/lib/' gcc/gcc/config/i386/t-linux64
sed -i 's/lib64/lib/' gcc/gcc/config/i386/linux64.h

# Build must happen outside of gcc source.
mkdir -p gcc-build
cd gcc-build

# Grab the system's GCC version.
IFS=. read -r gcc_version _ 2>/dev/null \
< "$KISS_ROOT/var/db/kiss/installed/gcc/version" || gcc_version=null

# Skip the bootstrap process if we are able.
case $2 in "$gcc_version"*)
printf '%s\n' "Minor version difference, disabling bootstrap."
bootstrap=--disable-bootstrap
esac

export libat_cv_have_ifunc=no

../gcc/configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-multilib \
--disable-symvers \
--disable-libmpx \
--disable-libmudflap \
--disable-libsanitizer \
--disable-werror \
--disable-fixed-point \
--disable-libstdcxx-pch \
--disable-nls \
--enable-checking=release \
--enable-__cxa_atexit \
--enable-default-pie \
--enable-default-ssp \
--enable-shared \
--enable-threads \
--enable-tls \
--enable-languages=c,c++ \
--without-included-gettext \
--without-zstd \
--with-system-zlib \
--build=x86_64-pc-linux-gnu \
"${bootstrap:---enable-bootstrap}"
# --build=x86_64-pc-linux-musl \
# "${bootstrap:---enable-bootstrap}"

make
make DESTDIR="$1" install

# Save 35MB.
find "$1" -name libgtkpeer.a -exec rm -f {} +
find "$1" -name libgjsmalsa.a -exec rm -f {} +
find "$1" -name libgij.a -exec rm -f {} +

# Some legacy programs will expect cc
ln -s gcc "$1/usr/bin/cc"

# POSIX compliance.
install -Dm755 ../c99 "$1/usr/bin/c99"

# Symlink for LTO.
{
mkdir -p "$1/usr/lib/bfd-plugins"

ln -s "/usr/lib/gcc/x86_64-pc-linux-musl/$2/liblto_plugin.so" \
"$1/usr/lib/bfd-plugins/liblto_plugin.so"
}
5 changes: 5 additions & 0 deletions core/gcc/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2 gcc-10.1.0.tar.xz
87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912 gmp-6.1.2.tar.xz
1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a mpfr-4.0.2.tar.xz
6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e mpc-1.1.0.tar.gz
765614b3396d70bca3fa0ae4a813632486c6dca320e2bd13c8c39dca52be4a4c c99
4 changes: 4 additions & 0 deletions core/gcc/depends
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
binutils
bison make
flex make
zlib
2 changes: 2 additions & 0 deletions core/gcc/files/c99
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec cc -std=c99 "$@"
5 changes: 5 additions & 0 deletions core/gcc/sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://gcc.gnu.org/pub/gcc/releases/gcc-10.1.0/gcc-10.1.0.tar.xz gcc
https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz gcc/gmp
https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz gcc/mpfr
https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz gcc/mpc
files/c99
1 change: 1 addition & 0 deletions core/gcc/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.1.0 2
23 changes: 23 additions & 0 deletions core/glibc/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh -e

# pwd

# Use lib not lib64 by default.
sed -i 's/lib64/usr\/lib/' sysdeps/unix/sysv/linux/x86_64/64/configure
sed -i 's/lib64/usr\/lib/' sysdeps/unix/sysv/linux/x86_64/ldconfig.h

mkdir -p glibc-build
cd glibc-build

../configure \
--prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/bin \
--libexecdir=/usr/lib \
--libdir=/usr/lib \
--disable-werror \
--with-headers=/usr/include
# --with-headers="../include"

make
make DESTDIR="$1" install
1 change: 1 addition & 0 deletions core/glibc/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9246fe44f68feeec8c666bb87973d590ce0137cca145df014c72ec95be9ffd17 glibc-2.31.tar.xz
Empty file added core/glibc/depends
Empty file.
1 change: 1 addition & 0 deletions core/glibc/sources
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://ftp.gnu.org/gnu/glibc/glibc-2.31.tar.xz
1 change: 1 addition & 0 deletions core/glibc/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.31 1
9 changes: 9 additions & 0 deletions core/m4/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh -e

patch -p1 < m4-1.4.18-glibc-change-work-around.patch

./configure \
--prefix=/usr

make
make DESTDIR="$1" install
2 changes: 2 additions & 0 deletions core/m4/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
f2c1e86ca0a404ff281631bdc8377638992744b175afb806e25871a24a934e07 m4-1.4.18.tar.xz
fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 m4-1.4.18-glibc-change-work-around.patch
115 changes: 115 additions & 0 deletions core/m4/patches/m4-1.4.18-glibc-change-work-around.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
diff -up m4-1.4.18/lib/fflush.c.orig m4-1.4.18/lib/fflush.c
--- m4-1.4.18/lib/fflush.c.orig 2018-05-02 12:35:59.536851666 +0200
+++ m4-1.4.18/lib/fflush.c 2018-05-02 12:37:02.768958606 +0200
@@ -33,7 +33,7 @@
#undef fflush


-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
static void
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)

#endif

-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)

# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
if (stream == NULL || ! freading (stream))
return fflush (stream);

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

clear_ungetc_buffer_preserving_position (stream);

diff -up m4-1.4.18/lib/fpending.c.orig m4-1.4.18/lib/fpending.c
--- m4-1.4.18/lib/fpending.c.orig 2018-05-02 12:35:32.305806774 +0200
+++ m4-1.4.18/lib/fpending.c 2018-05-02 12:35:44.944827347 +0200
@@ -32,7 +32,7 @@ __fpending (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return fp->_IO_write_ptr - fp->_IO_write_base;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
diff -up m4-1.4.18/lib/fpurge.c.orig m4-1.4.18/lib/fpurge.c
--- m4-1.4.18/lib/fpurge.c.orig 2018-05-02 12:38:13.586078669 +0200
+++ m4-1.4.18/lib/fpurge.c 2018-05-02 12:38:38.785121867 +0200
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_end = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_write_base;
/* Avoid memory leak when there is an active ungetc buffer. */
diff -up m4-1.4.18/lib/freadahead.c.orig m4-1.4.18/lib/freadahead.c
--- m4-1.4.18/lib/freadahead.c.orig 2016-12-31 14:54:41.000000000 +0100
+++ m4-1.4.18/lib/freadahead.c 2018-05-02 11:43:19.570336724 +0200
@@ -25,7 +25,7 @@
size_t
freadahead (FILE *fp)
{
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_write_ptr > fp->_IO_write_base)
return 0;
return (fp->_IO_read_end - fp->_IO_read_ptr)
diff -up m4-1.4.18/lib/freading.c.orig m4-1.4.18/lib/freading.c
--- m4-1.4.18/lib/freading.c.orig 2018-05-02 12:37:33.970011368 +0200
+++ m4-1.4.18/lib/freading.c 2018-05-02 12:37:59.393054359 +0200
@@ -31,7 +31,7 @@ freading (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
diff -up m4-1.4.18/lib/fseeko.c.orig m4-1.4.18/lib/fseeko.c
--- m4-1.4.18/lib/fseeko.c.orig 2018-05-02 11:44:17.947460233 +0200
+++ m4-1.4.18/lib/fseeko.c 2018-05-02 12:39:49.537216897 +0200
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
#endif

/* These tests are based on fpurge.c. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
return -1;
}

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
fp->_offset = pos;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
diff -up m4-1.4.18/lib/stdio-impl.h.orig m4-1.4.18/lib/stdio-impl.h
--- m4-1.4.18/lib/stdio-impl.h.orig 2016-12-31 14:54:42.000000000 +0100
+++ m4-1.4.18/lib/stdio-impl.h 2018-05-02 11:43:19.570336724 +0200
@@ -18,6 +18,12 @@
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */

+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
+ problem by defining it ourselves. FIXME: Do not rely on glibc
+ internals. */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif

/* BSD stdio derived implementations. */

2 changes: 2 additions & 0 deletions core/m4/sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz
patches/m4-1.4.18-glibc-change-work-around.patch
1 change: 1 addition & 0 deletions core/m4/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.4.18 2

0 comments on commit 6b3e32f

Please sign in to comment.