forked from retrieva/pficommon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
107 lines (87 loc) · 2.65 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
102
103
104
105
106
107
APPNAME = 'pficommon'
VERSION = '1.3.1'
top = '.'
out = 'build'
import Options
import sys
import os
import re
import waflib
subdirs = 'src tools'
def options(opt):
opt.load('compiler_cxx')
opt.load('unittest_gtest')
opt.load('gnu_dirs')
opt.recurse(subdirs)
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('unittest_gtest')
conf.check_tool('gnu_dirs')
env = conf.env
ver = env.CC_VERSION
if env.COMPILER_CXX == 'g++' and int(ver[0]) >= 4 and int(ver[1]) >= 6:
env.append_unique(
'CXXFLAGS',
['-O2', '-Wall', '-g', '-pipe', '-D_REENTRANT', '-fno-omit-frame-pointer'])
else:
env.append_unique(
'CXXFLAGS',
['-O2', '-Wall', '-g', '-pipe', '-D_REENTRANT', '-fno-omit-frame-pointer', '-D_FORTIFY_SOURCE=1'])
env.HPREFIX = env.PREFIX + '/include/pficommon'
conf.recurse(subdirs)
conf.define('PFICOMMON_VERSION', VERSION)
conf.env['VERSION'] = VERSION
conf.write_config_header('src/pfi-config.h')
print("""
pficommon has been configured as follows:
[Modules]
FCGI module: %s
Database module: %s
have MySQL lib: %s
have PostgreSQL lib: %s
MessagePack RPC module: %s
[Visualization]
Magick++ impl: %s
[Build information]
Package: %s
build (compile on): %s
host endian: %s
Compiler: %s
Compiler version: %s
CXXFLAGS: %s
""" % (conf.env.BUILD_FCGI and 'yes' or 'no',
(not Options.options.disable_database) and 'yes' or 'no',
conf.env.BUILD_MYSQL and 'yes' or 'no',
conf.env.BUILD_PGSQL and 'yes' or 'no',
conf.env.BUILD_MPRPC and 'yes' or 'no',
conf.env.BUILD_MAGICKPP and 'yes' or 'no',
APPNAME + '-' + VERSION,
conf.env.DEST_CPU + '-' + conf.env.DEST_OS,
sys.byteorder,
conf.env.COMPILER_CXX,
'.'.join(conf.env.CC_VERSION),
' '.join(conf.env.CXXFLAGS)))
def build(bld):
bld.install_files('${PREFIX}/include/pficommon', [
'src/pfi-config.h',
])
bld.recurse(subdirs)
libs = []
for tasks in bld.get_build_iterator():
if tasks == []:
break
for task in tasks:
if isinstance(task.generator, waflib.TaskGen.task_gen) and 'cxxshlib' in task.generator.features:
libs.append(task.generator.target)
ls = ''
for l in set(libs):
ls = ls + ' -l' + l
bld(source = 'pficommon.pc.in',
prefix = bld.env['PREFIX'],
exec_prefix = '${prefix}',
libdir = bld.env['LIBDIR'],
libs = ls,
includedir = '${prefix}/include',
PACKAGE = APPNAME,
VERSION = VERSION)
bld.install_files(os.path.join(bld.env['LIBDIR'], 'pkgconfig'), 'pficommon.pc')