[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tlsdate/debian-master] Add build support for Haiku and perhaps BeOS; needs testing
commit f0f17b98fa4c2a5a20a255be4b631d9e3d8bf704
Author: Jacob Appelbaum <jacob@xxxxxxxxxxxxx>
Date: Wed Apr 24 04:08:57 2013 -0700
Add build support for Haiku and perhaps BeOS; needs testing
---
INSTALL | 8 ++++++++
configure.ac | 20 ++++++++++++++++++++
m4/ax_platform.m4 | 4 ++++
src/compat/clock.h | 2 ++
src/compat/include.am | 4 ++++
src/conf.c | 4 ++++
src/include.am | 24 ++++++++++++++++++++++++
src/tlsdate-helper.h | 4 ++++
src/util.h | 4 ++++
9 files changed, 74 insertions(+)
diff --git a/INSTALL b/INSTALL
index 67554ae..170ad24 100644
--- a/INSTALL
+++ b/INSTALL
@@ -33,6 +33,7 @@ ports of tlsdate or for tlsdate integration on the following Operating Systems:
Currently porting is in progress or partially documented for:
Plan9 (with APE)
+ Haiku
Building and install of tlsdate on GNU/Linux and FreeBSD:
@@ -110,6 +111,13 @@ On Plan9 the start of building might look something like this:
/n/sources/contrib/fgb/root/rc/bin/contrib/install fgb/openssl
mk install
+On Haiku we must use gcc4:
+
+ export CC=/boot/develop/abi/x86/gcc4/tools/gcc4.6.3-haiku-121101/bin/gcc
+ export LDFLAGS="$LDFLAGS -lbsd"
+ ./configure
+ make
+
OpenBSD builds from source and is not yet in the port system:
export AUTOCONF_VERSION=<your installed version>
diff --git a/configure.ac b/configure.ac
index 696f8c4..b3e7df1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,6 +290,26 @@ case "$host" in
[""|yes|no], [UNPRIV_GROUP="nogroup"],
[*], [UNPRIV_GROUP=$with_unpriv_group])
AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
+ ;;
+ *-beos*|*-haiku*)
+ dnl This is for BeOS and Haiku; we probably only support Haiku with gcc4
+ dnl Check for clock_gettime. Some systems put it into -lc, while
+ dnl others use -lrt. Try the first and fallback to the latter.
+ dnl on Haiku we require the bsd library for strsep
+ RT_LIB=
+ AC_CHECK_FUNC([clock_gettime], [:],
+ [AC_CHECK_LIB([rt], [clock_gettime], [RT_LIB="-lrt"],
+ [AC_MSG_ERROR([Your system lacks clock_gettime])])])
+ AC_SUBST(RT_LIB)
+ AC_ARG_WITH([unpriv-group],
+ [AS_HELP_STRING([--with-unpriv-group=<group>],
+ [Group to drop privs to @<:@default: nogroup@:>@])])
+ AS_CASE([$with_unpriv_group],
+ [""|yes|no], [UNPRIV_GROUP="nogroup"],
+ [*], [UNPRIV_GROUP=$with_unpriv_group])
+ AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
+ LDFLAGS="$LDFLAGS -lbsd"
+ CC="/boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/bin/gcc"
case "$host" in
*-linux-androideabi)
dnl This is for Android NDK as it is a special case of linux
diff --git a/m4/ax_platform.m4 b/m4/ax_platform.m4
index c613206..baffd1e 100644
--- a/m4/ax_platform.m4
+++ b/m4/ax_platform.m4
@@ -50,6 +50,9 @@
[*cygwin*],
[TARGET_CYGWIN="true"
AC_DEFINE([TARGET_OS_CYGWIN],[1],[Whether we build for Cygwin])],
+ [*haiku*],
+ [TARGET_HAIKU="true"
+ AC_DEFINE([TARGET_OS_HAIKU],[1],[Whether we build for Haiku])],
[*freebsd*],
[TARGET_OS_FREEBSD="true"
AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])],
@@ -75,6 +78,7 @@
AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"])
AM_CONDITIONAL([TARGET_CYGWIN],[test "x${TARGET_CYGWIN}" = "xtrue"])
+ AM_CONDITIONAL([TARGET_HAIKU],[test "x${TARGET_HAIKU}" = "xtrue"])
AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"])
AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"])
AM_CONDITIONAL([TARGET_FREEBSD],[test "x${TARGET_OS_FREEBSD}" = "xtrue"])
diff --git a/src/compat/clock.h b/src/compat/clock.h
index 7040d3c..e8220bd 100644
--- a/src/compat/clock.h
+++ b/src/compat/clock.h
@@ -36,6 +36,8 @@ struct tlsdate_time {
mach_timespec_t tp;
#elif _WIN32
void *tp;
+#elif TARGET_OS_HAIKU
+ struct timespec tp;
#elif TARGET_OS_CYGWIN
struct timespec tp;
#endif
diff --git a/src/compat/include.am b/src/compat/include.am
index b168c3a..9623362 100644
--- a/src/compat/include.am
+++ b/src/compat/include.am
@@ -44,4 +44,8 @@ if TARGET_CYGWIN
src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
endif
+if TARGET_HAIKU
+src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
+endif
+
src_compat_libtlsdate_compat_la_LIBADD+= @RT_LIB@
diff --git a/src/conf.c b/src/conf.c
index 607f523..6182650 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -23,6 +23,10 @@
#include "src/common/android.h" // XXX: Dirty hack - make this more generic later
#endif
+#ifdef TARGET_OS_HAIKU
+#include "src/common/android.h" // XXX: Dirty hack - make this more generic later
+#endif
+
#ifdef HAVE_ANDROID
#include "src/common/android.h"
#endif
diff --git a/src/include.am b/src/include.am
index c5ea63b..0ec38b2 100644
--- a/src/include.am
+++ b/src/include.am
@@ -107,6 +107,17 @@ check_PROGRAMS+= src/conf_unittest
noinst_PROGRAMS+= src/conf_unittest
endif
+if TARGET_HAIKU
+bin_PROGRAMS+= src/tlsdate
+bin_PROGRAMS+= src/tlsdate-helper
+
+src_conf_unittest_SOURCES = src/conf.c
+src_conf_unittest_SOURCES+= src/conf-unittest.c
+src_conf_unittest_SOURCES+= src/common/android.c
+check_PROGRAMS+= src/conf_unittest
+noinst_PROGRAMS+= src/conf_unittest
+endif
+
if TARGET_OSX
bin_PROGRAMS+= src/tlsdate
bin_PROGRAMS+= src/tlsdate-helper
@@ -268,6 +279,19 @@ noinst_PROGRAMS+= src/proxy-bio_unittest
endif
endif
+if TARGET_HAIKU
+if !POLARSSL
+src_proxy_bio_unittest_LDADD = @SSL_LIBS@
+src_proxy_bio_unittest_SOURCES = src/proxy-bio.c
+src_proxy_bio_unittest_SOURCES+= src/proxy-bio-unittest.c
+src_proxy_bio_unittest_SOURCES+= src/test-bio.c
+src_proxy_bio_unittest_SOURCES+= src/util.c
+src_proxy_bio_unittest_SOURCES+= src/common/android.c
+check_PROGRAMS+= src/proxy-bio_unittest
+noinst_PROGRAMS+= src/proxy-bio_unittest
+endif
+endif
+
# We're not shipping headers
noinst_HEADERS+= src/routeup.h
noinst_HEADERS+= src/test_harness.h
diff --git a/src/tlsdate-helper.h b/src/tlsdate-helper.h
index f3af23d..2456efc 100644
--- a/src/tlsdate-helper.h
+++ b/src/tlsdate-helper.h
@@ -14,6 +14,10 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
+#ifdef TARGET_OS_HAIKU
+#include <posix/string.h>
+#include <bsd/string.h>
+#endif
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/src/util.h b/src/util.h
index 7d7cb11..bfd61dd 100644
--- a/src/util.h
+++ b/src/util.h
@@ -12,6 +12,10 @@
#include <string.h>
#include <stdlib.h>
+#ifdef TARGET_OS_HAIKU
+#include <stdarg.h>
+#endif
+
#define API __attribute__((visibility("default")))
extern int verbose;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits