Skip to content

Commit 9715ede

Browse files
committed
Add DragonFly support to ldc
1 parent 5857cd8 commit 9715ede

6 files changed

Lines changed: 23 additions & 8 deletions

File tree

dmd2/errors.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#endif
2222
#endif
2323

24-
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
24+
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun
2525
#include <stdlib.h>
2626
#include <unistd.h>
2727
#include <string.h>
@@ -64,7 +64,7 @@ bool isConsoleColorSupported()
6464
{
6565
#if _WIN32
6666
return _isatty(_fileno(stderr)) != 0;
67-
#elif __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
67+
#elif __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun
6868
const char *term = getenv("TERM");
6969
return isatty(STDERR_FILENO) && term && term[0] && 0 != strcmp(term, "dumb");
7070
#else

dmd2/mars.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <string>
1818
#include <cstdarg>
1919

20-
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
20+
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun
2121
#include <errno.h>
2222
#endif
2323

dmd2/root/port.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,10 @@ int Port::isNan(double r)
774774
#else
775775
return __inline_isnan(r);
776776
#endif
777-
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
777+
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__
778778
return isnan(r);
779+
#elif__DragonFly__
780+
return __isnand(r);
779781
#else
780782
#undef isnan
781783
return std::isnan(r);
@@ -790,8 +792,10 @@ int Port::isNan(longdouble r)
790792
#else
791793
return __inline_isnan(r);
792794
#endif
793-
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
795+
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__
794796
return isnan(r);
797+
#elif__DragonFly__
798+
return __isnanl(r);
795799
#else
796800
#undef isnan
797801
return std::isnan(r);
@@ -818,8 +822,10 @@ int Port::isInfinity(double r)
818822
{
819823
#if __APPLE__
820824
return fpclassify(r) == FP_INFINITE;
821-
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
825+
#elif __HAIKU__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__
822826
return isinf(r);
827+
#elif__DragonFly__
828+
return __isinfd(r);
823829
#else
824830
#undef isinf
825831
return std::isinf(r);
@@ -833,7 +839,7 @@ longdouble Port::sqrt(longdouble x)
833839

834840
longdouble Port::fmodl(longdouble x, longdouble y)
835841
{
836-
#if __FreeBSD__ && __FreeBSD_version < 800000 || __OpenBSD__ || __NetBSD__ || __DragonFly__
842+
#if __FreeBSD__ && __FreeBSD_version < 800000 || __OpenBSD__ || __NetBSD__
837843
return ::fmod(x, y); // hack for now, fix later
838844
#else
839845
return std::fmod(x, y);

runtime/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ else()
8585
endif()
8686
file(GLOB_RECURSE CORE_D_UNIX ${RUNTIME_DIR}/src/core/sys/posix/*.d)
8787
file(GLOB_RECURSE CORE_D_FREEBSD ${RUNTIME_DIR}/src/core/sys/freebsd/*.d)
88+
file(GLOB_RECURSE CORE_D_DRAGONFLYBSD ${RUNTIME_DIR}/src/core/sys/dragonflybsd/*.d)
8889
file(GLOB_RECURSE CORE_D_NETBSD ${RUNTIME_DIR}/src/core/sys/netbsd/*.d)
8990
file(GLOB_RECURSE CORE_D_LINUX ${RUNTIME_DIR}/src/core/sys/linux/*.d)
9091
file(GLOB_RECURSE CORE_D_OSX ${RUNTIME_DIR}/src/core/sys/osx/*.d)
@@ -100,6 +101,10 @@ if(UNIX)
100101
if(${CMAKE_SYSTEM} MATCHES "NetBSD")
101102
list(APPEND CORE_D_SYS ${CORE_D_NETBSD})
102103
endif()
104+
if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
105+
message(WARNING, "Adding /src/core/sys/dragonflybsd/ ${CORE_D_DRAGONFLYBSD}")
106+
list(APPEND CORE_D_SYS ${CORE_D_DRAGONFLYBSD})
107+
endif()
103108
if(${CMAKE_SYSTEM} MATCHES "Linux")
104109
list(APPEND CORE_D_SYS ${CORE_D_LINUX})
105110
endif()

tests/d2/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if(${ptr_size} MATCHES "^4$")
55
elseif(${ptr_size} MATCHES "^8$")
66
set(host_model 64)
77
endif()
8+
find_program (GNUMAKE NAMES gmake make)
89

910
function(add_testsuite config_name dflags model)
1011
set(name dmd-testsuite${config_name})
@@ -17,7 +18,7 @@ function(add_testsuite config_name dflags model)
1718
# testsuite build system provides no way to run the test cases with a
1819
# given set of flags without trying all combinations of them.
1920
add_test(NAME ${name}
20-
COMMAND make -k -C ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite RESULTS_DIR=${outdir} DMD=$<TARGET_FILE:ldmd2> DFLAGS=${dflags} MODEL=${model} quick
21+
COMMAND ${GNUMAKE} -k -C ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite RESULTS_DIR=${outdir} DMD=$<TARGET_FILE:ldmd2> DFLAGS=${dflags} MODEL=${model} quick
2122
)
2223
set_tests_properties(${name} PROPERTIES DEPENDS clean-${name})
2324
endfunction()

tests/d2/src/osmodel.mak

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ifeq (,$(OS))
1515
ifeq (OpenBSD,$(uname_S))
1616
OS:=openbsd
1717
endif
18+
ifeq (DragonFly,$(uname_S))
19+
OS:=dragonflybsd
20+
endif
1821
ifeq (Solaris,$(uname_S))
1922
OS:=solaris
2023
endif

0 commit comments

Comments
 (0)