[tor-commits] [tlsdate/master] Add support for building with Cygwin CYGWIN_NT-6.1 1.7.18(0.263/5/3)

ioerror at torproject.org ioerror at torproject.org
Wed Apr 24 03:35:33 UTC 2013


commit 455a90cf939aee0cbeb8e4186f84771895bfa959
Author: Jacob Appelbaum <jacob at appelbaum.net>
Date:   Tue Apr 23 20:35:15 2013 -0700

    Add support for building with Cygwin CYGWIN_NT-6.1 1.7.18(0.263/5/3)
---
 INSTALL               |    6 ++++++
 autogen.sh            |    6 ++++++
 configure.ac          |   17 +++++++++++++++++
 m4/ax_platform.m4     |    2 +-
 src/compat/clock.h    |    2 ++
 src/compat/include.am |    4 ++++
 src/include.am        |   24 ++++++++++++++++++++++++
 7 files changed, 60 insertions(+), 1 deletions(-)

diff --git a/INSTALL b/INSTALL
index 5f34cd4..b0cc565 100644
--- a/INSTALL
+++ b/INSTALL
@@ -15,6 +15,7 @@ tlsdate should build and work on the following Operating Systems:
   OpenBSD 5.2
   Gentoo 20130413
   DragonFly BSD 3.3-DEVELOPMENT
+  Cygwin CYGWIN_NT-6.1 1.7.18(0.263/5/3)
 
 Please file a bug or email the tlsdate team if you have successfully built or
 use tlsdate on a platform that is not listed. We are specifically looking for
@@ -95,6 +96,11 @@ On Arch Linux there is a PKGBUILD in the Arch User Repository:
   https://aur.archlinux.org/packages/tlsdate
   https://aur.archlinux.org/packages/tl/tlsdate/PKGBUILD
 
+Cygwin requires that the user installs openssl-dev, gcc, pkg-config, libtool, automake, autoconf:
+
+  ./configure
+  make
+
 On Plan9 the start of building might look something like this:
 
   ip/ipconfig
diff --git a/autogen.sh b/autogen.sh
index 8981cef..51c926a 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -23,4 +23,10 @@ then
   export WARNINGS
 fi
 
+if [ $(uname) != "CYGWIN_NT-6.1" ];
+then
+  WARNINGS=""
+  export WARNINGS
+fi
+
 autoreconf --install --verbose --force
diff --git a/configure.ac b/configure.ac
index aa37bfa..696f8c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,6 +273,23 @@ case "$host" in
             [""|yes|no], [UNPRIV_GROUP="nogroup"],
             [*], [UNPRIV_GROUP=$with_unpriv_group])
     AC_DEFINE_UNQUOTED([UNPRIV_GROUP], ["${UNPRIV_GROUP}"], [Unprivileged group])
+    ;;
+  *-cygwin*)
+    dnl This is for Cygwin
+    dnl Check for clock_gettime.  Some systems put it into -lc, while
+    dnl others use -lrt.  Try the first and fallback to the latter.
+    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])
     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 172a4e5..c613206 100644
--- a/m4/ax_platform.m4
+++ b/m4/ax_platform.m4
@@ -47,7 +47,7 @@
 # define SHUT_RDWR SD_BOTH
 #endif
           ])],
-        [*CYGWIN_NT*],
+        [*cygwin*],
         [TARGET_CYGWIN="true"
         AC_DEFINE([TARGET_OS_CYGWIN],[1],[Whether we build for Cygwin])],
         [*freebsd*],
diff --git a/src/compat/clock.h b/src/compat/clock.h
index 2bcdb2e..7040d3c 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_CYGWIN
+    struct timespec tp;
 #endif
 };
 
diff --git a/src/compat/include.am b/src/compat/include.am
index 0713c14..b168c3a 100644
--- a/src/compat/include.am
+++ b/src/compat/include.am
@@ -40,4 +40,8 @@ endif
 endif
 endif
 
+if TARGET_CYGWIN
+src_compat_libtlsdate_compat_la_SOURCES+= src/compat/clock-linux.c
+endif
+
 src_compat_libtlsdate_compat_la_LIBADD+= @RT_LIB@
diff --git a/src/include.am b/src/include.am
index 38da0c7..c5ea63b 100644
--- a/src/include.am
+++ b/src/include.am
@@ -96,6 +96,17 @@ endif
 endif
 endif
 
+if TARGET_CYGWIN
+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
@@ -244,6 +255,19 @@ endif
 endif
 endif
 
+if TARGET_CYGWIN
+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



More information about the tor-commits mailing list