/[Apache-SVN]/httpd/mod_mbox/trunk/SConstruct
ViewVC logotype

Contents of /httpd/mod_mbox/trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1565574 - (show annotations) (download)
Fri Feb 7 08:25:48 2014 UTC (10 years, 6 months ago) by rjung
File size: 3300 byte(s)
Make dbm implementation selectable via scons.

By default we used sdbm which could not create
index records for many mails due to the key+value
size limitation of 1KB.

1 #!/usr/bin/env scons
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements. See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18
19 import subprocess
20 from os.path import join as pjoin
21
22 EnsureSConsVersion(1, 1, 0)
23
24
25 opts = Variables('build.py')
26
27 opts.Add(PathVariable('APXS', 'Path apxs','/usr/local/bin/apxs'))
28 opts.Add('DBM', 'Choose dbm implementation (default, sdbm, db, ...)', 'default')
29
30 env = Environment(options=opts, CPPDEFINES={'-DDBM_TYPE' : '${DBM}'})
31
32 def get_output(cmd):
33 s = subprocess.Popen(cmd, stdout=subprocess.PIPE)
34 out = s.communicate()[0]
35 s.wait()
36 return out.strip()
37
38 def apxs_query(path, key):
39 cmd = [path, "-q", key]
40 return get_output(cmd)
41
42 apr_config = apxs_query(env["APXS"], 'APR_CONFIG')
43 apu_config = apxs_query(env["APXS"], 'APU_CONFIG')
44
45 env.Replace(CC = apxs_query(env["APXS"], 'CC'))
46 env.Replace(CPP = apxs_query(env["APXS"], 'CPP'))
47
48 env.ParseConfig(apr_config + ' --cflags --cppflags --includes')
49 env.ParseConfig(apu_config + ' --includes')
50
51 # TODO: Move to httpd-config when it comes out !
52 env.ParseConfig(env['APXS'] + ' -q EXTRA_CFLAGS')
53 env.ParseConfig(env['APXS'] + ' -q EXTRA_CPPFLAGS')
54
55 env.AppendUnique(CPPPATH = [apxs_query(env['APXS'], 'exp_includedir')])
56 if env['PLATFORM'] == 'darwin':
57 env.AppendUnique(LINKFLAGS = ['-undefined', 'dynamic_lookup'])
58
59 libsources = [pjoin('module-2.0', x) for x in Split("""
60 mbox_cache.c
61 mbox_parse.c
62 mbox_sort.c
63 mbox_thread.c
64 mbox_externals.c
65 """)]
66
67 lib = env.StaticLibrary(target = "libmbox", source = [ libsources])
68
69 modsources = [pjoin('module-2.0', x) for x in Split("""
70 mod_mbox.c
71 mod_mbox_file.c
72 mod_mbox_out.c
73 mod_mbox_index.c
74 mod_mbox_cte.c
75 mod_mbox_mime.c
76 mod_mbox_sitemap.c
77 """)]
78
79 module = env.LoadableModule(target = "mod_mbox.so", source = [modsources, libsources], SHLIBPREFIX='')
80
81 lenv = env.Clone()
82
83 # This is a hack to set the RPATH on some operating systems... make me more
84 # portable later....
85 p1 = get_output([apr_config, '--bindir'])
86 p1 = pjoin(p1[:p1.rfind('/')], 'lib')
87 p2 = get_output([apu_config, '--bindir'])
88 p2 = pjoin(p2[:p2.rfind('/')], 'lib')
89 lenv.AppendUnique(RPATH = [p1, p2])
90
91 lenv.ParseConfig(apr_config + ' --link-ld')
92 lenv.ParseConfig(apu_config + ' --link-ld')
93 util = lenv.Program(target = 'mod-mbox-util', source = ['module-2.0/mod-mbox-util.c', lib])
94
95 mod_path = apxs_query(env["APXS"], 'exp_libexecdir')
96 bin_path = apxs_query(env["APXS"], 'exp_bindir')
97 imod = env.Install(mod_path, source = [module])
98 bmod = env.Install(bin_path, source = [util])
99 env.Alias('install', [imod, bmod])
100
101 targets = [module, util]
102
103 env.Default(targets)

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26