1 | #!/bin/bash
|
---|
2 | # Create a GCC Specs Patch
|
---|
3 |
|
---|
4 | # Get Version #
|
---|
5 | #
|
---|
6 | VERSION=$1
|
---|
7 |
|
---|
8 | # Check Input
|
---|
9 | #
|
---|
10 | if [ "${VERSION}" = "" ]; then
|
---|
11 | echo "$0 - GCC_Version"
|
---|
12 | echo "This will Create a Patch for GCC Specs GCC_Version"
|
---|
13 | exit 255
|
---|
14 | fi
|
---|
15 |
|
---|
16 | # Download GCC Source
|
---|
17 | #
|
---|
18 | cd ~/tmp
|
---|
19 | if ! [ -e gcc-${VERSION}.tar.bz2 ]; then
|
---|
20 | wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-${VERSION}/gcc-${VERSION}.tar.bz2
|
---|
21 | fi
|
---|
22 |
|
---|
23 | # Cleanup Directory
|
---|
24 | #
|
---|
25 | cd ~/tmp
|
---|
26 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
27 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
28 | pushd gcc-4.4.2
|
---|
29 | patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
|
---|
30 | popd
|
---|
31 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
32 |
|
---|
33 | # Modify the Data
|
---|
34 | #
|
---|
35 | cd ~/tmp/gcc-${VERSION}
|
---|
36 | for 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
|
---|
53 | done
|
---|
54 |
|
---|
55 |
|
---|
56 | # Create Patch
|
---|
57 | #
|
---|
58 | cd ~/tmp
|
---|
59 | install -d ~/patches
|
---|
60 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
61 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
62 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
63 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
64 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
65 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
66 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
67 | echo "" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
68 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
69 |
|
---|
70 | # Cleanup Directory
|
---|
71 | #
|
---|
72 | cd ~/tmp
|
---|
73 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
74 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
75 | pushd gcc-4.4.2
|
---|
76 | patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
|
---|
77 | popd
|
---|
78 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
79 |
|
---|
80 | # Modify the Data
|
---|
81 | #
|
---|
82 | cd ~/tmp/gcc-${VERSION}
|
---|
83 | for 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
|
---|
103 | done
|
---|
104 |
|
---|
105 | for 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
|
---|
116 | done
|
---|
117 |
|
---|
118 | # Create Patch
|
---|
119 | #
|
---|
120 | cd ~/tmp
|
---|
121 | install -d ~/patches
|
---|
122 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
123 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
124 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
125 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
126 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
127 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
128 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
129 | echo "" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
130 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
131 |
|
---|
132 | # Cleanup Directory
|
---|
133 | #
|
---|
134 | cd ~/tmp
|
---|
135 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
136 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
137 | pushd gcc-4.4.2
|
---|
138 | patch -Np1 -i /home/jciccone/projects/lfs/repos/patches/gcc/gcc-4.4.2-branch_update-1.patch
|
---|
139 | popd
|
---|
140 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
141 | CURRENTDIR=$(pwd -P)
|
---|
142 |
|
---|
143 | # Modify the Data
|
---|
144 | #
|
---|
145 | cd ~/tmp/gcc-${VERSION}
|
---|
146 | for 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
|
---|
161 | done
|
---|
162 |
|
---|
163 | for 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
|
---|
174 | done
|
---|
175 |
|
---|
176 | # Create Patch
|
---|
177 | #
|
---|
178 | cd ~/tmp
|
---|
179 | install -d ~/patches
|
---|
180 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
181 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
182 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
183 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
184 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
185 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
186 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
187 | echo "" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
188 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
189 |
|
---|
190 | echo "Created ~/patches/gcc-${VERSION}-specs-x.patch."
|
---|
191 | echo "Created ~/patches/gcc-${VERSION}-pure64_specs-x.patch."
|
---|
192 | echo "Created ~/patches/gcc-${VERSION}-pure64-x.patch."
|
---|
193 |
|
---|
194 | # Cleanup Directory
|
---|
195 | #
|
---|
196 | cd ~/tmp
|
---|
197 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|