libretro: use separate library file names for Carbon and Classic PPC

This commit is contained in:
Wolfgang Thaller 2018-05-16 02:07:24 +02:00
parent bf9cba16b8
commit a135f0b196
4 changed files with 16 additions and 5 deletions

View File

@ -494,6 +494,11 @@ for arch in $ARCHS; do
"$PREFIX/bin/${arch}-apple-macos-ar" cqs "$PREFIX/${arch}-apple-macos/lib/libretrocrt.a"
fi
done
if [ ! -e "$PREFIX/powerpc-apple-macos/lib/libretrocrt-carbon.a" ]; then
echo "Creating dummy libretrocrt-carbon.a for $arch..."
"$PREFIX/bin/powerpc-apple-macos-ar" cqs "$PREFIX/powerpc-apple-macos/lib/libretrocrt-carbon.a"
fi
# the real libretrocrt.a is built and installed by
# `cmake --build build-target --target install` later

View File

@ -169,9 +169,9 @@
%{shared:-bM:SRE}"
#define LIB_SPEC "-lc"
#define LIBGCC_SPEC "-lgcc -lretrocrt -lgcc %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib}"
#define LIBGCC_SPEC "-lgcc %{carbon: -lretrocrt-carbon} %{!carbon: -lretrocrt} -lgcc %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib}"
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group -lgcc -lc -lretrocrt %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib} --end-group"
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group -lgcc -lc %{carbon: -lretrocrt-carbon} %{!carbon: -lretrocrt} %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib} --end-group"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC ""

View File

@ -78,3 +78,9 @@ set_target_properties(retrocrt
COMPILE_OPTIONS -ffunction-sections)
install(TARGETS retrocrt DESTINATION lib)
# different library name for Carbon
# (Carbon shares the powerpc-apple-macos/ directory with Classic PPC)
if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
set_target_properties(retrocrt PROPERTIES OUTPUT_NAME retrocrt-carbon)
endif()

View File

@ -85,17 +85,17 @@ ssize_t _read_r(struct _reent *reent, int fd, void *buf, size_t count)
int _open_r(struct _reent *reent, const char* name, int flags, int mode)
{
Str255 pname;
/*#if TARGET_API_MAC_CARBON
#if TARGET_API_MAC_CARBON
// Carbon has the new, sane version.
c2pstrcpy(pname,name);
#else*/
#else
// It is also availble in various glue code libraries and
// in some versions of InterfaceLib, but it's confusing.
// Using the inplace variant, c2pstr, isn't much better than
// doing things by hand:
strncpy(&pname[1],name,255);
pname[0] = strlen(name);
//#endif
#endif
short ref;
SInt8 permission;