#!/bin/bash
|
#!/bin/bash
|
################################################################################
|
################################################################################
|
##
|
##
|
## Filename: gcc-script.sh
|
## Filename: gcc-script.sh
|
##
|
##
|
## Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
## Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
##
|
##
|
## Purpose: To handle all of the GCC configuration options properly. This
|
## Purpose: To handle all of the GCC configuration options properly. This
|
## both runs the GCC configure script, as well as initially running
|
## runs the GCC configure script, using options known to work
|
## make on the resulting configured directory.
|
## with the ZipCPU.
|
##
|
##
|
##
|
##
|
## Creator: Dan Gisselquist, Ph.D.
|
## Creator: Dan Gisselquist, Ph.D.
|
## Gisselquist Technology, LLC
|
## Gisselquist Technology, LLC
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
## Copyright (C) 2016, Gisselquist Technology, LLC
|
## Copyright (C) 2016, Gisselquist Technology, LLC
|
##
|
##
|
## This program is free software (firmware): you can redistribute it and/or
|
## This program is free software (firmware): you can redistribute it and/or
|
## modify it under the terms of the GNU General Public License as published
|
## modify it under the terms of the GNU General Public License as published
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## your option) any later version.
|
## your option) any later version.
|
##
|
##
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## for more details.
|
## for more details.
|
##
|
##
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## http://www.gnu.org/licenses/gpl.html
|
## http://www.gnu.org/licenses/gpl.html
|
##
|
##
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
VERSION=gcc-6.2.0
|
VERSION=gcc-6.2.0
|
ZVERSION=gcc-6.2.0-zip
|
ZVERSION=gcc-6.2.0-zip
|
# if [[ ! -d $ZVERSION ]]
|
# if [[ ! -d $ZVERSION ]]
|
# then
|
# then
|
# tar -xjf ./$VERSION.tar.bz2 --transform s,$VERSION,$ZVERSION,
|
# tar -xjf ./$VERSION.tar.bz2 --transform s,$VERSION,$ZVERSION,
|
# if [[ -e ../gcc-zippatch.path ]];
|
# if [[ -e ../gcc-zippatch.path ]];
|
# then
|
# then
|
# cd gcc-6.2.0-zip
|
# cd gcc-6.2.0-zip
|
# patch -p1 <../gcc6-zippatch.patch
|
# patch -p1 <../gcc6-zippatch.patch
|
# cd ..
|
# cd ..
|
# else
|
# else
|
# echo "No Patch file!"
|
# echo "No Patch file!"
|
# exit -1;
|
# exit -1;
|
# fi
|
# fi
|
# if [[ -d build-gcc ]]
|
# if [[ -d build-gcc ]]
|
# then
|
# then
|
# # Remove any incomplete build projects from ... possibly other versions
|
# # Remove any incomplete build projects from ... possibly other versions
|
# # This way we can reuse the build directory
|
# # This way we can reuse the build directory
|
# rm -rf build-gcc/
|
# rm -rf build-gcc/
|
# fi
|
# fi
|
# fi
|
# fi
|
|
|
set +h
|
set +h
|
set -e
|
set -e
|
CLFS_HOST=$MACHTYPE
|
CLFS_HOST=$MACHTYPE
|
CLFS_TARGET="zip"
|
CLFS_TARGET="zip"
|
INSTALL_BASE=`pwd`/install
|
if [[ -z "$INSTALLD" ]]
|
|
then
|
|
INSTALLD=`pwd`/install
|
|
fi
|
|
if [[ ! $(which zip-as) ]]
|
|
then
|
|
echo "GCC-script ERROR: Unable to find zip-as, the ZipCPU assembler, in your path"
|
|
exit -1
|
|
fi
|
|
INSTALL_BASE=${INSTALLD}
|
mkdir -p ${INSTALL_BASE}/cross-tools
|
mkdir -p ${INSTALL_BASE}/cross-tools
|
mkdir -p ${INSTALL_BASE}/tools/lib
|
mkdir -p ${INSTALL_BASE}/tools/lib
|
mkdir -p ${INSTALL_BASE}/usr/include
|
mkdir -p ${INSTALL_BASE}/usr/include
|
mkdir -p build-gcc
|
mkdir -p build-gcc
|
cd build-gcc
|
cd build-gcc
|
|
|
AS_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-as
|
AS_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-as
|
AR_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ar
|
AR_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ar
|
NM_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-nm
|
NM_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-nm
|
LD_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ld
|
LD_FOR_TARGET=${INSTALL_BASE}/cross-tools/bin/zip-ld
|
|
|
../$ZVERSION/configure --with-gas \
|
../$ZVERSION/configure --with-gas \
|
--prefix=${INSTALL_BASE}/cross-tools \
|
--prefix=${INSTALL_BASE}/cross-tools \
|
--target=${CLFS_TARGET} \
|
--target=${CLFS_TARGET} \
|
--with-pkgversion=zip-gcc-`date +%y%m%d` \
|
--with-pkgversion=zip-gcc-`date +%y%m%d` \
|
--disable-multilib \
|
--disable-multilib \
|
--disable-threads --disable-tls \
|
--disable-threads --disable-tls \
|
--enable-checking --disable-nls \
|
--enable-checking --disable-nls \
|
--without-fp --with-newlib
|
--with-newlib
|
|
|
echo $PATH | grep ${INSTALL_BASE}/cross-tools/bin \
|
echo $PATH | grep ${INSTALL_BASE}/cross-tools/bin \
|
|| export PATH=$PATH:${INSTALL_BASE}/cross-tools/bin
|
|| export PATH=$PATH:${INSTALL_BASE}/cross-tools/bin
|
|
|