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.
This commit is contained in:
Nick Mathewson 2011-08-01 12:36:59 -04:00
parent 9d77f24cf5
commit e802199cb3
11 changed files with 72 additions and 16 deletions

View File

@ -15,6 +15,7 @@ EXTRA_DIST = \
ChangeLog \
INSTALL \
LICENSE \
Makefile.nmake \
README \
ReleaseNotes \
tor.spec \

5
Makefile.nmake Normal file
View File

@ -0,0 +1,5 @@
all:
cd src/common
$(MAKE) /F Makefile.nmake
cd ../../src/or
$(MAKE) /F Makefile.nmake

3
changes/nmake Normal file
View File

@ -0,0 +1,3 @@
o Minor features (build compatibility):
- Limited, experimental support for building with nmake and MSVC.

View 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

20
src/common/Makefile.nmake Normal file
View File

@ -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

View File

@ -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. */

View 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

View 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=

28
src/or/Makefile.nmake Normal file
View File

@ -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

View 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;

View File

@ -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 ""