summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blacklist.txt2
-rw-r--r--src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in1
-rw-r--r--src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in4
-rw-r--r--src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in4
-rw-r--r--src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in8
-rw-r--r--src/stage2/patches/generic/binutils.patch35
-rw-r--r--src/stage2/patches/generic/gcc.patch26
-rw-r--r--src/stage2/patches/generic/glibc.patch24
-rw-r--r--src/stage2/patches/powerpc64le/binutils.patch27
-rw-r--r--src/stage3/patches/generic/binutils.patch31
-rw-r--r--src/stage3/patches/generic/gcc.patch26
-rw-r--r--src/stage3/patches/generic/glibc.patch39
-rw-r--r--src/stage3/patches/powerpc64le/binutils.patch13
-rwxr-xr-xsrc/stage3/stage3.sh2
-rw-r--r--src/stage4/patches/generic/binutils.patch31
-rw-r--r--src/stage4/patches/generic/gcc.patch26
-rw-r--r--src/stage4/patches/generic/glibc.patch30
-rw-r--r--src/stage4/patches/generic/grub.patch58
-rw-r--r--src/stage4/patches/powerpc64le/binutils.patch13
-rw-r--r--src/stage4/stage4.sh2
20 files changed, 274 insertions, 128 deletions
diff --git a/src/blacklist.txt b/src/blacklist.txt
index a4521ea..2742336 100644
--- a/src/blacklist.txt
+++ b/src/blacklist.txt
@@ -20,8 +20,6 @@ jre8-openjdk-headless:build broken
jdk9-openjdk:build broken
jre9-openjdk:build broken
jre9-openjdk-headless:build broken
-lib32-gcc-libs:no multilib
-lib32-glibc:no multilib
libreoffice-fresh:depends on java-environment
libreoffice-still:depends on java-environment
libunwind:no port exists
diff --git a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
index 23333f3..9e08603 100644
--- a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in
@@ -27,7 +27,6 @@ build() {
./configure --target=$_target \
--prefix=/usr \
--with-sysroot=/usr/$_target \
- --@MULTILIB@-multilib \
--disable-werror \
--disable-nls \
--with-expat=yes \
diff --git a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
index fb7f0a8..4b5b36d 100644
--- a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in
@@ -59,7 +59,6 @@ build() {
$srcdir/gcc/configure \
--target=$_target \
- @GCC_CONFIG_FLAGS@ \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
@@ -82,7 +81,8 @@ build() {
--disable-nls \
--@MULTILIB@-multilib \
--disable-bootstrap \
- --enable-checking=release
+ --enable-checking=release \
+ @GCC_CONFIG_FLAGS@
make inhibit-libc=true all-gcc
make inhibit-libc=true all-target-libgcc
diff --git a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
index 1f1dae3..fdf7f53 100644
--- a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in
@@ -59,7 +59,6 @@ build() {
$srcdir/gcc/configure \
--target=$_target \
- @GCC_CONFIG_FLAGS@ \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
@@ -77,7 +76,8 @@ build() {
--disable-nls \
--@MULTILIB@-multilib \
--disable-bootstrap \
- --enable-checking=release
+ --enable-checking=release \
+ @GCC_CONFIG_FLAGS@
make
}
diff --git a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
index 3ff965c..d5b0e7b 100644
--- a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
+++ b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in
@@ -80,8 +80,8 @@ build() {
CFLAGS=${CFLAGS/-fno-plt/}
CXXFLAGS=${CXXFLAGS/-fno-plt/}
- CFLAGS="$CFLAGS -mcmodel=medlow -g -O2 @PLATFORM32_CFLAGS@" \
- ASFLAGS="$ASFLAGS -mcmodel=medlow @PLATFORM32_CFLAGS@" \
+ CFLAGS="$CFLAGS -g -O2 @PLATFORM32_CFLAGS@" \
+ ASFLAGS="$ASFLAGS @PLATFORM32_CFLAGS@" \
"$srcdir/glibc-$pkgver/configure" \
--host=@CHOST32@ \
--libdir=/usr/lib32 \
@@ -102,13 +102,13 @@ build() {
}
package() {
- cd glibc-build
+ cd "$srcdir/glibc-build"
make install_root=$pkgdir/usr/$_target install
[ "x@MULTILIB@" == "xenable" ] || return 0
- cd lib32-glibc-build
+ cd "$srcdir/lib32-glibc-build"
make install_root=$pkgdir/usr/$_target install
}
diff --git a/src/stage2/patches/generic/binutils.patch b/src/stage2/patches/generic/binutils.patch
index 6f0895c..b7b6710 100644
--- a/src/stage2/patches/generic/binutils.patch
+++ b/src/stage2/patches/generic/binutils.patch
@@ -1,34 +1,7 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:42:42.595035360 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,14 +45,14 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
+--- a/PKGBUILD 2018-06-20 07:56:40.877881835 +0200
++++ b/PKGBUILD 2018-06-20 11:07:26.331329370 +0200
+@@ -51,6 +51,7 @@ build() {
cd binutils-build
"$srcdir/binutils-$pkgver/configure" \
@@ -36,7 +9,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--prefix=/usr \
--with-lib-path=/usr/lib:/usr/local/lib \
--with-bugurl=https://bugs.archlinux.org/ \
-@@ -66,7 +68,7 @@ build() {
+@@ -66,7 +67,7 @@ build() {
--disable-gdb \
--disable-werror \
--with-pic \
diff --git a/src/stage2/patches/generic/gcc.patch b/src/stage2/patches/generic/gcc.patch
index 98d6f8c..354d8a8 100644
--- a/src/stage2/patches/generic/gcc.patch
+++ b/src/stage2/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-25 10:15:30.533015789 +0200
-+++ b/PKGBUILD 2018-05-25 10:18:49.539689424 +0200
+--- a/PKGBUILD 2018-06-19 08:33:15.147041639 +0200
++++ b/PKGBUILD 2018-06-19 08:56:49.223722416 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -230,3 +230,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +355,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage2/patches/generic/glibc.patch b/src/stage2/patches/generic/glibc.patch
index 6be827b..6408bd9 100644
--- a/src/stage2/patches/generic/glibc.patch
+++ b/src/stage2/patches/generic/glibc.patch
@@ -1,6 +1,6 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-19 20:29:56.917412596 +0200
-+++ b/PKGBUILD 2018-05-19 20:33:17.550747931 +0200
+--- a/PKGBUILD 2018-06-18 22:54:08.616694943 +0200
++++ b/PKGBUILD 2018-06-18 22:55:09.746695552 +0200
@@ -6,7 +6,8 @@
# NOTE: valgrind requires rebuilt with each major glibc version
@@ -27,15 +27,29 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--enable-stack-protector=strong
--enable-stackguard-randomization
--enable-static-pie
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +89,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="@CHOST@-gcc @PLATFORM32_CFLAGS@"
++ export CXX="@CHOST@-g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +106,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
@@ -164,8 +168,8 @@ package_glibc() {
"$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
diff --git a/src/stage2/patches/powerpc64le/binutils.patch b/src/stage2/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..c8392a8
--- /dev/null
+++ b/src/stage2/patches/powerpc64le/binutils.patch
@@ -0,0 +1,27 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-20 07:56:40.877881835 +0200
++++ b/PKGBUILD 2018-06-20 11:06:02.564661867 +0200
+@@ -51,6 +51,7 @@ build() {
+ cd binutils-build
+
+ "$srcdir/binutils-$pkgver/configure" \
++ --host=@CHOST@ --build=@BUILDHOST@ \
+ --prefix=/usr \
+ --with-lib-path=/usr/lib:/usr/local/lib \
+ --with-bugurl=https://bugs.archlinux.org/ \
+@@ -61,12 +62,13 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
+ --with-pic \
+- --with-system-zlib
++ --with-system-zlib=@SYSROOT@/usr/lib/libz.so
+
+ make configure-host
+ make tooldir=/usr
diff --git a/src/stage3/patches/generic/binutils.patch b/src/stage3/patches/generic/binutils.patch
deleted file mode 100644
index 893089d..0000000
--- a/src/stage3/patches/generic/binutils.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:44:11.358369579 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,8 +45,7 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
diff --git a/src/stage3/patches/generic/gcc.patch b/src/stage3/patches/generic/gcc.patch
index 1b88c31..575521d 100644
--- a/src/stage3/patches/generic/gcc.patch
+++ b/src/stage3/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-26 12:05:20.233145125 +0200
-+++ b/PKGBUILD 2018-05-26 12:56:33.449842456 +0200
+--- a/PKGBUILD 2018-06-20 10:31:33.911307893 +0200
++++ b/PKGBUILD 2018-06-20 20:05:11.994984639 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -220,3 +220,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +346,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage3/patches/generic/glibc.patch b/src/stage3/patches/generic/glibc.patch
index ca64f4c..4531ac5 100644
--- a/src/stage3/patches/generic/glibc.patch
+++ b/src/stage3/patches/generic/glibc.patch
@@ -1,7 +1,7 @@
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-06-10 02:55:37.495747371 +0200
-+++ b/PKGBUILD 2018-06-10 08:10:22.642602471 +0200
-@@ -6,13 +6,15 @@
+--- a/PKGBUILD 2018-06-18 09:36:19.679550645 +0200
++++ b/PKGBUILD 2018-06-19 15:05:54.550610043 +0200
+@@ -6,13 +6,14 @@
# NOTE: valgrind requires rebuilt with each major glibc version
pkgbase=glibc
@@ -14,12 +14,11 @@ diff -rupN a/PKGBUILD b/PKGBUILD
url='http://www.gnu.org/software/libc'
license=(GPL LGPL)
-makedepends=(git gd lib32-gcc-libs)
-+makedepends=(git gd)
+[ "x@MULTILIB@" != "xenable" ] || makedepends+=(lib32-gcc-libs)
options=(!strip staticlibs)
_commit=23158b08a0908f381459f273a984c6fd328363cb
#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit
-@@ -53,10 +55,10 @@ build() {
+@@ -53,10 +54,10 @@ build() {
--enable-add-ons
--enable-bind-now
--enable-lock-elision
@@ -32,7 +31,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--disable-profile
--disable-werror
)
-@@ -70,6 +70,8 @@ build() {
+@@ -70,6 +71,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
@@ -41,12 +40,34 @@ diff -rupN a/PKGBUILD b/PKGBUILD
"$srcdir/glibc/configure" \
--libdir=/usr/lib \
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +90,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="gcc @PLATFORM32_CFLAGS@"
++ export CXX="g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +107,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
+@@ -117,7 +122,6 @@ build() {
+ echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
+ make
+-
+ }
+
+ check() {
diff --git a/src/stage3/patches/powerpc64le/binutils.patch b/src/stage3/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..b85c25c
--- /dev/null
+++ b/src/stage3/patches/powerpc64le/binutils.patch
@@ -0,0 +1,13 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:36:34.209550790 +0200
++++ b/PKGBUILD 2018-06-20 08:01:20.661217960 +0200
+@@ -61,7 +61,8 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
diff --git a/src/stage3/stage3.sh b/src/stage3/stage3.sh
index 4722edb..342862b 100755
--- a/src/stage3/stage3.sh
+++ b/src/stage3/stage3.sh
@@ -35,6 +35,8 @@ stage3_makepkg() {
# substitute common variables
sed "s#@MULTILIB@#${MULTILIB:-disable}#g; \
s#@PLATFORM_CFLAGS@#${PLATFORM_CFLAGS[*]}#g; \
+ s#@CHOST32@#${CHOST32}#g; \
+ s#@PLATFORM32_CFLAGS@#${PLATFORM32_CFLAGS[*]}#g; \
s#@GCC_CONFIG_FLAGS@#${GCC_CONFIG_FLAGS[*]}#g" \
PKGBUILD.in > PKGBUILD
diff --git a/src/stage4/patches/generic/binutils.patch b/src/stage4/patches/generic/binutils.patch
deleted file mode 100644
index 893089d..0000000
--- a/src/stage4/patches/generic/binutils.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-05-28 16:39:38.041700185 +0200
-+++ b/PKGBUILD 2018-05-28 16:44:11.358369579 +0200
-@@ -20,13 +20,15 @@ options=(staticlibs !distcc !ccache)
- source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
- 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
-- 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch)
-+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
-+ https://raw.githubusercontent.com/archlinux32/packages/master/core/binutils/binutils-2.30-branch.patch)
- validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
- md5sums=('ffc476dd46c96f932875d1b2e27e929f'
- 'SKIP'
- '469164f3c93a0e92a697537b60c9806c'
- '0c679b37e90fb23de60a4d28329b956a'
-- '53b5682e09c0a27e9994c3efdfe01d29')
-+ '53b5682e09c0a27e9994c3efdfe01d29'
-+ 'a5ba9fc9de327b2eff071e19429c6e67')
-
- prepare() {
- mkdir -p binutils-build
-@@ -43,8 +45,7 @@ prepare() {
- # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
- patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
-
-- # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
-- patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
-+ patch -p1 -i "$srcdir/binutils-2.30-branch.patch"
- }
-
- build() {
diff --git a/src/stage4/patches/generic/gcc.patch b/src/stage4/patches/generic/gcc.patch
index 4bb7c5e..8a19896 100644
--- a/src/stage4/patches/generic/gcc.patch
+++ b/src/stage4/patches/generic/gcc.patch
@@ -14,8 +14,8 @@ diff -rupN a/0001-pthread-reentrant.patch b/0001-pthread-reentrant.patch
+ -melf" XLEN_SPEC "lriscv \
+ %{shared} \
diff -rupN a/PKGBUILD b/PKGBUILD
---- a/PKGBUILD 2018-06-07 04:45:58.776560502 +0200
-+++ b/PKGBUILD 2018-06-07 11:52:53.533482750 +0200
+--- a/PKGBUILD 2018-06-18 09:38:54.252885520 +0200
++++ b/PKGBUILD 2018-06-20 20:07:49.301652884 +0200
@@ -5,8 +5,9 @@
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
# NOTE: libtool requires rebuilt with each new gcc version
@@ -213,3 +213,25 @@ diff -rupN a/PKGBUILD b/PKGBUILD
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
+@@ -365,20 +350,12 @@ package_lib32-gcc-libs() {
+
+ for lib in libatomic \
+ libgfortran \
+- libgo \
+ libgomp \
+- libitm \
+ libquadmath \
+- libsanitizer/{a,l,ub}san \
+- libstdc++-v3/src \
+- libvtv; do
++ libstdc++-v3/src; do
+ make -C $CHOST/32/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
+ done
+
+- make -C $CHOST/32/libobjc DESTDIR="$pkgdir" install-libs
+- make -C $CHOST/32/libmpx DESTDIR="$pkgdir" install
+- rm -f "$pkgdir/usr/lib32/libmpx.spec"
+-
+ # remove files provided by gcc-libs
+ rm -rf "$pkgdir"/usr/lib
+
diff --git a/src/stage4/patches/generic/glibc.patch b/src/stage4/patches/generic/glibc.patch
index ca64f4c..68cb28e 100644
--- a/src/stage4/patches/generic/glibc.patch
+++ b/src/stage4/patches/generic/glibc.patch
@@ -32,7 +32,7 @@ diff -rupN a/PKGBUILD b/PKGBUILD
--disable-profile
--disable-werror
)
-@@ -70,6 +70,8 @@ build() {
+@@ -70,6 +72,8 @@ build() {
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
@@ -41,12 +41,34 @@ diff -rupN a/PKGBUILD b/PKGBUILD
"$srcdir/glibc/configure" \
--libdir=/usr/lib \
-@@ -87,6 +89,8 @@ build() {
+@@ -87,9 +91,11 @@ build() {
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
+ [ "x@MULTILIB@" == "xenable" ] || return 0
+
cd "$srcdir/lib32-glibc-build"
- export CC="gcc -m32 -mstackrealign"
- export CXX="g++ -m32 -mstackrealign"
+- export CC="gcc -m32 -mstackrealign"
+- export CXX="g++ -m32 -mstackrealign"
++ export CC="gcc @PLATFORM32_CFLAGS@"
++ export CXX="g++ @PLATFORM32_CFLAGS@"
+
+ echo "slibdir=/usr/lib32" >> configparms
+ echo "rtlddir=/usr/lib32" >> configparms
+@@ -102,7 +108,7 @@ build() {
+ CXXFLAGS=${CXXFLAGS/-fno-plt/}
+
+ "$srcdir/glibc/configure" \
+- --host=i686-pc-linux-gnu \
++ --host=@CHOST32@ \
+ --libdir=/usr/lib32 \
+ --libexecdir=/usr/lib32 \
+ ${_configure_flags[@]}
+@@ -117,7 +123,6 @@ build() {
+ echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
+ make
+-
+ }
+
+ check() {
diff --git a/src/stage4/patches/generic/grub.patch b/src/stage4/patches/generic/grub.patch
new file mode 100644
index 0000000..7787421
--- /dev/null
+++ b/src/stage4/patches/generic/grub.patch
@@ -0,0 +1,58 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:38:57.866218889 +0200
++++ b/PKGBUILD 2018-06-21 11:19:08.038865128 +0200
+@@ -7,7 +7,7 @@
+ # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
+
+ ## '1' to enable Xen support, '0' to disable
+-_XEN='1'
++_XEN='0'
+
+ ## '1' to enable IA32-EFI build in Arch x86_64, '0' to disable
+ _IA32_EFI_IN_ARCH_X64='1'
+@@ -351,7 +351,7 @@ _build_grub-ieee1275() {
+ msg 'Run ./configure for IEEE1275 (OpenFirmware) build'
+ ./configure \
+ --with-platform='ieee1275' \
+- --target='i386' \
++ --target="$CARCH" \
+ --disable-efiemu \
+ --enable-mm-debug \
+ --enable-nls \
+@@ -560,6 +560,11 @@ _build_grub-uboot() {
+ build() {
+ cd "${srcdir}/grub-${pkgver}/"
+
++ if [[ "${CARCH}" = 'powerpc64le' ]]; then
++ msg "Build grub ieee1275 stuff"
++ _build_grub-ieee1275
++ fi
++
+ if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
+ msg "Build grub ${_EFI_ARCH} EFI stuff"
+ _build_grub-efi
+@@ -661,9 +666,9 @@ _package_grub-ieee1275() {
+ make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
+
+ msg 'Remove gdb debugging related files for IEEE1275 (OpenFirmware) build'
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.module || true
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.image || true
+- rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/*.module || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/*.image || true
++ rm -f "${pkgdir}/usr/lib/grub/${CARCH}-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
+ }
+
+ _package_grub-libreboot() {
+@@ -728,6 +733,11 @@ package_grub() {
+
+ cd "${srcdir}/grub-${pkgver}/"
+
++ if [[ "${CARCH}" = 'powerpc64le' ]]; then
++ msg "Package grub ieee1275 stuff"
++ _package_grub-ieee1275
++ fi
++
+ if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
+ msg "Package grub ${_EFI_ARCH} EFI stuff"
+ _package_grub-efi
diff --git a/src/stage4/patches/powerpc64le/binutils.patch b/src/stage4/patches/powerpc64le/binutils.patch
new file mode 100644
index 0000000..b85c25c
--- /dev/null
+++ b/src/stage4/patches/powerpc64le/binutils.patch
@@ -0,0 +1,13 @@
+diff -rupN a/PKGBUILD b/PKGBUILD
+--- a/PKGBUILD 2018-06-18 09:36:34.209550790 +0200
++++ b/PKGBUILD 2018-06-20 08:01:20.661217960 +0200
+@@ -61,7 +61,8 @@ build() {
+ --enable-plugins \
+ --enable-relro \
+ --enable-shared \
+- --enable-targets=x86_64-pep \
++ --enable-targets=spu \
++ --enable-targets=powerpc-linux \
+ --enable-threads \
+ --disable-gdb \
+ --disable-werror \
diff --git a/src/stage4/stage4.sh b/src/stage4/stage4.sh
index 9b9b81a..e5154c6 100644
--- a/src/stage4/stage4.sh
+++ b/src/stage4/stage4.sh
@@ -35,6 +35,8 @@ stage4_makepkg() {
# substitute common variables
sed "s#@MULTILIB@#${MULTILIB:-disable}#g; \
s#@PLATFORM_CFLAGS@#${PLATFORM_CFLAGS[*]}#g; \
+ s#@CHOST32@#${CHOST32}#g; \
+ s#@PLATFORM32_CFLAGS@#${PLATFORM32_CFLAGS[*]}#g; \
s#@GCC_CONFIG_FLAGS@#${GCC_CONFIG_FLAGS[*]}#g" \
PKGBUILD.in > PKGBUILD