source: scripts/scripts/funcs/glibc-funcs.sh @ 11fbfa9

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 11fbfa9 was 11fbfa9, checked in by Jim Gifford <clfs@…>, 18 years ago

r1045@server (orig r1043): ryan | 2006-01-12 00:56:45 -0800

r1079@rei: lfs | 2006-01-12 19:13:09 +1100
Update for glibc-2.3.6
Also add option to skip libgcc_s.so.1 creation (to match cross-lfs book)


  • Property mode set to 100755
File size: 6.4 KB
Line 
1#!/bin/bash
2
3# functions for cross-lfs glibc builds
4# -----------------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9
10apply_glibc_patches() {
11   
12   # This function should only be called from inside the unpacked glibc source
13   # This function also expects the following vars to be set by the caller
14   #
15   # target_gcc_ver   : should be derived either from gcc itself or gcc headers
16   # target_glibc_ver : should be derived from glibc headers
17   # kernver          : should be derived from kernel headers
18
19   # Patching
20   #---------
21   # TODO: check if patches still reqd for < glibc 2.3.3 with later gcc's
22   #       (ie 3.4+)
23   case ${target_gcc_ver} in
24      4.* )
25         echo " o compiling with gcc 4.x"
26         case ${target_glibc_ver} in
27            2.3.[7-9]* | 2.4.* ) ;;
28            2.3.6 )
29               apply_patch glibc-20051024-localedef_segfault-1
30
31               case ${TGT_ARCH} in
32               sparc* )
33                  # fix CFLAGS-rtld to remove deprecated sparc compiler options
34                  # from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
35                  # ( -mv8 is no longer supported ). Use -mcpu -mtune options
36                  # from TGT_CFLAGS (which get passed regardless)
37                  echo "   - removing deprecated gcc options from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
38                  file="sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
39                  if [ ! -f ${file}-ORIG ]; then cp -p ${file} ${file}-ORIG ; fi
40                  grep -v \\-mv8 ${file}-ORIG > ${file}
41               ;;
42               esac
43
44            ;;
45            2.3.5 )
46               # gcc4 support is working in CVS glibc
47
48               if [ ! -d ${SRC}/${PKGDIR}/CVS ]; then
49                  echo "   - applying gcc4 fixes"
50                  apply_patch glibc-2.3.4-gcc4_elf_fixes
51                  apply_patch glibc-2.3.4-allow-gcc-4.0-iconvdata
52                  apply_patch glibc-2.3.4-allow-gcc-4.0-powerpc-procfs
53                  apply_patch glibc-2.3.5-allow-gcc-4.0-wordexp
54                  apply_patch glibc-2.3.5-allow-gcc4-string
55                  apply_patch glibc-2.3.5-allow-gcc4-symbols
56                  apply_patch glibc-2.3.5-allow-gcc4-wcstol_l
57               fi
58
59               case ${TGT_ARCH} in
60               sparc* )
61                  # fix CFLAGS-rtld to remove deprecated sparc compiler options
62                  # from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
63                  # ( -mv8 is no longer supported ). Use -mcpu -mtune options
64                  # from TGT_CFLAGS (which get passed regardless)
65                  echo "   - removing deprecated gcc options from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
66                  file="sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
67                  if [ ! -f ${file}-ORIG ]; then cp -p ${file} ${file}-ORIG ; fi
68                  grep -v \\-mv8 ${file}-ORIG > ${file}
69               ;;
70               esac
71               
72            ;;
73            2.3.4* )
74               echo "   - applying gcc4 fixes"
75               apply_patch glibc-2.3.4-gcc4_elf_fixes
76               apply_patch glibc-2.3.4-allow-gcc-4.0-iconvdata
77               apply_patch glibc-2.3.4-allow-gcc-4.0-powerpc-procfs
78               apply_patch glibc-2.3.5-allow-gcc4-string
79               apply_patch glibc-2.3.5-allow-gcc4-symbols
80               apply_patch glibc-2.3.5-allow-gcc4-wcstol_l
81
82               case ${TGT_ARCH} in
83               sparc* )
84                  # fix CFLAGS-rtld to remove deprecated sparc compiler options
85                  # from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
86                  # ( -mv8 is no longer supported ). Use -mcpu -mtune options
87                  # from TGT_CFLAGS (which get passed regardless)
88                  echo "   - removing deprecated gcc options from sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
89                  file="sysdeps/unix/sysv/linux/sparc/sparc32/Makefile"
90                  if [ ! -f ${file}-ORIG ]; then cp -p ${file} ${file}-ORIG ; fi
91                  grep -v \\-mv8 ${file}-ORIG > ${file}
92               ;;
93               esac
94
95            ;;
96            * )
97               echo " compiling with gcc4 for ${target_glibc_ver} not supported" 1>&2
98               barf
99            ;;
100         esac
101      ;;
102      3.3* )
103         echo " o compiling with gcc 3.3x"
104         case ${target_glibc_ver} in
105            2.3.[345] ) ;;
106            2.3.2 )
107               # CVS glibc doesn't require gcc-33 patch
108               if [ ! -d ${SRC}/${PKGDIR}/CVS ]; then
109                  apply_patch glibc-2.3.2-gcc33
110               fi
111            ;;
112            2.3* )
113               apply_patch glibc-2.3.2-gcc33
114            ;;
115         esac
116      ;;
117   esac
118   
119   # 20031008 - add patch to fix assertion in rtld.c
120   #            this smells hackish but we will see...
121   # TODO: should check for presence of sysinfo DSO in kernel source
122   # 20040711 - not required for current ( 2.3.3 + 2.3.4 ) glibc's
123   #apply_patch glibc-${XXX}2.3.2-fix-rtld
124   
125   case ${kernver} in
126      2.[56].* )
127         # 2.3.1b2 20030630
128         # We have to patch sysdeps/unix/sysv/linux/sys/sysctl.h to
129         # so we can build against 2.5/2.6 kernels (if not fixed already).
130         fname="${SRC}/${PKGDIR}/sysdeps/unix/sysv/linux/sys/sysctl.h"
131         grep "linux/compiler.h" ${fname} > /dev/null 2>&1 ||
132         {
133            echo " - patching ${fname}"
134            mv ${fname} ${fname}-ORIG
135            sed -e '/#include <linux\/sysctl.h>/i\
136#include <linux/compiler.h>' \
137            ${fname}-ORIG > ${fname}
138         }
139
140         case ${TGT_ARCH} in
141            m68k* )
142               echo - applying m68k no-precision-timers patch
143               patch -p1 < ${PATCHES}/glibc-2.3.3-lfh-m68k-no-precision-timers.patch
144            ;;
145            arm* ) apply_patch glibc-arm-ctl_bus_isa ;;
146         esac
147
148      ;;
149      2.4.2[4-9] | 2.4.3* )
150         case ${TGT_ARCH} in
151            arm* ) apply_patch glibc-arm-ctl_bus_isa ;;
152         esac
153      ;;
154   esac
155
156   case ${TGT_ARCH} in
157      m68k* )
158         # TODO: wrap some logic around this to check glibc ver
159         #       before applying this patch
160         apply_patch glibc-2.3.3-lfs-5.1-m68k_fix_fcntl
161      ;;
162      mips* )
163         # Fix syscalls for mips w 2.3.4
164          case ${target_glibc_ver} in
165             2.3.[45] ) apply_patch glibc-2.3.4-mips_syscall-2 ;;
166          esac
167      ;;
168   esac
169}
170
171export -f apply_glibc_patches
Note: See TracBrowser for help on using the repository browser.