source: scripts/patch/gcc-specs-patch.sh@ a689767

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since a689767 was 0804c00, checked in by Jim Gifford <clfs@…>, 16 years ago

Updated to GCC 4.3.3 - Patches

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