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 | fi
|
---|
14 |
|
---|
15 | # Download GCC Source
|
---|
16 | #
|
---|
17 | cd /usr/src
|
---|
18 | if ! [ -e gcc-${VERSION}.tar.bz2 ]; then
|
---|
19 | wget ftp://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.tar.bz2
|
---|
20 | fi
|
---|
21 |
|
---|
22 | # Cleanup Directory
|
---|
23 | #
|
---|
24 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
25 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
26 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
27 | CURRENTDIR=$(pwd -P)
|
---|
28 |
|
---|
29 | # Modify the Data
|
---|
30 | #
|
---|
31 | cd /usr/src/gcc-${VERSION}
|
---|
32 | for file in $(find gcc/config -name "*.h"); do
|
---|
33 | if [ "$(echo ${file} | grep -c bsd)" = "0" ]; then
|
---|
34 | if [ "$(cat ${file} | grep -c DYNAMIC_LINKER)" != "0" ]; then
|
---|
35 | echo "Modifying ${file}..."
|
---|
36 | sed -i '/DYNAMIC_LINKER/s@"/lib@"/tools/lib@' ${file}
|
---|
37 | fi
|
---|
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 | fi
|
---|
43 | done
|
---|
44 |
|
---|
45 |
|
---|
46 | # Create Patch
|
---|
47 | #
|
---|
48 | cd /usr/src
|
---|
49 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-specs-x.patch
|
---|
50 | echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-specs-x.patch
|
---|
51 | echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-specs-x.patch
|
---|
52 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> gcc-${VERSION}-specs-x.patch
|
---|
53 | echo " the Pure LFS project." >> gcc-${VERSION}-specs-x.patch
|
---|
54 | echo "Upstream Status: Not Applied" >> gcc-${VERSION}-specs-x.patch
|
---|
55 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> gcc-${VERSION}-specs-x.patch
|
---|
56 | echo "" >> gcc-${VERSION}-specs-x.patch
|
---|
57 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-specs-x.patch
|
---|
58 | echo "Created /usr/src/gcc-${VERSION}-specs-x.patch."
|
---|