Skip to content

Commit 6809143

Browse files
committed
a little better jslibsconstruct
1 parent 67b3df2 commit 6809143

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

jslib-sconstruct

+31-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# -*- mode: python; -*-
2+
# scons file to build spidermonkey
3+
# experimental
4+
#
5+
16
import os
27
import subprocess
38

@@ -44,22 +49,39 @@ coreFiles = [ "jsapi.c" ,
4449
"jsxml.c" ,
4550
"prmjtime.c" ]
4651

52+
4753
force64 = GetOption( "force64" ) is not None
4854

4955
msarch = None
5056
if force64:
5157
msarch = "amd64"
5258

59+
5360
env = Environment( MSVS_ARCH=msarch )
5461
nix = False
5562

63+
5664
def findVersion( root , choices ):
57-
for c in choices:
58-
if ( os.path.exists( root + c ) ):
59-
return root + c
60-
raise "can't find a version of [" + root + "] choices: " + choices
65+
if not isinstance(root, list):
66+
root = [root]
67+
for r in root:
68+
for c in choices:
69+
if ( os.path.exists( r + c ) ):
70+
return r + c
71+
raise RuntimeError("can't find a version of [" + repr(root) + "] choices: " + repr(choices))
72+
6173

6274
if "win32" == os.sys.platform:
75+
76+
for pathdir in env['ENV']['PATH'].split(os.pathsep):
77+
if os.path.exists(os.path.join(pathdir, 'cl.exe')):
78+
print( "found visual studio at " + pathdir )
79+
break
80+
else:
81+
#use current environment
82+
print "using current environment (PATH etc.) settings"
83+
#print os.environ
84+
env['ENV'] = dict(os.environ)
6385

6486
if force64:
6587
env.Append( CPPDEFINES=["_AMD64_=1"] )
@@ -68,20 +90,19 @@ if "win32" == os.sys.platform:
6890

6991
env.Append( CPPFLAGS= " /nologo /MT /W3 /Gm /EHsc /Zi /Od /Fp " )
7092
env.Append( CPPDEFINES=[ "_WINDOWS" , "WIN32" , "XP_WIN" ] )
71-
7293

73-
winSDKHome = findVersion( "C:/Program Files/Microsoft SDKs/Windows/" ,
74-
[ "v6.0" , "v6.0a" , "v6.1" ] )
94+
winSDKHome = findVersion( [ "C:/Program Files/Microsoft SDKs/Windows/", "C:/Program Files (x86)/Microsoft SDKs/Windows/" ] ,
95+
[ "v6.0" , "v6.0a" , "v6.1", "v7.0A" ] )
7596

7697
env.Append( CPPPATH=[ winSDKHome + "/Include" ] )
7798
if force64:
7899
env.Append( LIBPATH=[ winSDKHome + "/Lib/x64" ] )
79100
else:
80101
env.Append( LIBPATH=[ winSDKHome + "/Lib" ] )
81102

82-
83103
elif "darwin" == os.sys.platform:
84104
nix = True
105+
85106
elif "sunos5" == os.sys.platform:
86107
nix = True
87108

@@ -97,8 +118,10 @@ elif "sunos5" == os.sys.platform:
97118

98119
elif "freebsd7" == os.sys.platform:
99120
nix = True
121+
100122
elif "linux2" == os.sys.platform:
101123
nix = True
124+
102125
else:
103126
print( "unknown platform: " + os.sys.platform )
104127
Exit(-1)

0 commit comments

Comments
 (0)