build-toolchain: add --no-68k, --no-ppc, --no-carbon flags.

This commit is contained in:
Wolfgang Thaller 2017-04-12 11:56:34 +02:00
parent 431390d872
commit 882ff68a18
1 changed files with 52 additions and 4 deletions

View File

@ -23,11 +23,25 @@ PREFIX=`pwd -P`/toolchain/
BINUTILS=`pwd -P`/binutils-build
CMAKEONLY=false
BUILD_68K=true
BUILD_PPC=true
BUILD_CARBON=true
for ARG in $*; do
case $ARG in
--cmakeonly)
CMAKEONLY=true
;;
--no-68k)
BUILD_68K=false
;;
--no-ppc)
BUILD_PPC=false
BUILD_CARBON=false
;;
--no-carbon)
BUILD_CARBON=false
;;
*)
echo "unknown option $ARG"
exit 1
@ -35,16 +49,29 @@ for ARG in $*; do
esac
done
ARCHS=""
if [ $BUILD_68K != false ]; then
ARCHS="$ARCHS m68k"
fi
if [ $BUILD_PPC != false ]; then
ARCHS="$ARCHS powerpc"
fi
if [ $CMAKEONLY != true ]; then
# Remove old install tree
rm -rf toolchain
mkdir -p toolchain
if [ $BUILD_68K != false ]; then
export "CFLAGS=-Wno-error"
# 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
@ -60,6 +87,11 @@ make install
cd ..
unset CFLAGS
fi
if [ $BUILD_PPC != false ]; then
# Build binutils for PPC
mkdir -p binutils-build-ppc
cd binutils-build-ppc
@ -76,6 +108,10 @@ make -j8
make install
cd ..
fi
if [ $BUILD_68K != false ]; then
# Install elf.h (for elf2flt)
mkdir -p $PREFIX/include
cp $SRC/elf.h $PREFIX/include/
@ -89,9 +125,13 @@ $SRC/elf2flt/configure --target=m68k-apple-macos --prefix=$PREFIX --with-binutil
make -j8 TOOLDIR=$PREFIX/bin
make install
unset CFLAGS
unset CPPFLAGS
cd ..
fi
# Build hfsutil
mkdir -p $PREFIX/lib
mkdir -p $PREFIX/man/man1
rm -rf hfsutils
cp -r $SRC/hfsutils .
@ -102,13 +142,15 @@ make install
cd ..
# Install Universal Interfaces
for arch in m68k powerpc; do
for arch in $ARCHS; 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
cp $SRC/ImportLibraries/*.a toolchain/powerpc-apple-macos/lib/
if [ $BUILD_PPC != false ]; then
cp $SRC/ImportLibraries/*.a toolchain/powerpc-apple-macos/lib/
fi
fi # CMAKEONLY
@ -120,11 +162,12 @@ cd ..
make -C build-host install
# create an empty libretrocrt.a so that cmake's compiler test doesn't fail
for arch in m68k powerpc; do
for arch in $ARCHS; do
$PREFIX/bin/${arch}-apple-macos-ar cqs $PREFIX/${arch}-apple-macos/lib/libretrocrt.a
done
# the real libretrocrt.a is built and installed by `make -C build-target install` later
if [ $BUILD_68K != false ]; then
# Build target-based components for 68K
mkdir -p build-target
cd build-target
@ -132,7 +175,9 @@ cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intree.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target install
fi
if [ $BUILD_PPC != false ]; then
# Build target-based components for PPC
mkdir -p build-target-ppc
cd build-target-ppc
@ -140,7 +185,9 @@ cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intreeppc.toolchain.cmak
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target-ppc install
fi
if [ $BUILD_CARBON != false ]; then
# Build target-based components for Carbon
mkdir -p build-target-carbon
cd build-target-carbon
@ -148,3 +195,4 @@ cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intreecarbon.toolchain.c
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target-carbon install
fi