This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
SConstruct
100 lines (81 loc) · 2.86 KB
/
SConstruct
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
# ----------------------------------------------------------------------------
# Top-level SCons script for privly client library.
#
# TODO:
# [2012/04/23:jhostetler] This is only tested on Windows with MSVC 9.
#
# History:
# [2012/04/23:jhostetler] Created by translating the original Makefile.
# ----------------------------------------------------------------------------
import os
import SCons
# Trick from: http://www.scons.org/wiki/ImportingEnvironmentSettings
# We're essentially dumping the external environment into SCons, but for fields
# like PATH, we're appending rather than overwriting.
#
# Needed because Scons can't find cl.exe on my Windows machine without "help"
def ENV_update( tgt_ENV, src_ENV ):
for K in src_ENV.keys():
if K in tgt_ENV.keys() and K in [ 'PATH', 'LD_LIBRARY_PATH',
'LIB', 'LIBPATH', 'INCLUDE' ]:
tgt_ENV[K] = SCons.Util.AppendPath(tgt_ENV[K], src_ENV[K])
else:
tgt_ENV[K] = src_ENV[K]
# ----------------------------------------------------------------------------
env = Environment()
ENV_update(env["ENV"], os.environ)
env.SetDefault( PRIVLY_CRYPTO_BACKEND = "nss" )
env.SetDefault( PRIVLY_DEBUG = False )
# ----------------------------------------------------------------------------
# Options
# ----------------------------------------------------------------------------
# build with `scons --debug-build` for debug.
AddOption( "--debug-build", dest="debug_build", action="store_true", default=False,
help="Enable debug build" )
# ----------------------------------------------------------------------------
if GetOption( "debug_build" ):
env["PRIVLY_DEBUG"] = True
platform = ARGUMENTS.get( "OS", Platform() )
build_dir = "#build"
inc_dir = "#include"
sandbox_dir = "#sandbox"
src_dir = "#src"
lib_dir = "#lib"
dist_dir = "#dist"
# NSS
nss_root = "C:/lib/mozilla/dist"
# MSVC
msvc_root = "C:/programs/msvc9/VC"
# Windows SDK
windows_sdk_root = "C:/lib/windows_sdk/v6.0A"
# Includes
include_path = [
inc_dir,
nss_root + "/public",
nss_root + "/WINNT6.1_OPT.OBJ/include",
msvc_root + "/include",
windows_sdk_root + "/Include"
]
env.Append( CPPPATH = include_path )
libpath = [
lib_dir,
msvc_root + "/lib",
nss_root + "/WINNT6.1_OPT.OBJ/lib",
windows_sdk_root + "/Lib"
]
env.Append( LIBPATH = libpath )
libs = [
"nss3.lib",
"libplc4.lib",
"libnspr4.lib"
]
env.Append( LIBS = libs )
Export( "env" )
# ----------------------------------------------------------------------------
# Build steps
# ----------------------------------------------------------------------------
obj_list = env.SConscript( "#src/obj.scons", variant_dir="build", duplicate=False )
env.Replace( PRIVLY_OBJECT_LIST = obj_list )
libs = env.SConscript( "#lib/lib.scons", duplicate=False )
# env.Replace( PRIVLY_LIBRARY_LIST = libs )
# env.SConscript( "#dist/dist.scons", duplicate=False )