Skip to content

Commit

Permalink
tools: ninja: add ninja and bootstrap it at configure time
Browse files Browse the repository at this point in the history
- add ninja as submodule in tools/
- bootstrap ninja when configure is ran
- use ninja by default for all platforms

ninja rocks.
  • Loading branch information
philips committed Jun 10, 2012
1 parent 36b4c7a commit 0143008
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -9,3 +9,5 @@ options.gypi
*.xcodeproj
out/
*.swp
tools/ninja
ninja
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -22,3 +22,6 @@
[submodule "tools/gyp"]
path = tools/gyp
url = https://github.com/luvit/gyp.git
[submodule "tools/ninja"]
path = tools/ninja
url = https://github.com/luvit/ninja.git
11 changes: 0 additions & 11 deletions all.gyp

This file was deleted.

24 changes: 15 additions & 9 deletions configure
Expand Up @@ -165,24 +165,30 @@ def render_openssl_symlinks(src, dest):
# use copy2, so we preserve mtimes, reducing rebuilds
shutil.copy2(srcf, destf)

if sys.platform == "win32":
render_openssl_symlinks('deps/openssl/openssl/include/openssl',
'deps/openssl/openssl-configs/realized/openssl')
code = os.system("python tools\gyp_luvit -f msvs -G msvs_version=2010")
else:
def build_ninja():
if os.access("ninja", os.X_OK):
return 0
bootstrap_path = os.path.join("tools", "ninja", "bootstrap.py")
ninja_path = os.path.join("tools", "ninja", "ninja")
code = os.system("python %s" % bootstrap_path)
if code == 0:
shutil.copy2(ninja_path, "ninja")
return code

code = build_ninja()
if code == 0:
code = os.system("tools/gyp_luvit")

if code == 0:
print ""
print "Done!"
print "Done! Now run ninja to build"
print ""
if sys.platform == "win32":
print "Now run `python build.py` to build!"
print ".\ninja -C out\Debug"
else:
print "Now run `make -C out` to build!"
print "./ninja -C out/Debug"
print ""
else:
print ""
print "Error occured. Please investigate details above."
print ""

2 changes: 1 addition & 1 deletion deps/luajit
Submodule luajit updated from 018792 to 10b9ed
29 changes: 3 additions & 26 deletions tools/gyp_luvit
Expand Up @@ -23,17 +23,8 @@ def run_gyp(args):
if __name__ == '__main__':
args = sys.argv[1:]

# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
if sys.platform == 'win32':
args.append(os.path.join(src_root, 'all.gyp'))
common_fn = os.path.join(src_root, 'common.gypi')
options_fn = os.path.join(src_root, 'options.gypi')
else:
args.append(os.path.join(os.path.abspath(src_root), 'all.gyp'))
common_fn = os.path.join(os.path.abspath(src_root), 'common.gypi')
options_fn = os.path.join(os.path.abspath(src_root), 'options.gypi')
common_fn = os.path.join(src_root, 'common.gypi')
options_fn = os.path.join(src_root, 'options.gypi')

if os.path.exists(common_fn):
args.extend(['-I', common_fn])
Expand All @@ -43,21 +34,7 @@ if __name__ == '__main__':

args.append('--depth=' + src_root)

if sys.platform == "darwin":
args.extend(['-f', 'make'])
args.extend(['-f', 'xcode'])

# There's a bug with windows which doesn't allow this feature.
if sys.platform != 'win32':

# Tell gyp to write the Makefiles into output_dir
args.extend(['--generator-output', output_dir])

# Tell make to write its output into the same dir
args.extend(['-Goutput_dir=' + output_dir])

if sys.platform == 'win32':
args.extend(['-Gmsvs_version=2010'])
args.extend(['--format=ninja'])

args.append('-Dcomponent=static_library')
args.append('-Dlibrary=static_library')
Expand Down
1 change: 1 addition & 0 deletions tools/ninja
Submodule ninja added at 9cd14a

0 comments on commit 0143008

Please sign in to comment.