]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Initial patch to build Tor with msvc and nmake
authorNick Mathewson <nickm@torproject.org>
Mon, 1 Aug 2011 16:36:59 +0000 (12:36 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 1 Aug 2011 16:36:59 +0000 (12:36 -0400)
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
Makefile.nmake [new file with mode: 0644]
changes/nmake [new file with mode: 0644]
src/common/Makefile.am
src/common/Makefile.nmake [new file with mode: 0644]
src/common/torgzip.c
src/common/util.c
src/or/Makefile.am
src/or/Makefile.nmake [new file with mode: 0644]
src/or/networkstatus.c
src/win32/orconfig.h

index 0daca63e95a23e4865eafffb7beb888614a3b559..cd0d8833c6e6a161b61c02de309393a097e3ebe9 100644 (file)
@@ -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 (file)
index 0000000..425f1ec
--- /dev/null
@@ -0,0 +1,5 @@
+all:\r
+       cd src/common\r
+       $(MAKE) /F Makefile.nmake\r
+       cd ../../src/or\r
+       $(MAKE) /F Makefile.nmake\r
diff --git a/changes/nmake b/changes/nmake
new file mode 100644 (file)
index 0000000..47f4f8f
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor features (build compatibility):
+    - Limited, experimental support for building with nmake and MSVC.
+
index 48218491b5dd327e408e7a9a47ff5a4daa1b8ba8..2244fe58d32dbf86f08888518225f3dccc12219c 100644 (file)
@@ -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 (file)
index 0000000..c8b5988
--- /dev/null
@@ -0,0 +1,20 @@
+all: libor.lib libor-crypto.lib libor-event.lib\r
+\r
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include\r
+\r
+LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \\r
+       log.obj memarea.obj mempool.obj procmon.obj util.obj \\r
+       util_codedigest.obj\r
+\r
+LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj\r
+\r
+LIBOR_EVENT_OBJECTS = compat_libevent.obj\r
+\r
+libor.lib: $(LIBOR_OBJECTS)\r
+       lib $(LIBOR_OBJECTS) /out:libor.lib\r
+\r
+libor-crypto.lib: $(LIBOR_CRYPTO_OBJECTS)\r
+       lib $(LIBOR_CRYPTO_OBJECTS) /out:libor-crypto.lib\r
+\r
+libor-event.lib:  $(LIBOR_EVENT_OBJECTS)\r
+       lib $(LIBOR_EVENT_OBJECTS) /out:libor-event.lib\r
index 2937c67de27e8bc5c80e2a735fd57bd8e253c952..ae7d7cfc09f99527bba41bbdba5230add2f2db57 100644 (file)
 #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. */
index 15b6e7130efb1a6a274035abf50bd17ef1c03d48..601f2be3e2cb9e83219b09df57edaf8ede6242da 100644 (file)
@@ -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
index 344e63ff8773079586d94a6e74dc0988930176d8..e2a1b6d64939546494c1ac046e4a0cc083714438 100644 (file)
@@ -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 (file)
index 0000000..919edbb
--- /dev/null
@@ -0,0 +1,28 @@
+all: tor.exe\r
+\r
+CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common\r
+\r
+LIBS = ..\..\..\build-alpha\lib\libevent.a \\r
+ ..\..\..\build-alpha\lib\libcrypto.a \\r
+ ..\..\..\build-alpha\lib\libssl.a \\r
+ ..\..\..\build-alpha\lib\libz.a \\r
+ ws2_32.lib advapi32.lib shell32.lib\r
+\r
+LIBTOR_OBJECTS = buffers.obj circuitbuild.obj circuitlist.obj circuituse.obj \\r
+       command.obj config.obj connection.obj connection_edge.obj \\r
+       connection_or.obj control.obj cpuworker.obj directory.obj \\r
+       dirserv.obj dirvote.obj dns.obj dnsserv.obj geoip.obj \\r
+       hibernate.obj main.obj microdesc.obj networkstatus.obj \\r
+       nodelist.obj onion.obj policies.obj reasons.obj relay.obj \\r
+       rendclient.obj rendcommon.obj rendmid.obj rendservice.obj \\r
+       rephist.obj router.obj routerlist.obj routerparse.obj status.obj \\r
+       config_codedigest.obj ntmain.obj\r
+\r
+libtor.lib: $(LIBTOR_OBJECTS)\r
+       lib $(LIBTOR_OBJECTS) /out:libtor.lib\r
+\r
+tor.exe: libtor.lib tor_main.obj\r
+       $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj\r
+\r
+clean:\r
+       del $(LIBTOR_OBJECTS) *.lib tor.exe\r
index 2586ce6ebe3f57099d89e668e03c371145e5f6b5..868c2a2a72ae4c7efefcb730619fb28b93dff2c3 100644 (file)
@@ -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;
index ed6da8eaef8ed31f1c0cf1b7eae9fc1940279256..cf493392efef84f31b5dc3c255c6b27c19dadff0 100644 (file)
 /* 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
 
 
 /* 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 ""