forked from appcelerator-archive/kroll
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConscript.thirdparty
78 lines (64 loc) · 2.56 KB
/
SConscript.thirdparty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
import os
import sys
import inspect
import futils
import urllib
import tarfile
import os.path as path
import distutils.dir_util as dirutil
from progressbar import ProgressBar
Import('build')
revisions = {
"linux-i386": 18,
"linux-x86_64": 16,
"osx-universal": 17,
"win32-i386": 17
}
thirdparty_name = 'thirdparty-%s-%s-r%s' % (build.os, build.arch, revisions[build.os+'-'+build.arch])
url = 'http://kroll.appcelerator.com.s3.amazonaws.com/kroll-%s.tgz' % (thirdparty_name)
build.third_party = path.join(build.cwd(), thirdparty_name)
rtdir = build.runtime_build_dir
def exists():
return path.isdir(build.third_party)
def fetch():
print "You don't seem to have the appropriate thirdparty files. I'll fetch them."
print "Downloading %s" % url
pbar = ProgressBar().start()
try:
def progress_callback(count, block_size, total_size):
if (total_size < 0):
raise Exception("Could not fetch archive! Does it exist on the server?")
percent = int(count * block_size * 100/total_size)
pbar.update(percent)
fname, msg = urllib.urlretrieve(url, reporthook=progress_callback)
print "Fetched it (%s). I'm going to unpack it now..." % (fname)
os.makedirs(build.third_party)
tfile = tarfile.open(fname, mode="r:gz")
tfile.extractall(path=build.third_party)
finally:
urllib.urlcleanup()
pbar.finish()
if not exists(): fetch()
if build.is_linux():
futils.CopyTree(path.join(build.third_party, 'webkit', 'lib'), rtdir)
futils.CopyTree(path.join(build.third_party, 'poco', 'lib'), rtdir)
elif build.is_win32():
futils.CopyTree(path.join(build.third_party, 'poco', 'bin'), rtdir)
futils.CopyTree(path.join(build.third_party, 'webkit', 'bin'), rtdir)
futils.CopyToDir(path.join(build.third_party, 'microsoft', 'Microsoft.VC80.CRT'), rtdir)
webkit_tlb = path.join(build.third_party, 'webkit', 'lib', 'WebKit.tlb')
webkit_manifest = path.join(build.runtime_build_dir, 'WebKit.manifest')
t = Command(webkit_manifest, webkit_tlb, 'mt.exe /nologo /tlb:"$SOURCE" /dll:WebKit /out:"$TARGET"')
build.mark_build_target(t)
elif build.is_osx():
excludes = ['.h', '.defs', 'JavaScriptGlue.framework']
targets = []
for framework in Glob(path.join(build.third_party, '*/*.framework')):
t = build.utils.CopyToDir(framework, rtdir, exclude=excludes)
targets.append(t)
# PHP dependencies don't aren't distributed with the runtime, only Poco's.
# for libdir in Glob(path.join(build.third_party, '*/lib')):
libdir = path.join(build.third_party, "poco", "lib");
targets.append(build.utils.CopyTree(libdir, rtdir, exclude=excludes))
build.mark_build_target(targets)