From 8bee40dca483d6bd1225be92a7a04ba5c4e97e5c Mon Sep 17 00:00:00 2001 From: Artur Jarosik Date: Wed, 16 Nov 2022 13:01:02 +0100 Subject: [PATCH] Fix amiga build (#5479) --- .circleci/config.yml | 2 +- CMake/platforms/amiga.cmake | 2 +- Packaging/amiga/prep.sh | 2 +- Source/utils/paths.cpp | 4 ++++ Source/utils/sdl2_to_1_2_backports.cpp | 12 ++++++++---- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c9c95245..8da708a32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: steps: - checkout - run: Packaging/amiga/prep.sh - - run: PKG_CONFIG_PATH=/opt/m68k-amigaos/lib/pkgconfig/:/opt/m68k-amigaos/share/pkgconfig/ cmake -S. -Bbuild -DM68K_CPU=68040 -DM68K_FPU=hard -DM68K_COMMON="-s -ffast-math -O3 -noixemul -D__BIG_ENDIAN__ -D__AMIGA__ -fpermissive" .. + - run: PKG_CONFIG_PATH=/opt/m68k-amigaos/lib/pkgconfig/:/opt/m68k-amigaos/share/pkgconfig/ cmake -S. -Bbuild -DM68K_CPU=68040 -DM68K_FPU=hard -DM68K_COMMON="-s -fbbb=- -m68040 -ffast-math -O2 -noixemul -D__BIG_ENDIAN__ -D__AMIGA__ -fpermissive" .. - run: cd build && make -j2 - store_artifacts: {path: ./build/devilutionx, destination: devilutionx_m68k} vita: diff --git a/CMake/platforms/amiga.cmake b/CMake/platforms/amiga.cmake index f086527f6..e70d89d3b 100644 --- a/CMake/platforms/amiga.cmake +++ b/CMake/platforms/amiga.cmake @@ -20,7 +20,7 @@ add_definitions(-Dfseeko=fseek) list(APPEND DEVILUTIONX_PLATFORM_LINK_LIBRARIES ZLIB::ZLIB) if(NOT WARPOS) - list(APPEND DEVILUTIONX_PLATFORM_LINK_LIBRARIES -ldebug) + list(APPEND DEVILUTIONX_PLATFORM_LINK_LIBRARIES -ldebug -noixemul) endif() file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Packaging/amiga/devilutionx.info" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Packaging/amiga/prep.sh b/Packaging/amiga/prep.sh index 548c2e75c..f3186b1b9 100755 --- a/Packaging/amiga/prep.sh +++ b/Packaging/amiga/prep.sh @@ -9,7 +9,7 @@ export SYSROOT=/opt/$TARGET export M68K_CPU=68040 export M68K_FPU=hard export M68K_CPU_FPU="-m${M68K_CPU} -m${M68K_FPU}-float" -export M68K_COMMON="-s -ffast-math -fomit-frame-pointer" +export M68K_COMMON="-s -ffast-math -fomit-frame-pointer -fbbb=-" export M68K_CFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}" export M68K_CXXFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}" diff --git a/Source/utils/paths.cpp b/Source/utils/paths.cpp index 4f813bc10..823b4d867 100644 --- a/Source/utils/paths.cpp +++ b/Source/utils/paths.cpp @@ -88,9 +88,11 @@ const std::string &PrefPath() prefPath = NxdkGetPrefPath(); #else prefPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); +#if !defined(__amigaos__) if (FileExistsAndIsWriteable("diablo.ini")) { prefPath = std::string("." DIRECTORY_SEPARATOR_STR); } +#endif #endif } return *prefPath; @@ -105,9 +107,11 @@ const std::string &ConfigPath() configPath = NxdkGetPrefPath(); #else configPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); +#if !defined(__amigaos__) if (FileExistsAndIsWriteable("diablo.ini")) { configPath = std::string("." DIRECTORY_SEPARATOR_STR); } +#endif #endif } return *configPath; diff --git a/Source/utils/sdl2_to_1_2_backports.cpp b/Source/utils/sdl2_to_1_2_backports.cpp index ba1098383..7e4879de2 100644 --- a/Source/utils/sdl2_to_1_2_backports.cpp +++ b/Source/utils/sdl2_to_1_2_backports.cpp @@ -696,7 +696,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) #else namespace { -#if !defined(__QNXNTO__) +#if !defined(__QNXNTO__) && !defined(__amigaos__) char *readSymLink(const char *path) { // From sdl2-2.0.9/src/filesystem/unix/SDL_sysfilesystem.c @@ -778,8 +778,9 @@ char *SDL_GetBasePath() #endif #if defined(__3DS__) retval = SDL_strdup("file:sdmc:/3ds/devilutionx/"); - return retval; -#endif +#elif defined(__amigaos__) + retval = SDL_strdup("PROGDIR:"); +#else /* is a Linux-style /proc filesystem available? */ if (!retval && (access("/proc", F_OK) == 0)) { @@ -826,7 +827,7 @@ char *SDL_GetBasePath() if (ptr != NULL) retval = ptr; /* oh well if it failed. */ } - +#endif return retval; } @@ -849,6 +850,9 @@ char *SDL_GetPrefPath(const char *org, const char *app) #if defined(__3DS__) retval = SDL_strdup("sdmc:/3ds/devilutionx/"); return retval; +#elif defined(__amigaos__) + retval = SDL_strdup("PROGDIR:"); + return retval; #endif if (!app) {