FreeBSD build platform support. Original patches courtesy of
Samuel Rodriguez Perez, somewhat hacked by myself. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19392 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+10
-1
@@ -294,7 +294,7 @@ HOST_UNARFLAGS ?= x ;
|
|||||||
# check the host platform compatibility
|
# check the host platform compatibility
|
||||||
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux freebsd ;
|
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux freebsd ;
|
||||||
|
|
||||||
if $(HOST_PLATFORM) = linux {
|
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd {
|
||||||
# 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 ;
|
||||||
@@ -422,6 +422,11 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
|||||||
HOST_LIBSUPC++ = supc++ ;
|
HOST_LIBSUPC++ = supc++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Unlike glibc FreeBSD's libc doesn't have built-in regex support.
|
||||||
|
if $(HOST_PLATFORM) = freebsd {
|
||||||
|
HOST_LIBROOT += /usr/lib/libgnuregex.so ;
|
||||||
|
}
|
||||||
|
|
||||||
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
|
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
|
||||||
# build platform we need to make sure, this is also defined.
|
# build platform we need to make sure, this is also defined.
|
||||||
if $(HOST_CPU) = x86 {
|
if $(HOST_CPU) = x86 {
|
||||||
@@ -465,6 +470,10 @@ if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
|||||||
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
|
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add directory with system headers we need when building something for the host
|
||||||
|
# platform, e.g. containing missing POSIX/GNU headers.
|
||||||
|
HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ;
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ extern ssize_t read_pos(int fd, off_t pos, void *buffer, size_t count);
|
|||||||
extern ssize_t write_pos(int fd, off_t pos, const void *buffer,size_t count);
|
extern ssize_t write_pos(int fd, off_t pos, const void *buffer,size_t count);
|
||||||
|
|
||||||
|
|
||||||
// There's no O_NOTRAVERSE under Linux, but there's a O_NOFOLLOW, which
|
// There's no O_NOTRAVERSE under Linux and FreeBSD, but there's a O_NOFOLLOW, which
|
||||||
// means something different (open() fails when the file is a symlink), but
|
// means something different (open() fails when the file is a symlink), but
|
||||||
// we can abuse this flag for our purposes (we filter it in libroot).
|
// we can abuse this flag for our purposes (we filter it in libroot).
|
||||||
#ifndef O_NOTRAVERSE
|
#ifndef O_NOTRAVERSE
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _HAIKU_BUILD_COMPATIBILITY_FREEBSD_ENDIAN
|
||||||
|
#define _HAIKU_BUILD_COMPATIBILITY_FREEBSD_ENDIAN
|
||||||
|
|
||||||
|
// There's no <endian.h> in FreeBSD, but <sys/endian.h>. And the macro naming
|
||||||
|
// differs.
|
||||||
|
|
||||||
|
#include <sys/endian.h>
|
||||||
|
|
||||||
|
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||||
|
#define __BIG_ENDIAN _BIG_ENDIAN
|
||||||
|
#define __PDP_ENDIAN _PDP_ENDIAN
|
||||||
|
#define BYTE_ORDER _BYTE_ORDER
|
||||||
|
|
||||||
|
#endif // _HAIKU_BUILD_COMPATIBILITY_FREEBSD_ENDIAN
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _HAIKU_BUILD_COMPATIBILITY_FREEBSD_REGEX
|
||||||
|
#define _HAIKU_BUILD_COMPATIBILITY_FREEBSD_REGEX
|
||||||
|
|
||||||
|
// There's no <regex.h> in FreeBSD, but <gnu/regex.h>.
|
||||||
|
|
||||||
|
#include <gnu/regex.h>
|
||||||
|
|
||||||
|
#endif // _HAIKU_BUILD_COMPATIBILITY_FREEBSD_REGEX
|
||||||
@@ -80,13 +80,21 @@ init_error_map()
|
|||||||
ADD_ERROR(EDQUOT);
|
ADD_ERROR(EDQUOT);
|
||||||
ADD_ERROR(EIDRM);
|
ADD_ERROR(EIDRM);
|
||||||
ADD_ERROR(EMULTIHOP);
|
ADD_ERROR(EMULTIHOP);
|
||||||
ADD_ERROR(ENODATA);
|
#ifdef ENODATA
|
||||||
|
ADD_ERROR(ENODATA);
|
||||||
|
#endif
|
||||||
ADD_ERROR(ENOLINK);
|
ADD_ERROR(ENOLINK);
|
||||||
ADD_ERROR(ENOSR);
|
#ifdef ENOSR
|
||||||
ADD_ERROR(ENOSTR);
|
ADD_ERROR(ENOSR);
|
||||||
|
#endif
|
||||||
|
#ifdef ENOSTR
|
||||||
|
ADD_ERROR(ENOSTR);
|
||||||
|
#endif
|
||||||
ADD_ERROR(ENOTSUP);
|
ADD_ERROR(ENOTSUP);
|
||||||
ADD_ERROR(EPROTO);
|
ADD_ERROR(EPROTO);
|
||||||
ADD_ERROR(ETIME);
|
#ifdef ETIME
|
||||||
|
ADD_ERROR(ETIME);
|
||||||
|
#endif
|
||||||
ADD_ERROR(ETXTBSY);
|
ADD_ERROR(ETXTBSY);
|
||||||
ADD_ERROR(ENOMEM);
|
ADD_ERROR(ENOMEM);
|
||||||
ADD_ERROR(EACCES);
|
ADD_ERROR(EACCES);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ rule ISAPnPHeaderGen
|
|||||||
|
|
||||||
actions ISAPnPHeaderGen1
|
actions ISAPnPHeaderGen1
|
||||||
{
|
{
|
||||||
grep '^PNP[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] ' $(2[1]) | awk -f $(2[2]) > $(1) ;
|
grep '^PNP[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] ' $(2[1]) | gawk -f $(2[2]) > $(1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ISAPnPHeaderGen [ FGristFiles isapnpids.h ] : isapnp_devids.txt : devlist2h.awk ;
|
ISAPnPHeaderGen [ FGristFiles isapnpids.h ] : isapnp_devids.txt : devlist2h.awk ;
|
||||||
@@ -33,7 +33,7 @@ rule USBHeaderGen
|
|||||||
|
|
||||||
actions USBHeaderGen1
|
actions USBHeaderGen1
|
||||||
{
|
{
|
||||||
awk -v HEADERFILE=$(1[1]) -v DATAFILE=$(1[2]) -f $(2[2]) $(2[1])
|
gawk -v HEADERFILE=$(1[1]) -v DATAFILE=$(1[2]) -f $(2[2]) $(2[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
USBHeaderGen [ FGristFiles usbdevs.h usbdevs_data.h ] : usbdevs : usb_devlist2h.awk ;
|
USBHeaderGen [ FGristFiles usbdevs.h usbdevs_data.h ] : usbdevs : usb_devlist2h.awk ;
|
||||||
@@ -51,7 +51,7 @@ rule PCIHeaderGen
|
|||||||
|
|
||||||
actions PCIHeaderGen1
|
actions PCIHeaderGen1
|
||||||
{
|
{
|
||||||
awk -v HEADERFILE=$(1) -f $(2[2]) $(2[1])
|
gawk -v HEADERFILE=$(1) -f $(2[2]) $(2[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
PCIHeaderGen [ FGristFiles pcihdr.h ] : pci.ids : pci-header.awk ;
|
PCIHeaderGen [ FGristFiles pcihdr.h ] : pci.ids : pci-header.awk ;
|
||||||
|
|||||||
@@ -51,6 +51,19 @@ typedef struct iovec iovec;
|
|||||||
# include <image.h> /* for a few typedefs */
|
# include <image.h> /* for a few typedefs */
|
||||||
# include <Drivers.h> /* for various ioctl structs, etc */
|
# include <Drivers.h> /* for various ioctl structs, etc */
|
||||||
# include <iovec.h> /* because we're boneheads sometimes */
|
# include <iovec.h> /* because we're boneheads sometimes */
|
||||||
|
#elif HAIKU_HOST_PLATFORM_FREEBSD
|
||||||
|
/* BSD Compilant stat.h */
|
||||||
|
# define __BSD_VISIBLE 1
|
||||||
|
#undef __XSI_VISIBLE
|
||||||
|
# define __XSI_VISIBLE 1
|
||||||
|
/* for mknod */
|
||||||
|
# define __POSIX_VISIBLE 200112
|
||||||
|
/* for S_ISLNK, S_ISSOCK and lstat */
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <sys/uio.h>
|
||||||
|
# include <image.h> /* for a few typedefs */
|
||||||
|
# include <Drivers.h> /* for various ioctl structs, etc */
|
||||||
|
typedef unsigned long ulong;
|
||||||
#else
|
#else
|
||||||
# include <sys/uio.h>
|
# include <sys/uio.h>
|
||||||
# include <image.h> /* for a few typedefs */
|
# include <image.h> /* for a few typedefs */
|
||||||
|
|||||||
@@ -55,8 +55,12 @@ static error_entry sErrors[] = {
|
|||||||
{ FS_ENXIO, ENXIO },
|
{ FS_ENXIO, ENXIO },
|
||||||
{ FS_ESPIPE, ESPIPE },
|
{ FS_ESPIPE, ESPIPE },
|
||||||
{ FS_ESRCH, ESRCH },
|
{ FS_ESRCH, ESRCH },
|
||||||
// { FS_EFPOS, EFPOS },
|
#ifdef EFPOS
|
||||||
// { FS_ESIGPARM, ESIGPARM },
|
{ FS_EFPOS, EFPOS },
|
||||||
|
#endif
|
||||||
|
#ifdef ESIGPARM
|
||||||
|
{ FS_ESIGPARM, ESIGPARM },
|
||||||
|
#endif
|
||||||
{ FS_EDOM, EDOM },
|
{ FS_EDOM, EDOM },
|
||||||
{ FS_ERANGE, ERANGE },
|
{ FS_ERANGE, ERANGE },
|
||||||
{ FS_EPROTOTYPE, EPROTOTYPE },
|
{ FS_EPROTOTYPE, EPROTOTYPE },
|
||||||
@@ -93,13 +97,21 @@ static error_entry sErrors[] = {
|
|||||||
{ FS_EDQUOT, EDQUOT },
|
{ FS_EDQUOT, EDQUOT },
|
||||||
{ FS_EIDRM, EIDRM },
|
{ FS_EIDRM, EIDRM },
|
||||||
{ FS_EMULTIHOP, EMULTIHOP },
|
{ FS_EMULTIHOP, EMULTIHOP },
|
||||||
{ FS_ENODATA, ENODATA },
|
#ifdef ENODATA
|
||||||
|
{ FS_ENODATA, ENODATA },
|
||||||
|
#endif
|
||||||
{ FS_ENOLINK, ENOLINK },
|
{ FS_ENOLINK, ENOLINK },
|
||||||
{ FS_ENOSR, ENOSR },
|
#ifdef ENOSR
|
||||||
{ FS_ENOSTR, ENOSTR },
|
{ FS_ENOSR, ENOSR },
|
||||||
|
#endif
|
||||||
|
#ifdef ENOSTR
|
||||||
|
{ FS_ENOSTR, ENOSTR },
|
||||||
|
#endif
|
||||||
{ FS_ENOTSUP, ENOTSUP },
|
{ FS_ENOTSUP, ENOTSUP },
|
||||||
{ FS_EPROTO, EPROTO },
|
{ FS_EPROTO, EPROTO },
|
||||||
{ FS_ETIME, ETIME },
|
#ifdef ETIME
|
||||||
|
{ FS_ETIME, ETIME },
|
||||||
|
#endif
|
||||||
{ FS_ETXTBSY, ETXTBSY },
|
{ FS_ETXTBSY, ETXTBSY },
|
||||||
|
|
||||||
{ FS_ENOMEM, ENOMEM },
|
{ FS_ENOMEM, ENOMEM },
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ get_external_command(const char *prompt, char *input, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the len of the command
|
// get the len of the command
|
||||||
int commandLen = strnlen(message.command, sizeof(message.command)) + 1;
|
message.command[sizeof(message.command) - 1] = '\0';
|
||||||
|
int commandLen = strlen(message.command) + 1;
|
||||||
if (commandLen <= 1) {
|
if (commandLen <= 1) {
|
||||||
fprintf(stderr, "No command given.\n");
|
fprintf(stderr, "No command given.\n");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ SEARCH_SOURCE
|
|||||||
USES_BE_API on <build>makebootable = true ;
|
USES_BE_API on <build>makebootable = true ;
|
||||||
|
|
||||||
local hostPlatformSources ;
|
local hostPlatformSources ;
|
||||||
if $(HOST_PLATFORM) = linux {
|
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd {
|
||||||
hostPlatformSources = PartitionMap.cpp PartitionMapParser.cpp ;
|
hostPlatformSources = PartitionMap.cpp PartitionMapParser.cpp ;
|
||||||
|
|
||||||
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel
|
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel
|
||||||
|
|||||||
Reference in New Issue
Block a user