Commit 1e7f14be authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

ninja.recipe: Fix build and install on MinGW/Windows

parent df36d7bf
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil
class Recipe(recipe.Recipe):
name = 'ninja'
......@@ -8,6 +7,7 @@ class Recipe(recipe.Recipe):
btype = BuildType.CUSTOM
stype = SourceType.TARBALL
url = 'https://github.com/ninja-build/ninja/archive/v%(version)s.tar.gz'
patches = ['ninja/0001-configure.py-Look-for-cl.exe-before-assuming-MSVC.patch']
deps = []
files_bin = ['bin/ninja']
......@@ -16,10 +16,8 @@ class Recipe(recipe.Recipe):
shell.call('./configure.py --bootstrap', self.build_dir)
def install(self):
try:
os.remove(os.path.join (self.config.prefix, "bin", "ninja"))
except OSError:
pass
shutil.move(os.path.join(self.build_dir, "ninja"),
os.path.join (self.config.prefix, "bin"))
ninja = 'ninja'
if self.platform == Platform.WINDOWS:
ninja += '.exe'
os.replace(os.path.join(self.build_dir, ninja),
os.path.join (self.config.prefix, "bin", ninja))
From b6784276d7ccea28ab1a5d5936f98b8342e8eb57 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 16 May 2018 13:32:14 +0530
Subject: [PATCH] configure.py: Look for cl.exe before assuming MSVC
Cerbero uses Native-Windows Python with MinGW which gets detected
incorrectly.
---
configure.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.py b/configure.py
index a443748..a627f46 100644
--- a/configure.py
+++ b/configure.py
@@ -27,6 +27,7 @@ import pipes
import string
import subprocess
import sys
+import shutil
sourcedir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(sourcedir, 'misc'))
@@ -53,7 +54,10 @@ class Platform(object):
elif self._platform.startswith('mingw'):
self._platform = 'mingw'
elif self._platform.startswith('win'):
- self._platform = 'msvc'
+ if shutil.which('cl'):
+ self._platform = 'msvc'
+ else:
+ self._platform = 'mingw'
elif self._platform.startswith('bitrig'):
self._platform = 'bitrig'
elif self._platform.startswith('netbsd'):
--
2.12.2.windows.2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment