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 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
29 |
|
---|
30 | # Modify the Data
|
---|
31 | #
|
---|
32 | cd ~/tmp/gcc-${VERSION}
|
---|
33 | for file in $(find gcc/config -name "*.h"); do
|
---|
34 | if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
|
---|
35 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
36 | echo "Modifying ${file}..."
|
---|
37 | sed -i '/DYNAMIC_LINKER/s@"/lib@"/tools/lib@' ${file}
|
---|
38 | fi
|
---|
39 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
40 | echo "Modifying ${file}..."
|
---|
41 | sed -i '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
|
---|
42 | fi
|
---|
43 | if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
|
---|
44 | echo "Modifying ${file}..."
|
---|
45 | sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/tools/lib64@' \
|
---|
46 | -e '/elf32_sparc -Y P,/s@/usr/lib@/tools/lib@' \
|
---|
47 | -e '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
|
---|
48 | fi
|
---|
49 | fi
|
---|
50 | done
|
---|
51 |
|
---|
52 |
|
---|
53 | # Create Patch
|
---|
54 | #
|
---|
55 | cd ~/tmp
|
---|
56 | install -d ~/patches
|
---|
57 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
58 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
59 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
60 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
61 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
62 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
63 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
64 | echo "" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
65 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
66 |
|
---|
67 | # Cleanup Directory
|
---|
68 | #
|
---|
69 | cd ~/tmp
|
---|
70 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
71 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
72 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
73 |
|
---|
74 | # Modify the Data
|
---|
75 | #
|
---|
76 | cd ~/tmp/gcc-${VERSION}
|
---|
77 | for file in $(find gcc/config -name "*.h"); do
|
---|
78 | if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
|
---|
79 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
80 | echo "Modifying ${file}..."
|
---|
81 | sed -i -e '/DYNAMIC_LINKER32/s@"/lib@"/tools/lib32@' \
|
---|
82 | -e '/DYNAMIC_LINKERN32/s@"/lib32@"/tools/lib64@' \
|
---|
83 | -e '/DYNAMIC_LINKER64/s@"/lib64@"/tools/lib@' \
|
---|
84 | -e '/DYNAMIC_LINKER/s@"/lib@"/tools/lib@' ${file}
|
---|
85 | fi
|
---|
86 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
87 | echo "Modifying ${file}..."
|
---|
88 | sed -i '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
|
---|
89 | fi
|
---|
90 | if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
|
---|
91 | echo "Modifying ${file}..."
|
---|
92 | sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/tools/lib@' \
|
---|
93 | -e '/elf32_sparc -Y P,/s@/usr/lib@/tools/lib32@' \
|
---|
94 | -e '/-dynamic-linker/s@ /lib@ /tools/lib@' ${file}
|
---|
95 | fi
|
---|
96 | fi
|
---|
97 | done
|
---|
98 |
|
---|
99 | for file in $(find gcc/config -name "t-linux*"); do
|
---|
100 | if [ "$(cat ${file} | grep -c MULTILIB_OSDIRNAMES)" != "0" ]; then
|
---|
101 | echo "Modifying ${file}..."
|
---|
102 | if [ "$(echo ${file} | grep -c mips)" != "0" ]; then
|
---|
103 | sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' \
|
---|
104 | -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' ${file}
|
---|
105 | else
|
---|
106 | sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib64 ../lib@MULTILIB_OSDIRNAMES = ../lib ../lib32@' \
|
---|
107 | -e 's@MULTILIB_OSDIRNAMES.= ../lib64 .@MULTILIB_OSDIRNAMES\t= ../lib $@' ${file}
|
---|
108 | fi
|
---|
109 | fi
|
---|
110 | done
|
---|
111 |
|
---|
112 | # Create Patch
|
---|
113 | #
|
---|
114 | cd ~/tmp
|
---|
115 | install -d ~/patches
|
---|
116 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
117 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
118 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
119 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
120 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
121 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
122 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
123 | echo "" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
124 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
125 |
|
---|
126 | # Cleanup Directory
|
---|
127 | #
|
---|
128 | cd ~/tmp
|
---|
129 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
130 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
131 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
132 | CURRENTDIR=$(pwd -P)
|
---|
133 |
|
---|
134 | # Modify the Data
|
---|
135 | #
|
---|
136 | cd ~/tmp/gcc-${VERSION}
|
---|
137 | for file in $(find gcc/config -name "*.h"); do
|
---|
138 | if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
|
---|
139 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
140 | echo "Modifying ${file}..."
|
---|
141 | sed -i -e '/DYNAMIC_LINKER32/s@"/lib@"/lib32@' \
|
---|
142 | -e '/DYNAMIC_LINKERN32/s@"/lib32@"/lib64@' \
|
---|
143 | -e '/DYNAMIC_LINKER64/s@"/lib64@"/lib@' \
|
---|
144 | -e '/DYNAMIC_LINKER/s@"/lib@"/lib@' ${file}
|
---|
145 | fi
|
---|
146 | if [ "$(cat ${file} | grep -c LINK_SPEC)" != "0" ]; then
|
---|
147 | echo "Modifying ${file}..."
|
---|
148 | sed -i -e '/elf64_sparc -Y P,/s@/usr/lib64@/usr/lib@' \
|
---|
149 | -e '/elf32_sparc -Y P,/s@/usr/lib@/usr/lib32@' ${file}
|
---|
150 | fi
|
---|
151 | fi
|
---|
152 | done
|
---|
153 |
|
---|
154 | for file in $(find gcc/config -name "t-linux*"); do
|
---|
155 | if [ "$(cat ${file} | grep -c MULTILIB_OSDIRNAMES)" != "0" ]; then
|
---|
156 | echo "Modifying ${file}..."
|
---|
157 | if [ "$(echo ${file} | grep -c mips)" != "0" ]; then
|
---|
158 | sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' \
|
---|
159 | -e 's@MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64@MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib@' ${file}
|
---|
160 | else
|
---|
161 | sed -i -e 's@MULTILIB_OSDIRNAMES = ../lib64 ../lib@MULTILIB_OSDIRNAMES = ../lib ../lib32@' \
|
---|
162 | -e 's@MULTILIB_OSDIRNAMES.= ../lib64 .@MULTILIB_OSDIRNAMES\t= ../lib $@' ${file}
|
---|
163 | fi
|
---|
164 | fi
|
---|
165 | done
|
---|
166 |
|
---|
167 | # Create Patch
|
---|
168 | #
|
---|
169 | cd ~/tmp
|
---|
170 | install -d ~/patches
|
---|
171 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
172 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
173 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
174 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
175 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
176 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
177 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
178 | echo "" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
179 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
180 |
|
---|
181 | echo "Created ~/patches/gcc-${VERSION}-specs-x.patch."
|
---|
182 | echo "Created ~/patches/gcc-${VERSION}-pure64_specs-x.patch."
|
---|
183 | echo "Created ~/patches/gcc-${VERSION}-pure64-x.patch."
|
---|
184 |
|
---|
185 | # Cleanup Directory
|
---|
186 | #
|
---|
187 | cd ~/tmp
|
---|
188 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|