source: scripts/patch/gcc-specs-patch.sh@ 656e49e

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 656e49e was 170e0664, checked in by Joe Ciccone <jciccone@…>, 15 years ago

Updated GCC to 4.4.2.

  • Property mode set to 100755
File size: 7.6 KB
Line 
1#!/bin/bash
2# Create a GCC Specs Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
11 echo "$0 - GCC_Version"
12 echo "This will Create a Patch for GCC Specs GCC_Version"
13 exit 255
14fi
15
16# Download GCC Source
17#
18cd ~/tmp
19if ! [ -e gcc-${VERSION}.tar.bz2 ]; then
20 wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-${VERSION}/gcc-${VERSION}.tar.bz2
21fi
22
23# Cleanup Directory
24#
25cd ~/tmp
26rm -rf gcc-${VERSION} gcc-${VERSION}.orig
27tar xvf gcc-${VERSION}.tar.bz2
28pushd gcc-4.4.2
29patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
30popd
31cp -ar gcc-${VERSION} gcc-${VERSION}.orig
32
33# Modify the Data
34#
35cd ~/tmp/gcc-${VERSION}
36for file in $(find gcc/config -name "*.h"); do
37 if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
38 if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
39 echo "Modifying ${file}..."
40 sed -i '/DYNAMIC_LINKER/s@"/lib@"/tools/lib@' ${file}
41 fi
42 if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
43 echo "Modifying ${file}..."
44 sed -i '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
45 fi
46 if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
47 echo "Modifying ${file}..."
48 sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/tools/lib64@' \
49 -e '/elf32_sparc -Y P,/s@/usr/lib@/tools/lib@' \
50 -e '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
51 fi
52 fi
53done
54
55
56# Create Patch
57#
58cd ~/tmp
59install -d ~/patches
60echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-specs-x.patch
61echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-specs-x.patch
62echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-specs-x.patch
63echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-specs-x.patch
64echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-specs-x.patch
65echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-specs-x.patch
66echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-specs-x.patch
67echo "" >> ~/patches/gcc-${VERSION}-specs-x.patch
68diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-specs-x.patch
69
70# Cleanup Directory
71#
72cd ~/tmp
73rm -rf gcc-${VERSION} gcc-${VERSION}.orig
74tar xvf gcc-${VERSION}.tar.bz2
75pushd gcc-4.4.2
76patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
77popd
78cp -ar gcc-${VERSION} gcc-${VERSION}.orig
79
80# Modify the Data
81#
82cd ~/tmp/gcc-${VERSION}
83for file in $(find gcc/config -name "*.h"); do
84 if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
85 if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
86 echo "Modifying ${file}..."
87 sed -i -e '/DYNAMIC_LINKER32/s@"/lib@"/tools/lib32@' \
88 -e '/DYNAMIC_LINKERN32/s@"/lib32@"/tools/lib64@' \
89 -e '/DYNAMIC_LINKER64/s@"/lib64@"/tools/lib@' \
90 -e '/DYNAMIC_LINKER/s@"/lib@"/tools/lib@' ${file}
91 fi
92 if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
93 echo "Modifying ${file}..."
94 sed -i '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
95 fi
96 if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
97 echo "Modifying ${file}..."
98 sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/tools/lib@' \
99 -e '/elf32_sparc -Y P,/s@/usr/lib@/tools/lib32@' \
100 -e '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
101 fi
102 fi
103done
104
105for file in $(find gcc/config -name "t-linux*"); do
106 if [ "$(cat ${file} | grep -c MULTILIB_OSDIRNAMES)" != "0" ]; then
107 echo "Modifying ${file}..."
108 if [ "$(echo ${file} | grep -c mips)" != "0" ]; then
109 sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' \
110 -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' ${file}
111 else
112 sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib64 ../lib@MULTILIB_OSDIRNAMES = ../lib ../lib32@' \
113 -e 's@MULTILIB_OSDIRNAMES.= ../lib64 .@MULTILIB_OSDIRNAMES\t= ../lib $@' ${file}
114 fi
115 fi
116done
117
118# Create Patch
119#
120cd ~/tmp
121install -d ~/patches
122echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64_specs-x.patch
123echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
124echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
125echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
126echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
127echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
128echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
129echo "" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
130diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
131
132# Cleanup Directory
133#
134cd ~/tmp
135rm -rf gcc-${VERSION} gcc-${VERSION}.orig
136tar xvf gcc-${VERSION}.tar.bz2
137pushd gcc-4.4.2
138patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
139popd
140cp -ar gcc-${VERSION} gcc-${VERSION}.orig
141CURRENTDIR=$(pwd -P)
142
143# Modify the Data
144#
145cd ~/tmp/gcc-${VERSION}
146for file in $(find gcc/config -name "*.h"); do
147 if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
148 if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
149 echo "Modifying ${file}..."
150 sed -i -e '/DYNAMIC_LINKER32/s@"/lib@"/lib32@' \
151 -e '/DYNAMIC_LINKERN32/s@"/lib32@"/lib64@' \
152 -e '/DYNAMIC_LINKER64/s@"/lib64@"/lib@' \
153 -e '/DYNAMIC_LINKER/s@"/lib@"/lib@' ${file}
154 fi
155 if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
156 echo "Modifying ${file}..."
157 sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/usr/lib@' \
158 -e '/elf32_sparc -Y P,/s@/usr/lib@/usr/lib32@' ${file}
159 fi
160 fi
161done
162
163for file in $(find gcc/config -name "t-linux*"); do
164 if [ "$(cat ${file} | grep -c MULTILIB_OSDIRNAMES)" != "0" ]; then
165 echo "Modifying ${file}..."
166 if [ "$(echo ${file} | grep -c mips)" != "0" ]; then
167 sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' \
168 -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' ${file}
169 else
170 sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib64 ../lib@MULTILIB_OSDIRNAMES = ../lib ../lib32@' \
171 -e 's@MULTILIB_OSDIRNAMES.= ../lib64 .@MULTILIB_OSDIRNAMES\t= ../lib $@' ${file}
172 fi
173 fi
174done
175
176# Create Patch
177#
178cd ~/tmp
179install -d ~/patches
180echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64-x.patch
181echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64-x.patch
182echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64-x.patch
183echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64-x.patch
184echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64-x.patch
185echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64-x.patch
186echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64-x.patch
187echo "" >> ~/patches/gcc-${VERSION}-pure64-x.patch
188diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64-x.patch
189
190echo "Created ~/patches/gcc-${VERSION}-specs-x.patch."
191echo "Created ~/patches/gcc-${VERSION}-pure64_specs-x.patch."
192echo "Created ~/patches/gcc-${VERSION}-pure64-x.patch."
193
194# Cleanup Directory
195#
196cd ~/tmp
197rm -rf gcc-${VERSION} gcc-${VERSION}.orig
Note: See TracBrowser for help on using the repository browser.