PKGBUILD 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # $Id$
  2. # Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697
  3. # Maintainer (Arch): Allan McRae <allan@archlinux.org>
  4. # toolchain build order: linux-libre-api-headers->glibc->binutils->gcc->binutils->glibc
  5. # NOTE: valgrind requires rebuilt with each major glibc version
  6. pkgname=lib32-glibc
  7. pkgver=2.24
  8. pkgrel=2.91.parabola2
  9. pkgdesc="GNU C Library"
  10. arch=('i686' 'x86_64')
  11. url="https://www.gnu.org/software/libc"
  12. license=('GPL' 'LGPL')
  13. groups=()
  14. depends=()
  15. makedepends=('gcc-multilib>=6' 'git')
  16. backup=()
  17. options=('!strip' 'staticlibs' '!emptydirs')
  18. #install=glibc.install
  19. source=("https://ftp.gnu.org/gnu/glibc/glibc-2.24.tar.xz"{,.sig}
  20. lib32-glibc.conf)
  21. validpgpkeys=('7273542B39962DF7B299931416792B4EA25340F8') # Carlos O'Donell <carlos@systemhalted.org>"
  22. sha512sums=('a4cb28a2c51a0cc029ed69da7cba11931a615ba897235590b4f7fad2eaabec9042f8250eaac2a5860997437a69ab13304f10a634000e52c0336b5593b7969adb'
  23. 'SKIP'
  24. '4c5fba26723f5077bac783ca713b355b8c6570d93b351809853ac72bd002b6f92a968f599afd7ff46a63fee7974217c7b295fd48cacc1c96d318ac360b3e6a1d')
  25. prepare() {
  26. mkdir glibc-build
  27. }
  28. build() {
  29. cd glibc-build
  30. #if [[ ${CARCH} = "i686" ]]; then
  31. # Hack to fix NPTL issues with Xen, only required on 32bit platforms
  32. # TODO: make separate glibc-xen package for i686
  33. export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
  34. #fi
  35. echo "slibdir=/usr/lib32" >> configparms
  36. echo "rtlddir=/usr/lib32" >> configparms
  37. echo "sbindir=/usr/bin" >> configparms
  38. echo "rootsbindir=/usr/bin" >> configparms
  39. export CC="gcc -m32"
  40. export CXX="g++ -m32"
  41. # remove hardening options for building libraries
  42. CFLAGS=${CFLAGS/-fstack-protector-strong/}
  43. CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
  44. ../${pkgname}-$pkgver/configure \
  45. --libdir=/usr/lib32 --libexecdir=/usr/lib32 \
  46. --with-headers=/usr/include \
  47. --with-bugurl=https://bugs.archlinux.org/ \
  48. --enable-add-ons \
  49. --enable-obsolete-rpc \
  50. --enable-kernel=2.6.32 \
  51. --enable-bind-now --disable-profile \
  52. --enable-stackguard-randomization \
  53. --enable-lock-elision \
  54. --enable-multi-arch \
  55. --disable-werror \
  56. i686-pc-linux-gnu
  57. # build libraries with hardening disabled
  58. echo "build-programs=no" >> configparms
  59. make
  60. # re-enable hardening for programs
  61. sed -i "/build-programs=/s#no#yes#" configparms
  62. echo "CC += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
  63. echo "CXX += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
  64. make
  65. }
  66. check() {
  67. cd glibc-build
  68. # remove harding in preparation to run test-suite
  69. sed -i '/FORTIFY/d' configparms
  70. # some failures are "expected"
  71. make check || true
  72. }
  73. package() {
  74. cd glibc-build
  75. make install_root=${pkgdir} install
  76. rm -rf ${pkgdir}/{etc,sbin,usr/{bin,sbin,share},var}
  77. # We need to keep 32 bit specific header files
  78. find ${pkgdir}/usr/include -type f -not -name '*-32.h' -delete
  79. # Dynamic linker
  80. mkdir ${pkgdir}/usr/lib
  81. ln -s ../lib32/ld-linux.so.2 ${pkgdir}/usr/lib/
  82. # Add lib32 paths to the default library search path
  83. install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf"
  84. # Symlink /usr/lib32/locale to /usr/lib/locale
  85. ln -s ../lib/locale "$pkgdir/usr/lib32/locale"
  86. # remove the static libraries that have a shared counterpart
  87. # libc, libdl, libm and libpthread are required for toolchain testsuites
  88. # in addition libcrypt appears widely required
  89. rm $pkgdir/usr/lib32/lib{anl,BrokenLocale,nsl,resolv,rt,util}.a
  90. # Do not strip the following files for improved debugging support
  91. # ("improved" as in not breaking gdb and valgrind...):
  92. # ld-${pkgver}.so
  93. # libc-${pkgver}.so
  94. # libpthread-${pkgver}.so
  95. # libthread_db-1.0.so
  96. cd $pkgdir
  97. strip $STRIP_BINARIES \
  98. \
  99. \
  100. usr/lib32/getconf/*
  101. strip $STRIP_STATIC usr/lib32/*.a
  102. strip $STRIP_SHARED usr/lib32/lib{anl,BrokenLocale,cidn,crypt}-*.so \
  103. usr/lib32/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
  104. usr/lib32/lib{dl,m,nsl,resolv,rt,util}-*.so \
  105. usr/lib32/lib{memusage,pcprofile,SegFault}.so \
  106. usr/lib32/{audit,gconv}/*.so || true
  107. }