summaryrefslogtreecommitdiff
path: root/src/stage4/patches/generic/glibc.patch
blob: 68cb28e8148f53483f1614a911576db2c6fc2e61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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 @@
 # NOTE: valgrind requires rebuilt with each major glibc version
 
 pkgbase=glibc
-pkgname=(glibc lib32-glibc)
+pkgname=(glibc)
+[ "x@MULTILIB@" != "xenable" ] || pkgname+=(lib32-glibc)
 pkgver=2.27
 pkgrel=3
 arch=(x86_64)
 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() {
       --enable-add-ons
       --enable-bind-now
       --enable-lock-elision
-      --enable-multi-arch
+      --@MULTILIB@-multi-arch
       --enable-stack-protector=strong
       --enable-stackguard-randomization
-      --enable-static-pie
+      --disable-static-pie
       --disable-profile
       --disable-werror
   )
@@ -70,6 +72,8 @@ build() {
 
   # remove fortify for building libraries
   CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
+  CFLAGS="$CFLAGS -no-pie -fno-PIE"
+  CXXFLAGS="$CXXFLAGS -no-pie -fno-PIE"
 
   "$srcdir/glibc/configure" \
       --libdir=/usr/lib \
@@ -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 @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() {