Skip to content

Commit

Permalink
Add some support for NetBSD
Browse files Browse the repository at this point in the history
ghewgill committed Feb 22, 2024
1 parent 11c9640 commit 43de4ec
Showing 5 changed files with 51 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .builds/netbsd-latest-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
image: netbsd/latest
packages:
- cmake
# optional
#- openjdk8
#- mono
#- node
#- rust
#- go (cannot find main module)
sources:
- https://git.sr.ht/~ghewgill/neon-lang
triggers:
- action: email
condition: failure
to: ~ghewgill/neon-builds@lists.sr.ht
tasks:
- prep: |
sudo ln -s python3.10 /usr/pkg/bin/python3
cd neon-lang
git submodule deinit .
- build: |
cd neon-lang
cmake .
cmake --build .
- test: |
cd neon-lang
echo NOT RUNNING: ctest
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -387,7 +387,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
lib/time_posix.cpp
lib/time_darwin.cpp
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set(platform_executor
src/rtl_posix.cpp
lib/file_posix.cpp
@@ -488,7 +488,7 @@ endif (WIN32)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_link_libraries(executor dl)
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
target_link_libraries(executor pthread)
endif ()

5 changes: 4 additions & 1 deletion exec/cnex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
lib/random_posix.c
lib/runtime_posix.c
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
# Not all flavors of Linx will have the function clock_gettime(), and some have it in a different include.
# See exec/cnex/lib/time_linux.c for more information.
include(CheckSymbolExists)
@@ -155,4 +155,7 @@ else (WIN32)
target_link_libraries(test_string_support m)
target_link_libraries(test_number_to_string_c m)
target_link_libraries(test_path_support m)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
target_link_libraries(cnex pthread)
endif ()
endif (WIN32)
18 changes: 17 additions & 1 deletion external/libbid.cmake
Original file line number Diff line number Diff line change
@@ -13,7 +13,23 @@ if (NOT EXISTS external/IntelRDFPMathLib20U2)
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error extracting archive")
message(FATAL_ERROR "Fatal error patching file")
endif ()
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
execute_process(
COMMAND perl -p -i -e "s/unsigned short int fexcept_t/unsigned int fexcept_t/" external/IntelRDFPMathLib20U2/LIBRARY/src/bid_functions.h
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error patching file")
endif ()
execute_process(
COMMAND sh -c "(echo '#include <unistd.h>' && cat external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h) >external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h.new && mv external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h.new external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h"
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error patching file")
endif ()
endif ()
endif ()
2 changes: 1 addition & 1 deletion external/minizip.cmake
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ add_library(minizip
minizip11/zip.c
${minizip_platform}
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set_source_files_properties(minizip11/ioapi.c PROPERTIES COMPILE_DEFINITIONS "fopen64=fopen;fseeko64=fseeko;ftello64=ftello")
endif ()
target_include_directories(minizip

0 comments on commit 43de4ec

Please sign in to comment.