Portability fixes for Leopard and Tigerbrew
I ran into some issues on Leopard PPC 10.5.8 with a fresh tigerbrew install, but was able to work around them. Maybe these tips can help fix the official build process for older Macs, or help someone else get it working with these hacks.
First, Retro68 wants cmake 3.9, but tigerbrew provides cmake 3.6.3. I assume this requirement is just to allow C++17 (as my cmake complained about not knowing the CXX17 flags) so I was able to make progress by dropping to C++14.
Lines 18 and 20 modified in CMakeLists.txt:
cmake_minimum_required(VERSION 3.6.3)
set(CMAKE_CXX_STANDARD 14)
Lines 104 and 145 modified in LaunchAPPL/Server/CMakeLists.txt:
CXX_STANDARD 14
Then, while building SharedFile.cc.o I ran into error: 'ofstream' is not a member of 'fs' and error: 'ifstream' is not a member of 'fs'. I see that tigerbrew's version of boost/filesystem.hpp does not include fstream.hpp, so I included this explicitly.
Line 9 added to LaunchAPPL/Client/SharedFile.cc:
#include <boost/filesystem/fstream.hpp>
Building LaunchAPPLServer.cc.obj, I ran into error: cannot convert 'int' to 'AppStatus' in initialization. Easily fixed with a cast.
Line 299 modified in LaunchAAPL/Server/LaunchAPPLServer.cc:
AppStatus readyState{ (AppStatus)( (int)AppStatus::readyModem + (int)gPrefs.port - (int)Port::modemPort ) };
Then it got a bit messy. While linking ConsoleTest.xcoff, I ran into powerpc-apple-macos/bin/ld: cannot find -lInterfaceLib. I ran into the same when attempting to run a Makefile of mine with CC=powerpc-apple-macos-gcc, as well as missing -lretrocrt. I'm not sure my solution is ideal, but it works; modify the -L paths for where you put Retro68:
$ powerpc-apple-macos-gcc -dumpspecs > toolchain/lib/gcc/powerpc-apple-macos/9.1.0/specs
$ edit toolchain/lib/gcc/powerpc-apple-macos/9.1.0/specs
Line 110 of specs under *link_libgcc: changed from %D to:
%D -L/Users/Raptor007/src/Retro68/ImportLibraries -L/Users/Raptor007/src/Retro68-build/build-target-ppc/libretro
Then I was able to complete the build-toolchain process, and it all seems to work! I can run the Carbon samples on Leopard, and the other 68K and PPC samples on OS 9.2.2.
Tigerbrew's CMake 3.6.3 also needs a small fix needed to avoid Unknown CMake command "target_link_options" in the shared library example.
Line 32 of Samples/SharedLibrary/CMakeLists.txt changed to:
set_target_properties(Library PROPERTIES LINK_FLAGS -Wl,-bE:${CMAKE_CURRENT_SOURCE_DIR}/library.exp)