1 |
103 |
dgisselq |
#!/bin/bash
|
2 |
200 |
dgisselq |
################################################################################
|
3 |
|
|
##
|
4 |
|
|
## Filename: gcc-script.sh
|
5 |
|
|
##
|
6 |
|
|
## Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
7 |
|
|
##
|
8 |
|
|
## Purpose: To handle all of the GCC configuration options properly. This
|
9 |
|
|
## both runs the GCC configure script, as well as initially running
|
10 |
|
|
## make on the resulting configured directory.
|
11 |
|
|
##
|
12 |
|
|
##
|
13 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
14 |
|
|
## Gisselquist Technology, LLC
|
15 |
|
|
##
|
16 |
|
|
################################################################################
|
17 |
|
|
##
|
18 |
|
|
## Copyright (C) 2016, Gisselquist Technology, LLC
|
19 |
|
|
##
|
20 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
21 |
|
|
## modify it under the terms of the GNU General Public License as published
|
22 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
23 |
|
|
## your option) any later version.
|
24 |
|
|
##
|
25 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
26 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
27 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
28 |
|
|
## for more details.
|
29 |
|
|
##
|
30 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
31 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
32 |
|
|
##
|
33 |
|
|
##
|
34 |
|
|
################################################################################
|
35 |
|
|
##
|
36 |
|
|
##
|
37 |
103 |
dgisselq |
if [[ ! -d gcc-5.3.0-zip ]]
|
38 |
|
|
then
|
39 |
|
|
tar -xjf ./gcc-5.3.0.tar.bz2 --transform s,gcc-5.3.0,gcc-5.3.0-zip,
|
40 |
|
|
cd gcc-5.3.0-zip
|
41 |
|
|
patch -p1 <../gcc-5.3.0-specs-1.patch
|
42 |
|
|
rm gcc/config/rs6000/sysv4.h.orig
|
43 |
|
|
patch -p1 <../gcc-zippatch.patch
|
44 |
|
|
cd ..
|
45 |
|
|
fi
|
46 |
|
|
|
47 |
200 |
dgisselq |
uname -a | grep x86 > /dev/null
|
48 |
|
|
if [[ $? != 0 ]]; then
|
49 |
|
|
echo "This build script only works for x86_64 machines"
|
50 |
|
|
echo "You will need to change the CLFS_HOST line if you wish to build"
|
51 |
|
|
echo "on any other type of host."
|
52 |
|
|
exit 1
|
53 |
|
|
fi
|
54 |
|
|
|
55 |
103 |
dgisselq |
set +h
|
56 |
|
|
set -e
|
57 |
|
|
CLFS_HOST="x86_64-cross-linux-gnu"
|
58 |
200 |
dgisselq |
# CLFS_HOST="arm-unknown-linux-gnueabihf" # For a Raspberry Pi ??
|
59 |
103 |
dgisselq |
CLFS_TARGET="zip"
|
60 |
|
|
INSTALL_BASE=`pwd`/install
|
61 |
200 |
dgisselq |
mkdir -p ${INSTALL_BASE}/cross-tools
|
62 |
103 |
dgisselq |
mkdir -p ${INSTALL_BASE}/tools/lib
|
63 |
|
|
mkdir -p ${INSTALL_BASE}/usr/include
|
64 |
|
|
mkdir -p build-gcc
|
65 |
|
|
cd build-gcc
|
66 |
|
|
|
67 |
111 |
dgisselq |
AR_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ar
|
68 |
|
|
AS_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-as
|
69 |
|
|
LD_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ld
|
70 |
|
|
NM_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-nm
|
71 |
|
|
OBJCOPY_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-objcopy
|
72 |
|
|
OBJDUMP_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-objdump
|
73 |
|
|
READELF_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-readelf
|
74 |
|
|
STRIP_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-strip
|
75 |
103 |
dgisselq |
|
76 |
|
|
AS=as AR=ar ../gcc-5.3.0-zip/configure --with-gas \
|
77 |
|
|
--prefix=${INSTALL_BASE}/cross-tools \
|
78 |
|
|
--target=${CLFS_TARGET} --host=${CLFS_HOST} \
|
79 |
|
|
--with-pkgversion=zip-gcc-`date +%y%m%d` \
|
80 |
|
|
--disable-shared --disable-multilib \
|
81 |
|
|
--disable-threads --disable-tls \
|
82 |
|
|
--disable-libada --disable-libsanitizer \
|
83 |
|
|
--disable-libssp --disable-libquadmath \
|
84 |
|
|
--disable-libgomp --disable-libvtv \
|
85 |
|
|
--enable-checking --disable-nls \
|
86 |
104 |
dgisselq |
--disable-sjlj-exceptions \
|
87 |
103 |
dgisselq |
--disable-decimal-float --disable-fixed-point \
|
88 |
|
|
--disable-lto --disable-canonical-system-headers
|
89 |
|
|
|
90 |
171 |
dgisselq |
echo $PATH | grep ${INSTALL_BASE}/cross-tools/bin \
|
91 |
|
|
|| PATH=$PATH:${INSTALL_BASE}/cross-tools/bin
|
92 |
200 |
dgisselq |
make $* || true
|
93 |
|
|
cd gcc; make $* || true
|
94 |
|
|
cd ../; make $* all-libcc1 || true
|
95 |
|
|
cd libcc1; make $* || true
|
96 |
|
|
cd ../gcc; make $* || true
|
97 |
|
|
make $* install || true
|
98 |
104 |
dgisselq |
|