Adapt the build of the network libraries to the different target platforms. If we compile for Haiku we don't want select for example as we have it in libroot, but we need it under R5.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2005-04-09 16:10:09 +00:00
parent a5ff23c727
commit 22f72496d9
13 changed files with 72 additions and 33 deletions
+5 -6
View File
@@ -1,19 +1,18 @@
BIND 9.2.3 ported to OpenBeOS
BIND 9.2.3 ported to Haiku
This file contains important information for developers who want to port BIND to OpenBeOS.
This file contains important information for developers who want to port BIND to Haiku.
I created config.h, port_before.h, and port_after.h with the BIND configure script and fixed some mistakes that the script made.
Our private folder are:
headers (some headers are not defined in OpenBeOS)
src (functions that are not part of OpenBeOS, e.g.: strsep)
headers (some headers are not defined in Haiku)
src (functions that are not part of Haiku, e.g.: strsep)
Porting issues:
BIND wants to include sys/un.h and utmp.h. We do not have these, so I put empty headers into the private headers folder.
strsep() is not defined although we #define NEED_STRSEP in port_after.h. I put it in our private src folder.
OpenBeOS defines pselect(), but we turned NEEDS_PSELECT in port_after.h on because it is not present in BeOS.
As long as we do not have a working kernel this should be #define'd. When we can do a real OpenBeOS port we should #undef it again.
Haiku defines pselect(), we turn on NEEDS_PSELECT in port_after.h only if we compile for BeOS.
Added sources for compatibility:
src/res_resultcodes.c: BONE's host command wants _res_resultcodes to be defined
+7 -2
View File
@@ -28,6 +28,12 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) resolv ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
}
if ( $(TARGET_PLATFORM) = haiku ) {
PLATFORM_LIBS = libroot.so libbe.so ;
} else {
PLATFORM_LIBS = root be ;
}
SharedLibrary "bind" :
# dst
@@ -176,8 +182,7 @@ SharedLibrary "bind" :
;
LinkSharedOSLibs libbind.so :
root
be # BeOS defines syslog in libbe.so
$(PLATFORM_LIBS)
libsocket.so
libnet.so # for gethostname()
;
+1 -1
View File
@@ -63,7 +63,7 @@ gai_strerror(int ecode) {
#ifdef DO_PTHREADS
if (!once) {
// OpenBeOS compatibility: this is a function call, thus it must be
// Haiku compatibility: this is a function call, thus it must be
// initialized here and not at when allocating 'lock'
lock = PTHREAD_MUTEX_INITIALIZER;
+6 -4
View File
@@ -9,17 +9,19 @@
#include <sys/bitypes.h>
#endif
// OpenBeOS does not have these error codes
// Haiku does not have these error codes
#define ETOOMANYREFS B_ERROR
// OpenBeOS fd_set has 'bits' instead of 'fds_bits'
// Haiku fd_set has 'bits' instead of 'fds_bits'
#define fds_bits bits
// OpenBeOS does have pselect, but as long as we compile for BeOS we turn this on
// Haiku does have pselect, turn this on only when we're not compiling Haiku
#ifndef __HAIKU__
#define NEED_PSELECT 1
#define pselect isc__pselect
#endif
// OpenBeOS has problems with datagram sockets
// Haiku has problems with datagram sockets
// #define CANNOT_CONNECT_DGRAM 1
#define HAVE_SA_LEN 1
+1 -1
View File
@@ -19,7 +19,7 @@ struct timezone; /* silence warning */
#undef BSD_COMP
// OpenBeOS pthread support
// Haiku pthread support
#define DO_PTHREADS 1
#include <pthread_emu.h>
+20 -6
View File
@@ -7,8 +7,10 @@ UsePrivateHeaders net ;
# Default libs include BeOS R5 libnet.so, something we don't want here!
LINKFLAGS on libnet.so = [ on libnet.so return $(LINKFLAGS) ] -nodefaultlibs ;
local defines = BUILDING_R5_LIBNET ;
if $(BONE_VERSION) {
local defines ;
if ( $(TARGET_PLATFORM) = r5 ) {
defines += BUILDING_R5_LIBNET ;
} else if ( $(TARGET_PLATFORM) = bone ) {
defines += BONE_VERSION ;
}
defines = [ FDefines $(defines) ] ;
@@ -18,10 +20,22 @@ UsePrivateHeaders net ;
Depends libnet.so : install_network_etc_files ;
if ( $(TARGET_PLATFORM) = r5 ) {
PLATFORM_SOURCES =
socket.c
select.c
poll.c
;
PLATFORM_LIBS = ;
} else {
# under Haiku and BONE we don't need the above
# because they are in libsocket.so or libroot.so
PLATFORM_SOURCES = ;
PLATFORM_LIBS = libsocket.so ;
}
SharedLibrary net :
socket.c
select.c
poll.c
$(PLATFORM_SOURCES)
compat.c
arc4random.c
base64.c
@@ -59,7 +73,7 @@ SharedLibrary net :
res_send.c
sethostent.c
: libroot.so
: libroot.so $(PLATFORM_LIBS)
;
OBOSInstall install_network_etc_files : [ FDirName $(OBOS_ETC_DIR) ] :
+1 -1
View File
@@ -1,4 +1,4 @@
# OpenBeOS /etc/networks
# Haiku /etc/networks
#
# Internet networks (from nic.ddn.mil)
+2 -3
View File
@@ -1,8 +1,8 @@
#include <unistd.h>
#include <fcntl.h>
#include "sys/select.h"
#include <sys/select.h>
#include "poll.h"
#include <poll.h>
// -------------------------------
int poll(struct pollfd *fds, nfds_t numfds, int timeout)
@@ -58,4 +58,3 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
return rc;
}
+1 -1
View File
@@ -1,4 +1,4 @@
# resolv.conf for OpenBeOS
# resolv.conf for Haiku
#
# We lookup in the /etc/hosts file first, then we do a bind lookup
lookup file bind
+1 -1
View File
@@ -177,4 +177,4 @@ error:
return n;
}
#endif
#endif // !BONE_VERSION
+11 -2
View File
@@ -2,14 +2,23 @@ SubDir OBOS_TOP src kits network libnetapi ;
UsePrivateHeaders net ;
SubDirC++Flags -DBUILDING_R5_LIBNET ;
{
if ( $(TARGET_PLATFORM) = r5 ) {
defines = [ FDefines BUILDING_R5_LIBNET ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
PLATFORM_LIBS = ;
} else {
PLATFORM_LIBS = libsocket.so ;
}
}
SharedLibrary netapi :
NetEndpoint.cpp
NetAddress.cpp
NetBuffer.cpp
NetDebug.cpp
: be libnet.so
: be libnet.so $(PLATFORM_LIBS)
;
# Installation -- in the test directory for the time being
+15 -4
View File
@@ -5,9 +5,11 @@ UsePrivateHeaders net ;
{
# Default libs include BeOS R5 libnet.so, something we don't want here!
LINKFLAGS on libsocket.so = [ on libsocket.so return $(LINKFLAGS) ] -nodefaultlibs ;
local defines ;
if $(BONE_VERSION) {
if ( $(TARGET_PLATFORM) = r5 ) {
defines += BUILDING_R5_LIBNET ;
} else if ( $(TARGET_PLATFORM) = bone ) {
defines += BONE_VERSION ;
}
defines = [ FDefines $(defines) ] ;
@@ -15,10 +17,19 @@ UsePrivateHeaders net ;
SubDirC++Flags $(defines) ;
}
if ( $(TARGET_PLATFORM) = bone ) {
PLATFORM_SOURCES =
select.c
;
} else {
# under Haiku we don't need the above
# because it's in libroot.so
PLATFORM_SOURCES = ;
}
SharedLibrary socket :
socket.c
select.c
$(PLATFORM_SOURCES)
: root
;
+1 -1
View File
@@ -176,4 +176,4 @@ error:
return n;
}
#endif
#endif // !BONE_VERSION