[2a7925b] | 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
|
---|
[9676bac] | 11 | echo "$0 - GCC_Version"
|
---|
| 12 | echo "This will Create a Patch for GCC Specs GCC_Version"
|
---|
| 13 | exit 255
|
---|
[2a7925b] | 14 | fi
|
---|
| 15 |
|
---|
| 16 | # Download GCC Source
|
---|
| 17 | #
|
---|
| 18 | cd /usr/src
|
---|
| 19 | if ! [ -e gcc-${VERSION}.tar.bz2 ]; then
|
---|
[0804c00] | 20 | wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-${VERSION}/gcc-${VERSION}.tar.bz2
|
---|
[2a7925b] | 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
|
---|
[9676bac] | 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
|
---|
[0804c00] | 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
|
---|
[9676bac] | 49 | fi
|
---|
[2a7925b] | 50 | done
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | # Create Patch
|
---|
| 54 | #
|
---|
| 55 | cd /usr/src
|
---|
| 56 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-specs-x.patch
|
---|
| 57 | echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-specs-x.patch
|
---|
| 58 | echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-specs-x.patch
|
---|
| 59 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> gcc-${VERSION}-specs-x.patch
|
---|
| 60 | echo " the Pure LFS project." >> gcc-${VERSION}-specs-x.patch
|
---|
| 61 | echo "Upstream Status: Not Applied" >> gcc-${VERSION}-specs-x.patch
|
---|
| 62 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> gcc-${VERSION}-specs-x.patch
|
---|
| 63 | echo "" >> gcc-${VERSION}-specs-x.patch
|
---|
| 64 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-specs-x.patch
|
---|
[0804c00] | 65 |
|
---|
| 66 | # Cleanup Directory
|
---|
| 67 | #
|
---|
| 68 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 69 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
| 70 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 71 | CURRENTDIR=$(pwd -P)
|
---|
| 72 |
|
---|
| 73 | # Modify the Data
|
---|
| 74 | #
|
---|
| 75 | cd /usr/src/gcc-${VERSION}
|
---|
| 76 | for 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
|
---|
| 96 | done
|
---|
| 97 |
|
---|
| 98 | # Create Patch
|
---|
| 99 | #
|
---|
| 100 | cd /usr/src
|
---|
| 101 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 102 | echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 103 | echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 104 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 105 | echo " the Pure LFS project." >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 106 | echo "Upstream Status: Not Applied" >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 107 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 108 | echo "" >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 109 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 110 |
|
---|
| 111 | # Cleanup Directory
|
---|
| 112 | #
|
---|
| 113 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 114 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
| 115 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 116 | CURRENTDIR=$(pwd -P)
|
---|
| 117 |
|
---|
| 118 | # Modify the Data
|
---|
| 119 | #
|
---|
| 120 | cd /usr/src/gcc-${VERSION}
|
---|
| 121 | for 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
|
---|
| 136 | done
|
---|
| 137 |
|
---|
| 138 | for 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
|
---|
| 149 | done
|
---|
| 150 |
|
---|
| 151 | # Create Patch
|
---|
| 152 | #
|
---|
| 153 | cd /usr/src
|
---|
| 154 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-pure64-x.patch
|
---|
| 155 | echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-pure64-x.patch
|
---|
| 156 | echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-pure64-x.patch
|
---|
| 157 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> gcc-${VERSION}-pure64-x.patch
|
---|
| 158 | echo " the Pure LFS project." >> gcc-${VERSION}-pure64-x.patch
|
---|
| 159 | echo "Upstream Status: Not Applied" >> gcc-${VERSION}-pure64-x.patch
|
---|
| 160 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> gcc-${VERSION}-pure64-x.patch
|
---|
| 161 | echo "" >> gcc-${VERSION}-pure64-x.patch
|
---|
| 162 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-pure64-x.patch
|
---|
| 163 |
|
---|
[2a7925b] | 164 | echo "Created /usr/src/gcc-${VERSION}-specs-x.patch."
|
---|
[0804c00] | 165 | echo "Created /usr/src/gcc-${VERSION}-pure64_specs-x.patch."
|
---|
| 166 | echo "Created /usr/src/gcc-${VERSION}-pure64-x.patch."
|
---|