[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 | #
|
---|
[d8a9d8b] | 18 | cd ~/tmp
|
---|
[2a7925b] | 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 | #
|
---|
[d8a9d8b] | 25 | cd ~/tmp
|
---|
[2a7925b] | 26 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 27 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
| 28 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 29 |
|
---|
| 30 | # Modify the Data
|
---|
| 31 | #
|
---|
[d8a9d8b] | 32 | cd ~/tmp/gcc-${VERSION}
|
---|
[2a7925b] | 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 | #
|
---|
[d8a9d8b] | 55 | cd ~/tmp
|
---|
| 56 | install -d ~/patches
|
---|
| 57 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 58 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 59 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 60 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 61 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 62 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 63 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 64 | echo "" >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
| 65 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-specs-x.patch
|
---|
[0804c00] | 66 |
|
---|
| 67 | # Cleanup Directory
|
---|
| 68 | #
|
---|
[d8a9d8b] | 69 | cd ~/tmp
|
---|
[0804c00] | 70 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 71 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
| 72 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 73 |
|
---|
| 74 | # Modify the Data
|
---|
| 75 | #
|
---|
[d8a9d8b] | 76 | cd ~/tmp/gcc-${VERSION}
|
---|
[0804c00] | 77 | for 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
|
---|
| 97 | done
|
---|
| 98 |
|
---|
| 99 | # Create Patch
|
---|
| 100 | #
|
---|
[d8a9d8b] | 101 | cd ~/tmp
|
---|
| 102 | install -d ~/patches
|
---|
| 103 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 104 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 105 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 106 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 107 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 108 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 109 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 110 | echo "" >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
| 111 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64_specs-x.patch
|
---|
[0804c00] | 112 |
|
---|
| 113 | # Cleanup Directory
|
---|
| 114 | #
|
---|
[d8a9d8b] | 115 | cd ~/tmp
|
---|
[0804c00] | 116 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 117 | tar xvf gcc-${VERSION}.tar.bz2
|
---|
| 118 | cp -ar gcc-${VERSION} gcc-${VERSION}.orig
|
---|
| 119 | CURRENTDIR=$(pwd -P)
|
---|
| 120 |
|
---|
| 121 | # Modify the Data
|
---|
| 122 | #
|
---|
[d8a9d8b] | 123 | cd ~/tmp/gcc-${VERSION}
|
---|
[0804c00] | 124 | for 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
|
---|
| 139 | done
|
---|
| 140 |
|
---|
| 141 | for 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
|
---|
| 152 | done
|
---|
| 153 |
|
---|
| 154 | # Create Patch
|
---|
| 155 | #
|
---|
[d8a9d8b] | 156 | cd ~/tmp
|
---|
| 157 | install -d ~/patches
|
---|
| 158 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 159 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 160 | echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 161 | echo "Origin: Idea originally developed by Ryan Oliver and Greg Schafer for" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 162 | echo " the Pure LFS project." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 163 | echo "Upstream Status: Not Applied" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 164 | echo "Description: This patch modifies the location of the dynamic linker for gcc-${VERSION}." >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 165 | echo "" >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 166 | diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-pure64-x.patch
|
---|
| 167 |
|
---|
| 168 | echo "Created ~/patches/gcc-${VERSION}-specs-x.patch."
|
---|
| 169 | echo "Created ~/patches/gcc-${VERSION}-pure64_specs-x.patch."
|
---|
| 170 | echo "Created ~/patches/gcc-${VERSION}-pure64-x.patch."
|
---|
| 171 |
|
---|
| 172 | # Cleanup Directory
|
---|
| 173 | #
|
---|
| 174 | cd ~/tmp
|
---|
| 175 | rm -rf gcc-${VERSION} gcc-${VERSION}.orig
|
---|