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

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

Updates to Patch Scripts

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