PKGBUILD 4.36 KB
Newer Older
Manuel's avatar
Manuel committed
1
# toolchain build order: 
Luca Giambonini's avatar
Luca Giambonini committed
2
# toolchain build order: lib32-glibc>binutils->lib32-gcc->binutils->lib32-glibc
3

Manuel's avatar
Manuel committed
4 5
_pkgbasename=glibc
pkgname=lib32-$_pkgbasename
Luca Giambonini's avatar
Luca Giambonini committed
6
pkgver=2.26
Xuetian Weng's avatar
Xuetian Weng committed
7
pkgrel=1
Luca Giambonini's avatar
Luca Giambonini committed
8
_commit=633e2f7f3d88df6427aa3a7a984d3a6b796d9611  # release/2.26/master
9
pkgdesc="GNU C Library (32-bit)"
10 11 12
arch=('x86_64')
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
Xuetian Weng's avatar
Xuetian Weng committed
13
depends=($_pkgbasename>=$pkgver)
Chaoting Liu's avatar
Chaoting Liu committed
14
makedepends=('gcc>=5.2' 'git' 'lib32-gcc-libs')
AlmAck's avatar
AlmAck committed
15
options=('!strip' 'staticlibs' '!emptydirs')
Xuetian Weng's avatar
Xuetian Weng committed
16 17

source=(git+https://sourceware.org/git/glibc.git#commit=${_commit}
Luca Giambonini's avatar
Luca Giambonini committed
18 19 20 21 22 23 24 25
        lib32-glibc.conf
        0001-manual-Update-to-mention-ENODEV-for-ttyname-and-ttyn.patch
        0002-linux-ttyname-Update-a-reference-to-kernel-docs-for-.patch
        0003-linux-ttyname-Change-return-type-of-is_pty-from-int-.patch
        0004-linux-ttyname-_r-Make-tty-checks-consistent.patch
        0005-linux-ttyname-_r-Don-t-bail-prematurely-BZ-22145.patch
        0006-linux-ttyname-_r-Add-tests.patch
        bz20338.patch)
Xuetian Weng's avatar
Xuetian Weng committed
26

Chaoting Liu's avatar
Chaoting Liu committed
27
md5sums=('SKIP'
Luca Giambonini's avatar
Luca Giambonini committed
28 29 30 31 32 33 34 35
         '6e052f1cb693d5d3203f50f9d4e8c33b'
         '2bb2dfa660fbb4b349f844459f79d5a1'
         '299316b1a35426eadf3301a3fad170be'
         '41d212e3f8d838bff341102679b2af09'
         '8a886e84f950caf2ad1c37cc3a456339'
         'fc5af427803b139d9753230849053458'
         'eb4e1836f4f3721f1215450a2cca3523'
         'dc0d3ad59aeaaf591b085a77de6e03e9')
36

Fabian's avatar
Fabian committed
37
prepare() {
Luca Giambonini's avatar
Luca Giambonini committed
38 39
  mkdir -p glibc-build

Xuetian Weng's avatar
Xuetian Weng committed
40
  cd glibc
Luca Giambonini's avatar
Luca Giambonini committed
41 42 43 44 45 46 47 48 49

  local i; for i in ${source[@]}; do
    case ${i%::*} in
      *.patch)
        msg2 "Applying ${i}"
        patch -p1 -i "$srcdir/${i}"
        ;;
    esac
  done
Fabian's avatar
Fabian committed
50 51 52 53
}

build() {
  cd ${srcdir}/glibc-build
Manuel's avatar
New tc  
Manuel committed
54

55
  echo "slibdir=/usr/lib32" >> configparms
Xuetian Weng's avatar
Xuetian Weng committed
56
  echo "rtlddir=/usr/lib32" >> configparms
57 58
  echo "sbindir=/usr/sbin" >> configparms
  echo "rootsbindir=/usr/sbin" >> configparms
59

AlmAck's avatar
AlmAck committed
60
  #export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
Luca Giambonini's avatar
Luca Giambonini committed
61 62
  export CC="gcc -m32 -mstackrealign"
  export CXX="g++ -m32 -mstackrealign"
Fabian's avatar
Fabian committed
63

Xuetian Weng's avatar
Xuetian Weng committed
64
  # remove fortify for building libraries
Manuel's avatar
Manuel committed
65 66
  CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}

Xuetian Weng's avatar
Xuetian Weng committed
67 68 69 70
  ../glibc/configure \
      --prefix=/usr \
      --libdir=/usr/lib32 \
      --libexecdir=/usr/lib32 \
71
      --with-headers=/usr/include \
Luca Giambonini's avatar
Luca Giambonini committed
72
      --with-bugurl=https://code.chakralinux.org/ \
