2014-10-17 20:19:31 +00:00
|
|
|
# Copyright 2014 Wolfgang Thaller.
|
2012-04-24 01:22:36 +00:00
|
|
|
#
|
|
|
|
# This file is part of Retro68.
|
|
|
|
#
|
|
|
|
# Retro68 is free software: you can redistribute it and/or 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 your option) any later version.
|
|
|
|
#
|
|
|
|
# Retro68 is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Retro68. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Set up paths.
|
2012-04-06 18:56:16 +00:00
|
|
|
SRC=$(cd `dirname $0` && pwd -P)
|
2015-08-30 13:36:27 +00:00
|
|
|
PREFIX=`pwd -P`/toolchain/
|
|
|
|
BINUTILS=`pwd -P`/binutils-build
|
2015-08-30 23:17:52 +00:00
|
|
|
if false; then
|
2015-08-30 13:36:27 +00:00
|
|
|
# Remove old install tree
|
2015-07-20 19:38:01 +00:00
|
|
|
rm -rf toolchain
|
2012-03-29 08:30:42 +00:00
|
|
|
mkdir -p toolchain
|
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
|
|
|
|
# Build binutils for 68K
|
|
|
|
mkdir -p binutils-build
|
2012-03-29 08:30:42 +00:00
|
|
|
cd binutils-build
|
2012-04-06 18:56:16 +00:00
|
|
|
export "CFLAGS=-Wno-error"
|
2015-08-29 17:51:21 +00:00
|
|
|
$SRC/binutils/configure --target=m68k-apple-macos --prefix=$PREFIX --disable-doc
|
2012-03-29 08:30:42 +00:00
|
|
|
make -j8
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
# Build gcc for 68K
|
2012-03-29 08:30:42 +00:00
|
|
|
mkdir -p gcc-build
|
|
|
|
cd gcc-build
|
2015-08-29 17:51:21 +00:00
|
|
|
$SRC/gcc/configure --target=m68k-apple-macos --prefix=$PREFIX --enable-languages=c,c++ --with-arch=m68k --with-cpu=m68000 --disable-libssp MAKEINFO=missing
|
2012-03-29 08:30:42 +00:00
|
|
|
make -j8
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
2015-08-30 23:17:52 +00:00
|
|
|
unset CFLAGS
|
|
|
|
# Build binutils for PPC
|
|
|
|
mkdir -p binutils-build-ppc
|
|
|
|
cd binutils-build-ppc
|
|
|
|
$SRC/binutils/configure --target=powerpc-apple-macos --prefix=$PREFIX --disable-doc
|
|
|
|
make -j8
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Build gcc for PPC
|
|
|
|
mkdir -p gcc-build-ppc
|
|
|
|
cd gcc-build-ppc
|
|
|
|
$SRC/gcc/configure --target=powerpc-apple-macos --prefix=$PREFIX --enable-languages=c,c++ --disable-libssp MAKEINFO=missing
|
|
|
|
make -j8
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
# Install elf.h (for elf2flt)
|
|
|
|
mkdir -p $PREFIX/include
|
2012-04-06 18:56:16 +00:00
|
|
|
cp $SRC/elf.h $PREFIX/include/
|
2015-08-30 13:36:27 +00:00
|
|
|
|
|
|
|
# Build elf2flt
|
2014-10-17 20:19:31 +00:00
|
|
|
export "CFLAGS=-I${SRC}/binutils/include -I../toolchain/include"
|
2012-03-29 08:30:42 +00:00
|
|
|
mkdir -p elf2flt-build
|
|
|
|
cd elf2flt-build
|
2015-08-29 17:51:21 +00:00
|
|
|
$SRC/elf2flt/configure --target=m68k-apple-macos --prefix=$PREFIX --with-binutils-build-dir=$BINUTILS
|
2012-04-06 18:56:16 +00:00
|
|
|
make -j8 TOOLDIR=$PREFIX/bin
|
2012-03-29 08:30:42 +00:00
|
|
|
make install
|
2012-04-03 07:04:22 +00:00
|
|
|
unset CFLAGS
|
2012-03-29 08:30:42 +00:00
|
|
|
cd ..
|
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
# Build hfsutil
|
2012-04-06 18:56:16 +00:00
|
|
|
mkdir -p $PREFIX/man/man1
|
2012-03-29 08:30:42 +00:00
|
|
|
rm -rf hfsutils
|
|
|
|
cp -r $SRC/hfsutils .
|
|
|
|
cd hfsutils
|
2014-10-31 00:16:47 +00:00
|
|
|
./configure --prefix=$PREFIX --enable-devlibs
|
2012-03-29 08:30:42 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
2015-08-30 23:17:52 +00:00
|
|
|
fi
|
2015-08-30 13:36:27 +00:00
|
|
|
# Install Universal Interfaces
|
2015-08-30 23:17:52 +00:00
|
|
|
for arch in m68k powerpc; do
|
|
|
|
sh "$SRC/prepare-headers.sh" "$SRC/CIncludes" toolchain/${arch}-apple-macos/include
|
|
|
|
mkdir -p toolchain/${arch}-apple-macos/RIncludes
|
|
|
|
sh "$SRC/prepare-rincludes.sh" "$SRC/RIncludes" toolchain/${arch}-apple-macos/RIncludes
|
|
|
|
done
|
2015-07-16 22:32:27 +00:00
|
|
|
|
2015-08-30 13:36:27 +00:00
|
|
|
# Build host-based components
|
2012-04-06 18:56:16 +00:00
|
|
|
mkdir -p build-host
|
|
|
|
cd build-host
|
2014-10-17 20:19:31 +00:00
|
|
|
cmake ${SRC} -DCMAKE_INSTALL_PREFIX=$PREFIX
|
2012-04-06 18:56:16 +00:00
|
|
|
cd ..
|
2015-07-15 23:26:11 +00:00
|
|
|
make -C build-host install
|
|
|
|
|
2014-10-12 18:04:55 +00:00
|
|
|
# create an empty libretrocrt.a so that cmake's compiler test doesn't fail
|
2015-08-30 23:17:52 +00:00
|
|
|
for arch in m68k powerpc; do
|
|
|
|
$PREFIX/bin/${arch}-apple-macos-ar cqs $PREFIX/${arch}-apple-macos/lib/libretrocrt.a
|
|
|
|
done
|
2014-10-12 18:04:55 +00:00
|
|
|
# the real libretrocrt.a is built and installed by `make -C build-target install` later
|
|
|
|
|
2015-08-30 23:17:52 +00:00
|
|
|
# Build target-based components for 68K
|
2012-04-06 18:56:16 +00:00
|
|
|
mkdir -p build-target
|
|
|
|
cd build-target
|
2015-07-20 22:09:06 +00:00
|
|
|
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intree.toolchain.cmake \
|
2015-07-20 19:38:01 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=Release
|
2012-04-06 18:56:16 +00:00
|
|
|
cd ..
|
|
|
|
make -C build-target install
|
2015-08-30 23:17:52 +00:00
|
|
|
|
|
|
|
# Build target-based components for PPC
|
|
|
|
mkdir -p build-target-ppc
|
|
|
|
cd build-target-ppc
|
|
|
|
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intreeppc.toolchain.cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
|
|
cd ..
|
|
|
|
make -C build-target-ppc install
|