build: Add NetBSD as a host platform
* NetBSD is very similar to FreeBSD * there is no libdl on NetBSD * packages live in /usr/pkg on NetBSD * the argument to tolower() must be representable as an unsigned char Change-Id: Icff569c4472f7e91edd0ce6d489affb04babde7c Reviewed-on: https://review.haiku-os.org/c/haiku/+/10130 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
0bd4842c05
commit
d29137917a
+16
-3
@@ -227,11 +227,12 @@ HOST_UNARFLAGS ?= x ;
|
|||||||
|
|
||||||
# check the host platform compatibility
|
# check the host platform compatibility
|
||||||
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
|
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
|
||||||
: linux openbsd freebsd darwin ;
|
: linux openbsd freebsd netbsd darwin ;
|
||||||
HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
|
HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
|
||||||
|
|
||||||
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|
||||||
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = openbsd {
|
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = openbsd
|
||||||
|
|| $(HOST_PLATFORM) = netbsd {
|
||||||
# don't use lex: otherwise rc will not work correctly
|
# don't use lex: otherwise rc will not work correctly
|
||||||
if $(LEX) = lex {
|
if $(LEX) = lex {
|
||||||
LEX = flex ;
|
LEX = flex ;
|
||||||
@@ -306,6 +307,7 @@ switch $(HOST_PLATFORM) {
|
|||||||
case haiku_host : hostDebugFlags ?= -ggdb ;
|
case haiku_host : hostDebugFlags ?= -ggdb ;
|
||||||
case linux : hostDebugFlags ?= -ggdb ;
|
case linux : hostDebugFlags ?= -ggdb ;
|
||||||
case freebsd : hostDebugFlags ?= -ggdb ;
|
case freebsd : hostDebugFlags ?= -ggdb ;
|
||||||
|
case netbsd : hostDebugFlags ?= -ggdb ;
|
||||||
case darwin : hostDebugFlags ?= -ggdb ;
|
case darwin : hostDebugFlags ?= -ggdb ;
|
||||||
case * : hostDebugFlags ?= -g ;
|
case * : hostDebugFlags ?= -g ;
|
||||||
}
|
}
|
||||||
@@ -374,7 +376,11 @@ if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
|
|||||||
HOST_CCFLAGS += $(compatibilityHeader) ;
|
HOST_CCFLAGS += $(compatibilityHeader) ;
|
||||||
HOST_C++FLAGS += $(compatibilityHeader) ;
|
HOST_C++FLAGS += $(compatibilityHeader) ;
|
||||||
} else {
|
} else {
|
||||||
HOST_LINKFLAGS += -lm -ldl ;
|
HOST_LINKFLAGS += -lm ;
|
||||||
|
# NetBSD doesn't have a separate libdl
|
||||||
|
if $(HOST_PLATFORM) != netbsd {
|
||||||
|
HOST_LINKFLAGS += -ldl ;
|
||||||
|
}
|
||||||
HOST_LIBSTDC++ = stdc++ ;
|
HOST_LIBSTDC++ = stdc++ ;
|
||||||
if $(HOST_PLATFORM) = darwin {
|
if $(HOST_PLATFORM) = darwin {
|
||||||
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
|
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
|
||||||
@@ -469,6 +475,12 @@ if $(HOST_PLATFORM) = freebsd {
|
|||||||
HOST_LINKFLAGS += -L/usr/local/lib ;
|
HOST_LINKFLAGS += -L/usr/local/lib ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $(HOST_PLATFORM) = netbsd {
|
||||||
|
# packages live in /usr/pkg on NetBSD
|
||||||
|
HOST_HDRS += /usr/pkg/include ;
|
||||||
|
HOST_LINKFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib ;
|
||||||
|
}
|
||||||
|
|
||||||
if $(HOST_PLATFORM) = darwin {
|
if $(HOST_PLATFORM) = darwin {
|
||||||
HOST_HDRS += [ FDirName $(HAIKU_TOP) src build libgnuregex ] ;
|
HOST_HDRS += [ FDirName $(HAIKU_TOP) src build libgnuregex ] ;
|
||||||
|
|
||||||
@@ -615,6 +627,7 @@ switch $(HOST_PLATFORM) {
|
|||||||
case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ;
|
case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ;
|
||||||
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
|
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
|
||||||
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
|
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
|
||||||
|
case netbsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_NETBSD ;
|
||||||
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
|
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ check_native_xattrs()
|
|||||||
xattr_set="xattr"; xattr_set_args="-w \$NAME \"\$VALUE\""
|
xattr_set="xattr"; xattr_set_args="-w \$NAME \"\$VALUE\""
|
||||||
xattr_get="xattr"; xattr_get_args="-p \$NAME"
|
xattr_get="xattr"; xattr_get_args="-p \$NAME"
|
||||||
;;
|
;;
|
||||||
freebsd)
|
freebsd|netbsd)
|
||||||
xattr_set="setextattr"; xattr_set_args="user \$NAME \"\$VALUE\""
|
xattr_set="setextattr"; xattr_set_args="user \$NAME \"\$VALUE\""
|
||||||
xattr_get="getextattr"; xattr_get_args="user \$NAME"
|
xattr_get="getextattr"; xattr_get_args="user \$NAME"
|
||||||
;;
|
;;
|
||||||
@@ -623,13 +623,14 @@ case "${platform}" in
|
|||||||
Haiku) HOST_PLATFORM=haiku_host ;;
|
Haiku) HOST_PLATFORM=haiku_host ;;
|
||||||
Linux) HOST_PLATFORM=linux ;;
|
Linux) HOST_PLATFORM=linux ;;
|
||||||
OpenBSD) HOST_PLATFORM=openbsd ;;
|
OpenBSD) HOST_PLATFORM=openbsd ;;
|
||||||
|
NetBSD) HOST_PLATFORM=netbsd ;;
|
||||||
*) echo Unsupported platform: ${platform}
|
*) echo Unsupported platform: ${platform}
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $HOST_PLATFORM in
|
case $HOST_PLATFORM in
|
||||||
darwin|freebsd|openbsd) statCmd='stat -f' ;;
|
darwin|freebsd|openbsd|netbsd) statCmd='stat -f' ;;
|
||||||
*) statCmd='stat -c' ;;
|
*) statCmd='stat -c' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# ensure git checkout was not done with a restrictive umask
|
# ensure git checkout was not done with a restrictive umask
|
||||||
@@ -1038,8 +1039,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $HOST_PLATFORM in
|
case $HOST_PLATFORM in
|
||||||
freebsd|openbsd) MAKE=gmake;;
|
freebsd|openbsd|netbsd) MAKE=gmake;;
|
||||||
*) MAKE=make;;
|
*) MAKE=make;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if ! valid_toolchain "${targetMachine}" "${crossToolsDir}" "${buildCrossTools}"; then
|
if ! valid_toolchain "${targetMachine}" "${crossToolsDir}" "${buildCrossTools}"; then
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ SubInclude HAIKU_TOP src build libshared ;
|
|||||||
SubInclude HAIKU_TOP src build libsolv ;
|
SubInclude HAIKU_TOP src build libsolv ;
|
||||||
SubInclude HAIKU_TOP src build libuuid ;
|
SubInclude HAIKU_TOP src build libuuid ;
|
||||||
|
|
||||||
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = freebsd {
|
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = freebsd ||
|
||||||
|
$(HOST_PLATFORM) = netbsd {
|
||||||
SubInclude HAIKU_TOP src build libgnuregex ;
|
SubInclude HAIKU_TOP src build libgnuregex ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
#if HAIKU_HOST_USE_XATTR_REF
|
#if HAIKU_HOST_USE_XATTR_REF
|
||||||
# if defined(HAIKU_HOST_PLATFORM_LINUX)
|
# if defined(HAIKU_HOST_PLATFORM_LINUX)
|
||||||
# include "fs_attr_xattr.h"
|
# include "fs_attr_xattr.h"
|
||||||
# elif defined(HAIKU_HOST_PLATFORM_FREEBSD)
|
# elif defined(HAIKU_HOST_PLATFORM_FREEBSD) \
|
||||||
|
|| defined(HAIKU_HOST_PLATFORM_NETBSD)
|
||||||
# include "fs_attr_extattr.h"
|
# include "fs_attr_extattr.h"
|
||||||
# elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
# elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
||||||
# include "fs_attr_bsdxattr.h"
|
# include "fs_attr_bsdxattr.h"
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
// Include the interface to the host platform attributes support.
|
// Include the interface to the host platform attributes support.
|
||||||
#if defined(HAIKU_HOST_PLATFORM_LINUX)
|
#if defined(HAIKU_HOST_PLATFORM_LINUX)
|
||||||
# include "fs_attr_xattr.h"
|
# include "fs_attr_xattr.h"
|
||||||
#elif defined(HAIKU_HOST_PLATFORM_FREEBSD)
|
#elif defined(HAIKU_HOST_PLATFORM_FREEBSD) \
|
||||||
|
|| defined(HAIKU_HOST_PLATFORM_NETBSD)
|
||||||
# include "fs_attr_extattr.h"
|
# include "fs_attr_extattr.h"
|
||||||
#elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
#elif defined(HAIKU_HOST_PLATFORM_DARWIN)
|
||||||
# include "fs_attr_bsdxattr.h"
|
# include "fs_attr_bsdxattr.h"
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ switch $(HOST_PLATFORM) {
|
|||||||
DEFINES += HAVE_STRCHRNUL HAVE_FOPENCOOKIE ;
|
DEFINES += HAVE_STRCHRNUL HAVE_FOPENCOOKIE ;
|
||||||
case freebsd :
|
case freebsd :
|
||||||
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN ;
|
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN ;
|
||||||
|
case netbsd :
|
||||||
|
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN ;
|
||||||
case darwin :
|
case darwin :
|
||||||
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN HAVE_QSORT_R ;
|
DEFINES += HAVE_STRCHRNUL HAVE_FUNOPEN HAVE_QSORT_R ;
|
||||||
case * :
|
case * :
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ to_lower(const char *str, std::string &result)
|
|||||||
if (str) {
|
if (str) {
|
||||||
result = "";
|
result = "";
|
||||||
for (int i = 0; i < (int)strlen(str); i++)
|
for (int i = 0; i < (int)strlen(str); i++)
|
||||||
result += tolower(str[i]);
|
result += tolower((unsigned char)str[i]);
|
||||||
} else
|
} else
|
||||||
result = "(null)";
|
result = "(null)";
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ to_lower(const char *str, char *result)
|
|||||||
if (str && result) {
|
if (str && result) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int)strlen(str); i++)
|
for (i = 0; i < (int)strlen(str); i++)
|
||||||
result[i] = tolower(str[i]);
|
result[i] = tolower((unsigned char)str[i]);
|
||||||
result[i] = 0;
|
result[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
# include <Drivers.h>
|
# include <Drivers.h>
|
||||||
#else
|
#else
|
||||||
# if defined(HAIKU_HOST_PLATFORM_FREEBSD) \
|
# if defined(HAIKU_HOST_PLATFORM_FREEBSD) \
|
||||||
|
|| defined(HAIKU_HOST_PLATFORM_NETBSD) \
|
||||||
|| defined(HAIKU_HOST_PLATFORM_DARWIN)
|
|| defined(HAIKU_HOST_PLATFORM_DARWIN)
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src bin keymap ] ;
|
|||||||
USES_BE_API on <build>keymap = true ;
|
USES_BE_API on <build>keymap = true ;
|
||||||
|
|
||||||
local regexLib ;
|
local regexLib ;
|
||||||
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = freebsd {
|
if $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = freebsd ||
|
||||||
|
$(HOST_PLATFORM) = netbsd {
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src build libgnuregex ] : true ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src build libgnuregex ] : true ;
|
||||||
regexLib = libgnuregex_build.so ;
|
regexLib = libgnuregex_build.so ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ SEARCH_SOURCE
|
|||||||
USES_BE_API on <build>makebootable = true ;
|
USES_BE_API on <build>makebootable = true ;
|
||||||
|
|
||||||
local hostPlatformSources ;
|
local hostPlatformSources ;
|
||||||
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd || $(HOST_PLATFORM) = darwin {
|
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd ||
|
||||||
|
$(HOST_PLATFORM) = netbsd || $(HOST_PLATFORM) = darwin {
|
||||||
UsePrivateHeaders interface ;
|
UsePrivateHeaders interface ;
|
||||||
|
|
||||||
hostPlatformSources = PartitionMap.cpp PartitionMapParser.cpp
|
hostPlatformSources = PartitionMap.cpp PartitionMapParser.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user