libs/glibc: initial commit
[grimoire-witchcraft.git] / libs / glibc / BUILD
blobc90d5817059a3521cacee84185a11016b9e50438
1 make_single  &&
3 if [ "$GLIBC_NOLIB64" = "y" ]; then
4   # install x86_64 linker to lib instead of lib64
5   sedit "s/lib64/lib/"  sysdeps/unix/sysv/linux/x86_64/ldconfig.h &&
6   sedit "s/264/2/" sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
7 fi                                                              &&
9 # install x86_64 libraries to lib instead of lib64
10 sedit "s/| x86_64//"       sysdeps/unix/sysv/linux/configure    &&
11 sedit "s/| x86_64//"       sysdeps/unix/sysv/linux/configure.in &&
14 # bug#5570 ccache sometimes has trouble correctly recognising minor differences 
15 # in configurations and doesn't force recompile when it should. This stops it from
16 # using the old cache entries.
18 export  CCACHE_RECACHE=true  &&
20 # End ccache fix
23 if  [[  "$GLIBC_NPTL"  =  "y"  ]];  then
24   OPTS="$OPTS  --enable-add-ons=nptl          \
25                --with-tls                     \
26                --enable-kernel=2.6"
27 elif [[  "$GLIBC_NPTL"  =  "n"  ]];  then
28   OPTS="$OPTS  --enable-add-ons=linuxthreads  \
29                --without-__thread             \
30                --enable-kernel=2.4"
31 elif is_gnu_kfbsd ; then
32   OPTS="$OPTS  --enable-add-ons=linuxthreads  \
33                --with-__thread                \
34                --with-tls                     \
35                $(uname  -m)-kfreebsd"
36 fi  &&
39 # Fixes Bug #8595
41 CFLAGS="-Os $CFLAGS"  &&
43 export  CFLAGS="${CFLAGS/-ffast-math/}"  &&
44 export  CC=gcc                           &&
47 # LD_LIBRARY_PATH includes $PWD bug 
49 unset  LD_LIBRARY_PATH  &&
52 # Setup sanitised glibc-kernel-headers for the glibc compile
54 persistent_add  GLIBC_ARCH  &&
55 if    [[  $(uname  -m)  =  *86_64    ]];  then
56   GLIBC_ARCH=x86_64
57 elif  [[  $(uname  -m)  =  ppc       ]];  then
58   GLIBC_ARCH=ppc
59 elif  [[  $(uname  -m)  =  *86       ]];  then
60   GLIBC_ARCH=i386
61 elif  [[  $(uname  -m)  =  *sparc64  ]];  then
62   #
63   # If we're not compiling for 64-bit SPARC then we need to use the sparc
64   # headers, not sparc64
65   #
66   if  echo  "$CFLAGS"  |  grep  -q  --  "-m64";  then
67     GLIBC_ARCH=sparc64  &&
68     export  CC=gcc64
69   else
70     GLIBC_ARCH=sparc
71   fi  &&
73   #
74   # Fixes from Gentoo's 2.3.3.20040420-r2 ebuild
75   #
76   sedit  "s:CPPFLAGS += -DHAVE_INITFINI:CPPFLAGS += -DHAVE_INITFINI -fno-pie -fno-PIE:"  csu/Makefile
77   export    CFLAGS="${CFLAGS/-fcall-used-g7/}"
78   export    CFLAGS="$CFLAGS  -fcall-used-g6"
79   export    CFLAGS="${CFLAGS/-mcpu=v9/}"
80   export    CFLAGS="${CFLAGS/-mtune=ultrasparc/}"
81   export    CFLAGS="${CFLAGS/-mvis/}"
83   # Setup the HOST properly to insure "sparcv9"
84   # This passes -mcpu=ultrasparc -Wa,-Av9a to the compiler
85   [  "$HOST"  =  "sparc-unknown-linux-gnu"  ]   &&  
86   export HOST="sparcv9-unknown-linux-gnu"       &&
87   [  "$BUILD"  =  "sparc-unknown-linux-gnu"  ]  &&  
88   export BUILD="sparcv9-unknown-linux-gnu"
89 elif  [[  $(uname  -m)  =  *sparc    ]];  then
90   GLIBC_ARCH=sparc  &&
91   #
92   # Fixes from Gentoo's 2.3.3.20040420-r2 ebuild
93   #
94   sedit  "s:CPPFLAGS += -DHAVE_INITFINI:CPPFLAGS += -DHAVE_INITFINI -fno-pie -fno-PIE:"  csu/Makefile
95   export    CFLAGS="${CFLAGS/-fcall-used-g7/}"
96   export    CFLAGS="$CFLAGS  -fcall-used-g6"
97 fi  &&
99 # set the asm headers to point to the correct architecture
101 if is_gnu_kfbsd ; then
102   true
103 else
104   cd  $GLIBC_HEADERS_DIR/include  &&
105   ln  -sf  asm-$GLIBC_ARCH  asm
106 fi  &&
108 # CPPFLAGS setting is needed so the check for cpp works on boxes that don't
109 # have any kernel headers in /usr/include yet
110 export CPPFLAGS="$CPPFLAGS -I$GLIBC_HEADERS_DIR/include"  &&
112 # End sanitised glibc-kernel-headers setup
116 # Change to where we're going to actually build
118 cd  $SOURCE_DIRECTORY.bld  &&
121 # Configure glibc to use the sanitised headers
122 # http://bugs.sourcemage.org/show_bug.cgi?id=7560
124 if is_gnu_kfbsd ; then
125 $SOURCE_DIRECTORY/configure  --host=$HOST                       \
126                             --build=$BUILD                      \
127                            --prefix=/usr                        \
128                           --infodir=/usr/share/info             \
129                            --mandir=/usr/share/man              \
130                        --sysconfdir=/etc                        \
131                              --with-elf                         \
132                            --enable-shared                      \
133                           --disable-profile                     \
134                                     $OPTS                       
135 else
136 $SOURCE_DIRECTORY/configure  --host=$HOST                       \
137                             --build=$BUILD                      \
138                            --prefix=/usr                        \
139                           --infodir=/usr/share/info             \
140                            --mandir=/usr/share/man              \
141                        --sysconfdir=/etc                        \
142                              --with-elf                         \
143                            --enable-shared                      \
144                           --disable-profile                     \
145                      --with-headers=$GLIBC_HEADERS_DIR/include  \
146                                     $OPTS                       
147 fi                                                              &&
148 make