ppc: add to build script

This commit is contained in:
Wolfgang Thaller 2015-08-31 01:17:52 +02:00
parent 59827d52b4
commit 1434a0dbae
6 changed files with 83 additions and 11 deletions

View File

@ -47,6 +47,7 @@ else()
set(RETRO68_ROOT ${CMAKE_INSTALL_PREFIX})
configure_file(cmake/intree.toolchain.cmake.in cmake/intree.toolchain.cmake @ONLY)
configure_file(cmake/intreeppc.toolchain.cmake.in cmake/intreeppc.toolchain.cmake @ONLY)
add_subdirectory(ResourceFiles)
add_subdirectory(MakeAPPL)

View File

@ -21,7 +21,7 @@ set -e
SRC=$(cd `dirname $0` && pwd -P)
PREFIX=`pwd -P`/toolchain/
BINUTILS=`pwd -P`/binutils-build
if false; then
# Remove old install tree
rm -rf toolchain
mkdir -p toolchain
@ -44,6 +44,23 @@ make -j8
make install
cd ..
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 ..
# Install elf.h (for elf2flt)
mkdir -p $PREFIX/include
cp $SRC/elf.h $PREFIX/include/
@ -68,11 +85,13 @@ make
make install
cd ..
fi
# 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
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
# Build host-based components
mkdir -p build-host
@ -82,14 +101,23 @@ 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
for arch in m68k powerpc; 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
# Build target-based components
# Build target-based components for 68K
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
# 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

View File

@ -0,0 +1,2 @@
# Nothing platform-specific to do for now.
# All the basic setup is in retroppc.toolchain.cmake

View File

@ -0,0 +1,32 @@
# Copyright 2012 Wolfgang Thaller.
#
# 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/>.
set( CMAKE_SYSTEM_NAME RetroPPC )
set( CMAKE_SYSTEM_VERSION 1)
set( RETRO68_ROOT "@RETRO68_ROOT@" CACHE PATH "path to root of Retro68 Toolchain" )
set( CMAKE_INSTALL_PREFIX "${RETRO68_ROOT}/powerpc-apple-macos/" CACHE PATH "installation prefix" )
set( MAKE_PEF "@CMAKE_BINARY_DIR@/PEFTools/MakePEF" )
set( MAKE_IMPORT "@CMAKE_BINARY_DIR@/PEFTools/MakeImport" )
set( REZ "@CMAKE_BINARY_DIR@/Rez/Rez" )
set( REZ_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/RIncludes" )
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" )
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" )
list( APPEND CMAKE_MODULE_PATH "@CMAKE_SOURCE_DIR@/cmake" )

View File

@ -145,10 +145,12 @@
builtin_define ("__ppc__"); \
builtin_define ("__POWERPC__"); \
builtin_define ("__NATURAL_ALIGNMENT__"); \
builtin_define ("__APPLE__"); \
builtin_assert ("system=macos"); \
builtin_assert ("cpu=powerpc"); \
builtin_assert ("machine=powerpc"); \
builtin_assert ("cpu=m68k"); \
builtin_assert ("machine=m68k"); \
builtin_define("pascal="); \
builtin_define("__IEEE_BIG_ENDIAN"); \
} \
while (0)

View File

@ -15,13 +15,20 @@ cat > $OUT/ConditionalMacros.h <<END_MARKER
#ifndef __CONDITIONALMACROS__WRAP__
#define __CONDITIONALMACROS__WRAP__
#if #cpu(powerpc)
#define TARGET_CPU_PPC 1
#define TARGET_OS_MAC 1
#define TARGET_RT_MAC_CFM 1
#define TARGET_RT_MAC_MACHO 0
#else
#define TARGET_CPU_68K 1
#define TARGET_OS_MAC 1
#define TARGET_RT_MAC_CFM 0
#define TARGET_RT_MAC_MACHO 0
#define TYPE_LONGLONG 1
#define pascal __attribute__((__pascal__))
#endif
#define FUNCTION_PASCAL 1
#define TYPE_LONGLONG 1
#ifdef __cplusplus
#define TYPE_BOOL 1
#endif