[tor-commits] [tor/master] Initial patch to build Tor with msvc and nmake

nickm at torproject.org nickm at torproject.org
Mon Aug 1 16:39:02 UTC 2011


commit e802199cb3a2ebb4c09eaf4949e279acd3b46fc8
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Aug 1 12:36:59 2011 -0400

    Initial patch to build Tor with msvc and nmake
    
    We'll still need to tweak it so that it looks for includes and
    libraries somewhere more sensible than "where we happened to find
    them on Erinn's system"; so that tests and tools get built too;
    so that it's a bit documented; and so that we actually try running
    the output.
    
    Work done with Erinn Clark.
---
 Makefile.am               |    1 +
 Makefile.nmake            |    5 +++++
 changes/nmake             |    3 +++
 src/common/Makefile.am    |    2 +-
 src/common/Makefile.nmake |   20 ++++++++++++++++++++
 src/common/torgzip.c      |    4 ----
 src/common/util.c         |    6 +++---
 src/or/Makefile.am        |    2 +-
 src/or/Makefile.nmake     |   28 ++++++++++++++++++++++++++++
 src/or/networkstatus.c    |    7 -------
 src/win32/orconfig.h      |   10 ++++++++++
 11 files changed, 72 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0daca63..cd0d883 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,6 +15,7 @@ EXTRA_DIST = \
 	ChangeLog					\
 	INSTALL						\
 	LICENSE						\
+	Makefile.nmake					\
 	README						\
 	ReleaseNotes					\
 	tor.spec					\
diff --git a/Makefile.nmake b/Makefile.nmake
new file mode 100644
index 0000000..425f1ec
--- /dev/null
+++ b/Makefile.nmake
@@ -0,0 +1,5 @@
+all:
+	cd src/common
+	$(MAKE) /F Makefile.nmake
+	cd ../../src/or
+	$(MAKE) /F Makefile.nmake
diff --git a/changes/nmake b/changes/nmake
new file mode 100644
index 0000000..47f4f8f
--- /dev/null
+++ b/changes/nmake
@@ -0,0 +1,3 @@
+  o Minor features (build compatibility):
+    - Limited, experimental support for building with nmake and MSVC.
+
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 4821849..2244fe5 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -1,7 +1,7 @@
 
 noinst_LIBRARIES = libor.a libor-crypto.a libor-event.a
 
-EXTRA_DIST = common_sha1.i sha256.c
+EXTRA_DIST = common_sha1.i sha256.c Makefile.nmake
 
 #CFLAGS  = -Wall -Wpointer-arith -O2
 
diff --git a/src/common/Makefile.nmake b/src/common/Makefile.nmake
new file mode 100644
index 0000000..c8b5988
--- /dev/null
+++ b/src/common/Makefile.nmake
@@ -0,0 +1,20 @@
+all: libor.lib libor-crypto.lib libor-event.lib
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include
+
+LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \
+	log.obj memarea.obj mempool.obj procmon.obj util.obj \
+	util_codedigest.obj
+
+LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj
+
+LIBOR_EVENT_OBJECTS = compat_libevent.obj
+
+libor.lib: $(LIBOR_OBJECTS)
+	lib $(LIBOR_OBJECTS) /out:libor.lib
+
+libor-crypto.lib: $(LIBOR_CRYPTO_OBJECTS)
+	lib $(LIBOR_CRYPTO_OBJECTS) /out:libor-crypto.lib
+
+libor-event.lib:  $(LIBOR_EVENT_OBJECTS)
+	lib $(LIBOR_EVENT_OBJECTS) /out:libor-event.lib
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index 2937c67..ae7d7cf 100644
--- a/src/common/torgzip.c
+++ b/src/common/torgzip.c
@@ -43,11 +43,7 @@
 #define off64_t int64_t
 #endif
 
-#ifdef _MSC_VER
-#include "..\..\contrib\zlib\zlib.h"
-#else
 #include <zlib.h>
-#endif
 
 /** Set to 1 if zlib is a version that supports gzip; set to 0 if it doesn't;
  * set to -1 if we haven't checked yet. */
diff --git a/src/common/util.c b/src/common/util.c
index 15b6e71..601f2be 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -14,6 +14,9 @@
 #define _GNU_SOURCE
 
 #include "orconfig.h"
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
 #define UTIL_PRIVATE
 #include "util.h"
 #include "torlog.h"
@@ -68,9 +71,6 @@
 #ifdef HAVE_SYS_FCNTL_H
 #include <sys/fcntl.h>
 #endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index 344e63f..e2a1b6d 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -7,7 +7,7 @@ else
 tor_platform_source=
 endif
 
-EXTRA_DIST=ntmain.c or_sha1.i
+EXTRA_DIST=ntmain.c or_sha1.i Makefile.nmake
 
 if USE_EXTERNAL_EVDNS
 evdns_source=
diff --git a/src/or/Makefile.nmake b/src/or/Makefile.nmake
new file mode 100644
index 0000000..919edbb
--- /dev/null
+++ b/src/or/Makefile.nmake
@@ -0,0 +1,28 @@
+all: tor.exe
+
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common
+
+LIBS = ..\..\..\build-alpha\lib\libevent.a \
+ ..\..\..\build-alpha\lib\libcrypto.a \
+ ..\..\..\build-alpha\lib\libssl.a \
+ ..\..\..\build-alpha\lib\libz.a \
+ ws2_32.lib advapi32.lib shell32.lib
+
+LIBTOR_OBJECTS = buffers.obj circuitbuild.obj circuitlist.obj circuituse.obj \
+	command.obj config.obj connection.obj connection_edge.obj \
+	connection_or.obj control.obj cpuworker.obj directory.obj \
+	dirserv.obj dirvote.obj dns.obj dnsserv.obj geoip.obj \
+	hibernate.obj main.obj microdesc.obj networkstatus.obj \
+	nodelist.obj onion.obj policies.obj reasons.obj relay.obj \
+	rendclient.obj rendcommon.obj rendmid.obj rendservice.obj \
+	rephist.obj router.obj routerlist.obj routerparse.obj status.obj \
+	config_codedigest.obj ntmain.obj
+
+libtor.lib: $(LIBTOR_OBJECTS)
+	lib $(LIBTOR_OBJECTS) /out:libtor.lib
+
+tor.exe: libtor.lib tor_main.obj
+	$(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj
+
+clean:
+	del $(LIBTOR_OBJECTS) *.lib tor.exe
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 2586ce6..868c2a2 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -2006,13 +2006,6 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
                          tor_memcmp(rs->identity_digest,
                                router->cache_info.identity_digest, DIGEST_LEN),
   {
-#if 0
-    /* We have no routerstatus for this router. Clear flags and skip it. */
-    if (!authdir) {
-      if (router->purpose == ROUTER_PURPOSE_GENERAL)
-        router_clear_status_flags(router);
-    }
-#endif
   }) {
     /* We have a routerstatus for this router. */
     const char *digest = router->cache_info.identity_digest;
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index ed6da8e..cf49339 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -122,6 +122,7 @@
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #define HAVE_SYS_STAT_H
 
@@ -234,3 +235,12 @@
 
 /* Version number of package */
 #define VERSION "0.2.3.2-alpha-dev"
+
+
+
+#define HAVE_STRUCT_SOCKADDR_IN6
+#define HAVE_STRUCT_IN6_ADDR
+#define RSHIFT_DOES_SIGN_EXTEND
+#define FLEXIBLE_ARRAY_MEMBER 0
+#define HAVE_EVENT2_EVENT_H
+#define SHARE_DATADIR ""



More information about the tor-commits mailing list