summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.py23
-rwxr-xr-xconfigure.py2
-rw-r--r--src/getopt.c12
-rw-r--r--src/lexer.cc1
-rw-r--r--src/lexer.h5
-rw-r--r--src/lexer.in.cc1
6 files changed, 31 insertions, 13 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 4d2b4be..6a7d876 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -43,8 +43,9 @@ except OSError, e:
with open('src/browse.py') as browse_py:
with open('build/browse_py.h', 'w') as browse_py_h:
- run(['./src/inline.sh', 'kBrowsePy'],
- stdin=browse_py, stdout=browse_py_h)
+ hex_str = ''.join([hex(ord(c)) for c in browse_py.read()])
+ src = "const char %s[]=\"\n%s\n\";" % ('kBrowsePy', hex_str)
+ browse_py_h.write(src)
sources = []
for src in glob.glob('src/*.cc'):
@@ -52,7 +53,7 @@ for src in glob.glob('src/*.cc'):
continue
if sys.platform.startswith('win32'):
- if src.endswith('/browse.cc') or src.endswith('/subprocess.cc'):
+ if src.endswith('\\browse.cc') or src.endswith('\\subprocess.cc'):
continue
else:
if src.endswith('-win32.cc'):
@@ -60,15 +61,25 @@ for src in glob.glob('src/*.cc'):
sources.append(src)
-args = [os.environ.get('CXX', 'g++'), '-Wno-deprecated',
- '-DNINJA_PYTHON="' + sys.executable + '"']
+if sys.platform.startswith('win32'):
+ sources.append('src/getopt.c')
+
+vcdir = os.environ.get('VCINSTALLDIR')
+if vcdir:
+ args = [os.path.join(vcdir, 'bin', 'cl.exe'), '/nologo', '/EHsc', '/DWIN32']
+else:
+ args = [os.environ.get('CXX', 'g++'), '-Wno-deprecated',
+ '-DNINJA_PYTHON="' + sys.executable + '"']
args.extend(cflags)
args.extend(ldflags)
binary = 'ninja.bootstrap'
if sys.platform.startswith('win32'):
binary = 'ninja.bootstrap.exe'
-args.extend(['-o', binary])
args.extend(sources)
+if vcdir:
+ args.extend(['/link', '/out:' + binary])
+else:
+ args.extend(['-o', binary])
run(args)
print 'Building ninja using itself...'
diff --git a/configure.py b/configure.py
index 4b3579d..48ccae9 100755
--- a/configure.py
+++ b/configure.py
@@ -140,7 +140,7 @@ n.newline()
if platform == 'windows':
n.rule('cxx',
- command='$cxx $cflags -c $in /Fo $out',
+ command='$cxx $cflags -c $in /Fo$out',
depfile='$out.d',
description='CXX $out')
else:
diff --git a/src/getopt.c b/src/getopt.c
index 0dbe6a5..1e3c09d 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -396,17 +396,17 @@ getopt (int argc, char **argv, char *optstring)
}
int
-getopt_long (int argc, char **argv, char *shortopts,
- GETOPT_LONG_OPTION_T * longopts, int *longind)
+getopt_long (int argc, char **argv, const char *shortopts,
+ const GETOPT_LONG_OPTION_T * longopts, int *longind)
{
- return getopt_internal (argc, argv, shortopts, longopts, longind, 0);
+ return getopt_internal (argc, argv, (char*)shortopts, (GETOPT_LONG_OPTION_T*)longopts, longind, 0);
}
int
-getopt_long_only (int argc, char **argv, char *shortopts,
- GETOPT_LONG_OPTION_T * longopts, int *longind)
+getopt_long_only (int argc, char **argv, const char *shortopts,
+ const GETOPT_LONG_OPTION_T * longopts, int *longind)
{
- return getopt_internal (argc, argv, shortopts, longopts, longind, 1);
+ return getopt_internal (argc, argv, (char*)shortopts, (GETOPT_LONG_OPTION_T*)longopts, longind, 1);
}
/* end of file GETOPT.C */
diff --git a/src/lexer.cc b/src/lexer.cc
index d3ef43f..75b91e7 100644
--- a/src/lexer.cc
+++ b/src/lexer.cc
@@ -18,6 +18,7 @@
#include <stdio.h>
#include "eval_env.h"
+#include "util.h"
bool Lexer::Error(const string& message, string* err) {
// Compute line/column.
diff --git a/src/lexer.h b/src/lexer.h
index 40e602a..c872b98 100644
--- a/src/lexer.h
+++ b/src/lexer.h
@@ -14,6 +14,11 @@
#include "string_piece.h"
+// Windows may #define ERROR.
+#ifdef ERROR
+#undef ERROR
+#endif
+
struct EvalString;
struct Lexer {
diff --git a/src/lexer.in.cc b/src/lexer.in.cc
index 4d6d132..c0c197b 100644
--- a/src/lexer.in.cc
+++ b/src/lexer.in.cc
@@ -17,6 +17,7 @@
#include <stdio.h>
#include "eval_env.h"
+#include "util.h"
bool Lexer::Error(const string& message, string* err) {
// Compute line/column.