From 5ef6082e4229b85d47b1513f6abfde61e991bc81 Mon Sep 17 00:00:00 2001 From: Kelvin Lee Date: Sat, 1 Jun 2024 15:05:17 +1000 Subject: [PATCH] FreeBSD: Fix to build APPLEN --- source/CMakeLists.txt | 12 ++++++++++++ source/DiskImageHelper.cpp | 4 ++++ source/DiskImageHelper.h | 4 ++++ source/Tfe/DNS.cpp | 3 +++ source/Uthernet2.cpp | 3 +++ source/linux/network/portfwds.cpp | 3 +++ 6 files changed, 29 insertions(+) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index f51ba125a..8bfc32d41 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -250,10 +250,22 @@ target_include_directories(appleii PRIVATE ) # this one appears in header files +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") +# FreeBSD could already have "zip.h" (from libzip) in /usr/local/include +# which takes precedence than the one in /usr/local/include/minizip. +# "zip.h" from libzip is not what we want here. +# The following changes to use include path /usr/local/include for minizip +# so that the code can include "minizip/zip.h" explicitly. +target_include_directories(appleii PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} # for config.h + ${MINIZIP_INCLUDE_DIRS}/.. + ) +else() target_include_directories(appleii PUBLIC ${CMAKE_CURRENT_BINARY_DIR} # for config.h ${MINIZIP_INCLUDE_DIRS} ) +endif() target_link_libraries(appleii PRIVATE ${YAML_LIBRARIES} diff --git a/source/DiskImageHelper.cpp b/source/DiskImageHelper.cpp index b11c8ea98..4b96dcf21 100644 --- a/source/DiskImageHelper.cpp +++ b/source/DiskImageHelper.cpp @@ -34,7 +34,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Common.h" #include "zlib.h" +#ifdef __FreeBSD__ +#include "minizip/unzip.h" +#else #include "unzip.h" +#endif #include "CPU.h" #include "DiskImage.h" diff --git a/source/DiskImageHelper.h b/source/DiskImageHelper.h index 27dec852c..a0a79e29c 100644 --- a/source/DiskImageHelper.h +++ b/source/DiskImageHelper.h @@ -2,7 +2,11 @@ #include "DiskDefs.h" #include "DiskImage.h" +#ifdef __FreeBSD__ +#include "minizip/zip.h" +#else #include "zip.h" +#endif #define GZ_SUFFIX ".gz" #define GZ_SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) diff --git a/source/Tfe/DNS.cpp b/source/Tfe/DNS.cpp index 2bd8d9271..b3a28c4d2 100644 --- a/source/Tfe/DNS.cpp +++ b/source/Tfe/DNS.cpp @@ -26,6 +26,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include +#ifdef __FreeBSD__ +#include // AF_INET. +#endif #endif uint32_t getHostByName(const std::string & name) diff --git a/source/Uthernet2.cpp b/source/Uthernet2.cpp index 2c4e2bdd0..46b163372 100644 --- a/source/Uthernet2.cpp +++ b/source/Uthernet2.cpp @@ -76,6 +76,9 @@ typedef int socklen_t; #include #include #include +#ifdef __FreeBSD__ +#include // sockaddr_in. +#endif #endif diff --git a/source/linux/network/portfwds.cpp b/source/linux/network/portfwds.cpp index dd9190ede..86a67c572 100644 --- a/source/linux/network/portfwds.cpp +++ b/source/linux/network/portfwds.cpp @@ -8,6 +8,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include // sockaddr_in. +#endif namespace {