-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConscript.thirdparty
121 lines (102 loc) · 4.17 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env python
# This file has been modified from its orginal sources.
#
# Copyright (c) 2012 Software in the Public Interest Inc (SPI)
# Copyright (c) 2012 David Pratt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2008-2012 Appcelerator Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import effess
import os
import sys
import inspect
import urllib
import tarfile
import os.path as path
import distutils.dir_util as dirutil
from progressbar import ProgressBar
Import('build')
revisions = {
"linux-x86": 2,
"linux-x86_64": 2,
"osx-x86": 2,
"win32-x86": 2
}
arch_name = '%s-%s-v%s' % (build.os, build.arch, revisions[build.os+'-'+build.arch])
if build.is_win32():
arch_name = '%s-%s-v%s' % ("win", build.arch, revisions[build.os+'-'+build.arch])
thirdparty_name = 'thirdparty-%s' % (arch_name)
url = 'http://tidesdk.multipart.net/thirdparty/tide-%s.tgz' % (arch_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():
libs = [ 'poco', 'webkit', 'libproxy', 'libsoup']
for libdir in libs:
effess.copy_tree(path.join(build.third_party, libdir, 'lib'), rtdir)
elif build.is_win32():
libs = ['boost', 'libproxy', 'poco', 'webkit', 'curl', 'cairo']
if build.tidelite is False:
libs.append('webkit-patch')
else:
libs.append('webkit-lite')
for libdir in libs:
effess.copy_tree(path.join(build.third_party, libdir, 'bin'), rtdir)
effess.copy_tree(path.join(build.third_party, 'sdk'), path.join(build.dir, 'sdk'))
elif build.is_osx():
libs = ['boost', 'curl', 'openssl', 'poco']
excludes = ['.a', '.h', '.defs', 'JavaScriptGlue.framework', '.DS_Store']
targets = []
if build.tidelite:
excludes.extend(['WebKit.framework', 'WebCore.framework', 'JavaScriptCore.framework'])
for framework in Glob(path.join(build.third_party, '*/*.framework')):
t = build.utils.CopyToDir(framework, rtdir, exclude=excludes)
targets.append(t)
for libdir in libs:
p = path.join(build.third_party, libdir, 'lib')
targets.append(build.utils.CopyTree(p, rtdir, exclude=excludes))
build.mark_build_target(targets)
# PHP dependencies don't aren't distributed with the runtime, only Poco's.
# for libdir in Glob(path.join(build.third_party, '*/lib')):