build-toolchain: clean up & comment

This commit is contained in:
Wolfgang Thaller 2015-08-30 15:36:27 +02:00
parent 332bb90e52
commit 1a5d88b098

View File

@ -15,32 +15,40 @@
# You should have received a copy of the GNU General Public License
# along with Retro68. If not, see <http://www.gnu.org/licenses/>.
SRC=$(cd `dirname $0` && pwd -P)
mkdir -p binutils-build
rm -rf toolchain
mkdir -p toolchain
PREFIX=`pwd`/toolchain/
set -e
# Set up paths.
SRC=$(cd `dirname $0` && pwd -P)
PREFIX=`pwd -P`/toolchain/
BINUTILS=`pwd -P`/binutils-build
# Remove old install tree
rm -rf toolchain
mkdir -p toolchain
# Build binutils for 68K
mkdir -p binutils-build
cd binutils-build
export "CFLAGS=-Wno-error"
$SRC/binutils/configure --target=m68k-apple-macos --prefix=$PREFIX --disable-doc
make -j8
make install
cd ..
# Build gcc for 68K
mkdir -p gcc-build
cd gcc-build
$SRC/gcc/configure --target=m68k-apple-macos --prefix=$PREFIX --enable-languages=c,c++ --with-arch=m68k --with-cpu=m68000 --disable-libssp MAKEINFO=missing
make -j8
make install
cd ..
BINUTILS=$(cd binutils-build && pwd -P)
# Install elf.h (for elf2flt)
mkdir -p $PREFIX/include
cp $SRC/elf.h $PREFIX/include/
# Build elf2flt
export "CFLAGS=-I${SRC}/binutils/include -I../toolchain/include"
mkdir -p elf2flt-build
cd elf2flt-build
@ -48,9 +56,9 @@ $SRC/elf2flt/configure --target=m68k-apple-macos --prefix=$PREFIX --with-binutil
make -j8 TOOLDIR=$PREFIX/bin
make install
unset CFLAGS
cd ..
# Build hfsutil
mkdir -p $PREFIX/man/man1
rm -rf hfsutils
cp -r $SRC/hfsutils .
@ -60,29 +68,28 @@ make
make install
cd ..
# Install Universal Interfaces
sh "$SRC/prepare-headers.sh" "$SRC/CIncludes" toolchain/m68k-apple-macos/include
mkdir -p toolchain/m68k-apple-macos/RIncludes
sh "$SRC/prepare-rincludes.sh" "$SRC/RIncludes" toolchain/m68k-apple-macos/RIncludes
# Build host-based components
mkdir -p build-host
cd build-host
cmake ${SRC} -DCMAKE_INSTALL_PREFIX=$PREFIX
cd ..
make -C build-host install
# create an empty libretrocrt.a so that cmake's compiler test doesn't fail
$PREFIX/bin/m68k-apple-macos-ar cqs $PREFIX/m68k-apple-macos/lib/libretrocrt.a
# the real libretrocrt.a is built and installed by `make -C build-target install` later
# Build target-based components
mkdir -p build-target
cd build-target
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intree.toolchain.cmake \
-DIN_RETRO68_TREE=True \
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target install