1
+ # -*- mode: python; -*-
2
+ # scons file to build spidermonkey
3
+ # experimental
4
+ #
5
+
1
6
import os
2
7
import subprocess
3
8
@@ -44,22 +49,39 @@ coreFiles = [ "jsapi.c" ,
44
49
"jsxml.c" ,
45
50
"prmjtime.c" ]
46
51
52
+
47
53
force64 = GetOption ( "force64" ) is not None
48
54
49
55
msarch = None
50
56
if force64 :
51
57
msarch = "amd64"
52
58
59
+
53
60
env = Environment ( MSVS_ARCH = msarch )
54
61
nix = False
55
62
63
+
56
64
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
+
61
73
62
74
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 )
63
85
64
86
if force64 :
65
87
env .Append ( CPPDEFINES = ["_AMD64_=1" ] )
@@ -68,20 +90,19 @@ if "win32" == os.sys.platform:
68
90
69
91
env .Append ( CPPFLAGS = " /nologo /MT /W3 /Gm /EHsc /Zi /Od /Fp " )
70
92
env .Append ( CPPDEFINES = [ "_WINDOWS" , "WIN32" , "XP_WIN" ] )
71
-
72
93
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" ] )
75
96
76
97
env .Append ( CPPPATH = [ winSDKHome + "/Include" ] )
77
98
if force64 :
78
99
env .Append ( LIBPATH = [ winSDKHome + "/Lib/x64" ] )
79
100
else :
80
101
env .Append ( LIBPATH = [ winSDKHome + "/Lib" ] )
81
102
82
-
83
103
elif "darwin" == os .sys .platform :
84
104
nix = True
105
+
85
106
elif "sunos5" == os .sys .platform :
86
107
nix = True
87
108
@@ -97,8 +118,10 @@ elif "sunos5" == os.sys.platform:
97
118
98
119
elif "freebsd7" == os .sys .platform :
99
120
nix = True
121
+
100
122
elif "linux2" == os .sys .platform :
101
123
nix = True
124
+
102
125
else :
103
126
print ( "unknown platform: " + os .sys .platform )
104
127
Exit (- 1 )
0 commit comments