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 /usr/src |
---|
19 | if ! [ -e gcc-${VERSION}.tar.bz2 ]; then |
---|
20 | wget ftp://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.tar.bz2 |
---|
21 | fi |
---|
22 | |
---|
23 | # Cleanup Directory |
---|
24 | # |
---|
25 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig |
---|
26 | tar xvf gcc-${VERSION}.tar.bz2 |
---|
27 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig |
---|
28 | CURRENTDIR=$(pwd -P) |
---|
29 | |
---|
30 | # Modify the Data |
---|
31 | # |
---|
32 | cd /usr/src/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 | fi |
---|
44 | done |
---|
45 | |
---|
46 | |
---|
47 | # Create Patch |
---|
48 | # |
---|
49 | cd /usr/src |
---|
50 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-specs-x.patch |
---|
51 | echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-specs-x.patch |
---|
52 | echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-specs-x.patch |
---|
53 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> gcc-${VERSION}-specs-x.patch |
---|
54 | echo " the Pure LFS project." >> gcc-${VERSION}-specs-x.patch |
---|
55 | echo "Upstream Status: Not Applied" >> gcc-${VERSION}-specs-x.patch |
---|
56 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> gcc-${VERSION}-specs-x.patch |
---|
57 | echo "" >> gcc-${VERSION}-specs-x.patch |
---|
58 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-specs-x.patch |
---|
59 | echo "Created /usr/src/gcc-${VERSION}-specs-x.patch." |
---|