Xuetian Weng's avatar
Xuetian Weng committed
73
      --enable-add-ons \
Xuetian Weng's avatar
Xuetian Weng committed
74
      --enable-bind-now \
AlmAck's avatar
AlmAck committed
75
      --enable-lock-elision \
76
      --enable-multi-arch \
Luca Giambonini's avatar
Luca Giambonini committed
77 78 79 80 81
      --enable-obsolete-nsl \
      --enable-obsolete-rpc \
      --enable-stack-protector=strong \
      --enable-stackguard-randomization \
      --disable-profile \
82
      --disable-werror \
Xuetian Weng's avatar
Xuetian Weng committed
83
      i686-pc-linux-gnu
Manuel's avatar
New tc  
Manuel committed
84

Xuetian Weng's avatar
Xuetian Weng committed
85
  # build libraries with fortify disabled
Manuel's avatar
Manuel committed
86 87
  echo "build-programs=no" >> configparms
  make
Fabian's avatar
Fabian committed
88

Xuetian Weng's avatar
Xuetian Weng committed
89
  # re-enable fortify for programs
Manuel's avatar
Manuel committed
90
  sed -i "/build-programs=/s#no#yes#" configparms
Xuetian Weng's avatar
Xuetian Weng committed
91 92 93

  echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
  echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
Manuel's avatar
New tc  
Manuel committed
94 95 96 97
  make
}

check() {
Xuetian Weng's avatar
Xuetian Weng committed
98
  cd glibc-build
Xuetian Weng's avatar
Xuetian Weng committed
99

Xuetian Weng's avatar
Xuetian Weng committed
100
  # remove fortify in preparation to run test-suite
Chaoting Liu's avatar
Chaoting Liu committed
101 102
  sed -i '/FORTIFY/d' configparms

Xuetian Weng's avatar
Xuetian Weng committed
103
  # some failures are "expected"
Xuetian Weng's avatar
Xuetian Weng committed
104
  make check || true
105 106 107
}

package() {
Xuetian Weng's avatar
Xuetian Weng committed
108 109
  cd glibc-build

110 111
  make install_root=${pkgdir} install

Manuel's avatar
Manuel committed
112
  rm -rf ${pkgdir}/{etc,sbin,usr/{bin,sbin,share},var}
Fabian's avatar
Fabian committed
113

Xuetian Weng's avatar
Xuetian Weng committed
114 115
  # We need to keep 32 bit specific header files
  find ${pkgdir}/usr/include -type f -not -name '*-32.h' -delete
116 117

  # Dynamic linker
Xuetian Weng's avatar
Xuetian Weng committed
118
  mkdir ${pkgdir}/usr/lib
Xuetian Weng's avatar
Xuetian Weng committed
119
  ln -s ../lib32/ld-linux.so.2 ${pkgdir}/usr/lib/
120

Fabian's avatar
Fabian committed
121
  # Add lib32 paths to the default library search path
122 123 124 125
  install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf"

  # Symlink /usr/lib32/locale to /usr/lib/locale
  ln -s ../lib/locale "$pkgdir/usr/lib32/locale"
Xuetian Weng's avatar
Xuetian Weng committed
126

Fabian's avatar
Fabian committed
127 128 129 130 131 132 133 134
  # Do not strip the following files for improved debugging support
  # ("improved" as in not breaking gdb and valgrind...):
  #   ld-${pkgver}.so
  #   libc-${pkgver}.so
  #   libpthread-${pkgver}.so
  #   libthread_db-1.0.so

  cd $pkgdir
Luca Giambonini's avatar
Luca Giambonini committed
135
  strip $STRIP_BINARIES usr/lib32/getconf/*
Xuetian Weng's avatar
Xuetian Weng committed
136
  strip $STRIP_STATIC usr/lib32/lib{anl,BrokenLocale,c{,_nonshared},crypt}.a \
Luca Giambonini's avatar
Luca Giambonini committed
137 138
                        usr/lib32/lib{dl,g,ieee,mcheck,nsl,pthread{,_nonshared}}.a \
                        usr/lib32/lib{resolv,rpcsvc,rt,util,m}.a
Xuetian Weng's avatar
Xuetian Weng committed
139
  strip $STRIP_SHARED usr/lib32/lib{anl,BrokenLocale,cidn,crypt}-${pkgver}.so \
Luca Giambonini's avatar
Luca Giambonini committed
140 141 142 143
                        usr/lib32/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
                        usr/lib32/lib{dl,m,nsl,resolv,rt,util}-${pkgver}.so \
                        usr/lib32/lib{memusage,pcprofile,SegFault}.so \
                        usr/lib32/{audit,gconv}/*.so || true
144
}