-
Notifications
You must be signed in to change notification settings - Fork 2
/
wscript
101 lines (81 loc) · 4.07 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
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
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Utils
import os
VERSION = '0.1.0'
APPNAME = 'ndnrevoke'
GIT_TAG_PREFIX = 'ndnrevoke-'
def options(opt):
opt.load(['compiler_cxx', 'gnu_dirs'])
opt.load(['default-compiler-flags', 'coverage', 'sanitizers',
'boost', 'openssl', 'sqlite3'],
tooldir=['.waf-tools'])
optgrp = opt.add_option_group('ndnrevoke Options')
optgrp.add_option('--with-tests', action='store_true', default=False,
help='Build unit tests')
optgrp.add_option('--with-examples', action='store_true', default=False,
help='Build examples')
optgrp.add_option('--with-ledgers', action='store_true', default=False,
help='Use NDN Ledgers as backend storahe')
def configure(conf):
conf.load(['compiler_cxx', 'gnu_dirs',
'default-compiler-flags', 'boost', 'openssl', 'sqlite3'])
conf.env.WITH_TESTS = conf.options.with_tests
conf.env.WITH_EXAMPLES = conf.options.with_examples
conf.env.WITH_LEDGERS = conf.options.with_ledgers
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX',
pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
if conf.env.WITH_LEDGERS:
conf.check_cfg(package='libcert-ledger', args=['--cflags', '--libs'], uselib_store='CERT_LEDGER',
pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
conf.check_sqlite3()
conf.check_openssl(lib='crypto', atleast_version='1.1.1')
boost_libs = ['system', 'program_options', 'filesystem']
if conf.env.WITH_TESTS:
boost_libs.append('unit_test_framework')
conf.check_boost(lib=boost_libs, mt=True)
if conf.env.BOOST_VERSION_NUMBER < 106501:
conf.fatal('The minimum supported version of Boost is 1.65.1.\n'
'Please upgrade your distribution or manually install a newer version of Boost.\n'
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
conf.check_compiler_flags()
# Loading "late" to prevent tests from being compiled with profiling flags
conf.load('coverage')
conf.load('sanitizers')
# If there happens to be a static library, waf will put the corresponding -L flags
# before dynamic library flags. This can result in compilation failure when the
# system has a different version of the ndncert library installed.
conf.env.prepend_value('STLIBPATH', ['.'])
conf.define_cond('HAVE_TESTS', conf.env.WITH_TESTS)
conf.define_cond('HAVE_LEDGERS', conf.env.WITH_LEDGERS)
conf.define('SYSCONFDIR', conf.env.SYSCONFDIR)
# The config header will contain all defines that were added using conf.define()
# or conf.define_cond(). Everything that was added directly to conf.env.DEFINES
# will not appear in the config header, but will instead be passed directly to the
# compiler on the command line.
conf.write_config_header('src/ndnrevoke-config.hpp', define_prefix='NDNREVOKE_')
def build(bld):
bld.shlib(target='ndn-revoke',
vnum=VERSION,
cnum=VERSION,
source=bld.path.ant_glob('src/**/*.cpp'),
use='NDN_CXX CERT_LEDGER BOOST OPENSSL SQLITE3',
includes='src',
export_includes='src')
bld(features='subst',
source='libndn-revoke.pc.in',
target='libndn-revoke.pc',
install_path='${LIBDIR}/pkgconfig',
VERSION=VERSION)
bld.recurse('tools')
bld.recurse('tests')
if bld.env.WITH_EXAMPLES:
bld.recurse('examples')
bld.install_files(
dest='${INCLUDEDIR}/ndnrevoke',
files=bld.path.ant_glob('src/**/*.hpp'),
cwd=bld.path.find_dir('src'),
relative_trick=True)
bld.install_files('${INCLUDEDIR}/ndnrevoke',
bld.path.find_resource('src/ndnrevoke-config.hpp'))
bld.install_files('${SYSCONFDIR}/ndnrevoke',
['ct.config.sample'])