forked from kelektiv/node.bcrypt.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwscript
45 lines (37 loc) · 1.12 KB
/
wscript
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
import Options, Utils, sys
from os import unlink, symlink, popen
from os.path import exists, islink
srcdir = "."
blddir = "build"
VERSION = "0.0.1"
def set_options(opt):
opt.tool_options("compiler_cxx")
opt.tool_options("compiler_cc")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("compiler_cc")
conf.check_tool("node_addon")
if sys.platform != 'darwin' and not conf.check(lib='bsd', libpath=['/usr/lib'], uselib_store='LIBBSD'):
conf.fatal("Cannot find bsd libraries (used for arc4random).")
def build(bld):
bcryptnode = bld.new_task_gen("cxx", "shlib", "node_addon")
bcryptnode.target = "bcrypt_lib"
bcryptnode.source = """
src/blowfish.cc
src/bcrypt.cc
src/bcrypt_node.cc
"""
if sys.platform != 'darwin':
bcryptnode.includes = """
/usr/includes/bsd/
"""
bcryptnode.uselib = 'LIBBSD'
def test(t):
Utils.exec_command('nodeunit test')
def shutdown():
t = 'bcrypt_lib.node'
if Options.commands['clean']:
if exists(t): unlink(t)
if Options.commands['build']:
if exists('build/default/' + t) and not exists(t):
symlink('build/default/' + t, t)