summaryrefslogtreecommitdiffstats
path: root/base/glibc/Pkgfile
blob: 81463549f1b952c0b5bb90bf19d7d570c5cbaf13 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Description: La librairie C utilisée dans le système GNU
# URL: http://www.gnu.org/software/libc/
# Maintainer: NuTyX core team
# Packager:thierryn1 at hispeed dot ch

name=glibc
version=2.12.1
release=1
kernelversion=2.6.36

source=( http://ftp.gnu.org/gnu/glibc/$name-$version.tar.bz2 \
	http://www.kernel.org/pub/linux/kernel/v2.6/linux-${kernelversion}.tar.bz2 \
        http://nutyx.meticul.eu/files/patchs/$name/{nsswitch.conf,ld.so.conf,SUPPORTED} \
	glibc-2.10-dont-build-timezone.patch
        glibc-2.10-bz4781.patch
        glibc-__i686.patch
        glibc-2.12.1-make-3.82-compatibility.patch
        glibc-2.12.1-static-shared-getpagesize.patch
        glibc-2.12.1-but-I-am-an-i686.patch
        glibc-2.12.1-fix-IPTOS_CLASS-definition.patch
        glibc-2.12.1-never-expand-origin-when-privileged.patch
        glibc-2.12.1-require-suid-on-audit.patch) 


build() {
        # install build kernel headers
        mkdir $PKG/usr/
        cd linux-$kernelversion
        sed -i '/scsi/d' include/Kbuild        
        make mrproper
        make headers_check
        make INSTALL_HDR_PATH=$PKG/usr headers_install
        cd ..
        # install glibc
        cd $name-$version

	# timezone data is in separate package (tzdata)
#  	patch -Np1 -i $SRC/glibc-2.10-dont-build-timezone.patch

  	# http://sources.redhat.com/bugzilla/show_bug.cgi?id=4781
  	patch -Np1 -i $SRC/glibc-2.10-bz4781.patch

  	# http://sources.redhat.com/bugzilla/show_bug.cgi?id=411
  	# http://sourceware.org/ml/libc-alpha/2009-07/msg00072.html
  	patch -Np1 -i $SRC/glibc-__i686.patch

  	# http://sourceware.org/git/?p=glibc.git;a=patch;h=32cf4069
  	patch -Np1 -i $SRC/glibc-2.12.1-make-3.82-compatibility.patch

  	# http://sourceware.org/bugzilla/show_bug.cgi?id=11929
  	# using Fedora "fix" as patch in that bug report causes breakages...
  	patch -Np1 -i $SRC/glibc-2.12.1-static-shared-getpagesize.patch
  
  	# fedora "fix" for excess linker optimization on i686
  	# proper fix will be in binutils-2.21
  	patch -Np1 -i $SRC/glibc-2.12.1-but-I-am-an-i686.patch

  	# http://www.exploit-db.com/exploits/15274/
  	# http://sourceware.org/git/?p=glibc.git;a=patch;h=2232b90f (only fedora branch...)
  	patch -Np1 -i $SRC/glibc-2.12.1-never-expand-origin-when-privileged.patch

  	# http://www.exploit-db.com/exploits/15304/
  	# http://sourceware.org/git/?p=glibc.git;a=patch;h=8e9f92e9
  	patch -Np1 -i $SRC/glibc-2.12.1-require-suid-on-audit.patch

  	# http://sources.redhat.com/git/?p=glibc.git;a=patch;h=15bac72b
  	patch -Np1 -i $SRC/glibc-2.12.1-fix-IPTOS_CLASS-definition.patch



        DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
	sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
        scripts/test-installation.pl
	unset DL

	sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in

	mv ../SUPPORTED localedata/

	mkdir -v ../glibc-build
        cd ../glibc-build

	case `uname -m` in
	  i?86) echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms ;;
	esac

        ../$name-$version/configure --prefix=/usr \
                --with-headers=$PKG/usr/include \
		--disable-profile \
                --enable-add-ons \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \
		--enable-kernel=2.6.18 \
                --libexecdir=/usr/lib/glibc
	make
	make install_root=$PKG install
        make install_root=$PKG localedata/install-locales
        cp ../{nsswitch.conf,ld.so.conf} $PKG/etc
	if [ -f $PKG/usr/share/info/dir ]; then
		rm $PKG/usr/share/info/dir
	fi
        for i in drm.h drm_sarea.h i915_drm.h \
	mga_drm.h r128_drm.h radeon_drm.h savage_drm.h \
        sis_drm.h via_drm.h drm_mode.h nouveau_drm.h
                do rm $PKG/usr/include/drm/$i
        done
}