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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
PACKAGE = 'aptitude'
VERSION = '0.6.2.1'
import aptitude_configure
import os
import os.path
from aptitude_configure_utils import RequireCheck
# A generic environment used to build all aptitude's programs.
envs = aptitude_configure.Configure(PACKAGE, VERSION)
manpage_locales = [
'gl',
'it',
'pl'
]
tl_manpages = Glob('aptitude.??.8')
tl_helptexts = [
'help.txt',
Glob('help-??.txt'),
Glob('help-??_??.txt')
]
tl_defaults = [
Glob('aptitude-defaults.??'),
Glob('aptitude-defaults.??_??')
]
# Put files from the top-level into the source distribution.
envs.base.Dist(
'COPYING',
'ChangeLog.SVN',
'Doxyfile.in',
'FAQ',
'FAQ',
'NEWS',
'README.CWIDGET',
'README.SMART-POINTERS',
'README.THREADS',
'README.i18n',
'SConstruct',
'aclocal.m4',
'aptitude-defaults',
'aptitude-hackers-guide.txt',
'check_boost.sh',
'function_groups',
'function_pkgs',
'section-descriptions',
tl_defaults,
tl_helptexts,
tl_manpages,
)
base_env = envs.base
Export('base_env')
SConscript(dirs = [ 'site_scons' ])
# Define everything that should be installed from the top-level.
envs.base.Install(envs.base['PKGDATADIR'], [
'COPYING',
'FAQ',
'NEWS',
'aptitude-defaults',
'function_groups',
'function_pkgs',
'section-descriptions',
tl_defaults,
tl_helptexts,
])
envs.base.Install(envs.base['BINDIR'], [
'aptitude-create-state-bundle',
'aptitude-run-state-bundle'
])
for locale in manpage_locales:
envs.base.Install(os.path.join(envs.base['MANDIR'], locale, 'man8'),
'aptitude.%s.8' % locale)
# Create the state directory on "install".
make_statedir = Command(envs.base['STATEDIR'], [],
Mkdir('$TARGET'))
envs.base.Alias('install', make_statedir)
all_aptitude_srcs = None
############# Code to build source & tests in each variant #############
for variant_env in envs.programs.AllVariantEnvs():
Export(programs_env = variant_env)
variant_dir = 'build/%s/src' % variant_env.GetVariantName()
aptitude, all_aptitude_srcs_v = SConscript(['src/SConscript'],
variant_dir = variant_dir)
all_aptitude_srcs_v = set([x.srcnode() for x in Flatten(all_aptitude_srcs_v)])
if all_aptitude_srcs is None:
all_aptitude_srcs = all_aptitude_srcs_v
elif all_aptitude_srcs_v != all_aptitude_srcs:
print 'Build script error: not all variants produced the same list of source files.'
print map(str, all_aptitude_srcs_v), map(str, all_aptitude_srcs)
Exit(1)
Default(aptitude)
# De-setify the list of sources.
all_aptitude_srcs = list(all_aptitude_srcs)
# Sort it so we don't get spurious changes in order due to hashing
# blips.
all_aptitude_srcs.sort()
Export('all_aptitude_srcs')
# NB: I know because of how the variant directories are set up that we
# always have the same number of entries in the two lists.
for boost_tests_env, cppunit_tests_env, gtest_tests_env \
in zip(envs.boost_tests.AllVariantEnvs(),
envs.cppunit_tests.AllVariantEnvs(),
envs.gtest_tests.AllVariantEnvs()):
Export(boost_tests_env = boost_tests_env,
cppunit_tests_env = cppunit_tests_env,
gtest_tests_env = gtest_tests_env)
# If this isn't true, something has gone horribly wrong:
assert(cppunit_tests_env['VARIANT'] == boost_tests_env['VARIANT'])
SConscript(['tests/SConscript'], variant_dir = 'build/%s/tests' % cppunit_tests_env.GetVariantName())
AlwaysBuild('test')
# For convenience, make "scons check" the same as "make check".
Alias('check', 'test')
###### Build the documentation in build/doc ######
docs_env = envs.base
Export('docs_env')
SConscript(['doc/SConscript'], variant_dir = 'build/doc', duplicate = True)
Alias('docs', 'doc-html')
Alias('docs', 'doc-text')
Alias('docs', 'doc-man')
###### Build the gettext translation files ######
po_env = envs.base
Export('po_env')
# No variant_dir because the pofile workflow requires the outputs to
# be in the source directory and in distributed archives.
SConscript(['po/SConscript'])
# Don't generate the "dist" stuff unless it's been explicitly
# requested. This allows "dist" to build all targets with '.'
# without having to worry about infinite recurrence.
if 'dist' in COMMAND_LINE_TARGETS:
archives = envs.base.DistArchive(envs.base.subst('$PACKAGE-$VERSION'),
scons_args = [ '--variants=all', '.',
'-j', GetOption('num_jobs') ])
Alias('dist', archives)
# Rebuild the pofiles *before* attempting to build the
# distribution archive.
po_env.Depends('dist', 'update-po')
|