1 Return-Path: <jeff@ocjtech.us>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 28B3E431FBC
\r
6 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 05:47:25 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id gXAYGLVMsW09 for <notmuch@notmuchmail.org>;
\r
11 Sun, 22 Nov 2009 05:47:23 -0800 (PST)
\r
12 Received: from mail-yx0-f204.google.com (mail-yx0-f204.google.com
\r
14 by olra.theworths.org (Postfix) with ESMTP id C0824431FAE
\r
15 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 05:47:23 -0800 (PST)
\r
16 Received: by yxe42 with SMTP id 42so4759357yxe.22
\r
17 for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 05:47:23 -0800 (PST)
\r
18 Received: by 10.150.5.35 with SMTP id 35mr6517765ybe.84.1258897643335;
\r
19 Sun, 22 Nov 2009 05:47:23 -0800 (PST)
\r
20 Received: from lt26923.campus.dmacc.edu ([69.57.47.215])
\r
21 by mx.google.com with ESMTPS id 13sm1625198gxk.1.2009.11.22.05.47.20
\r
22 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
23 Sun, 22 Nov 2009 05:47:21 -0800 (PST)
\r
24 Received: from localhost ([127.0.0.1] helo=localhost.localdomain)
\r
25 by lt26923.campus.dmacc.edu with esmtps (TLSv1:AES256-SHA:256)
\r
26 (Exim 4.69) (envelope-from <jeff@ocjtech.us>)
\r
27 id 1NCCmc-0005o7-PG; Sun, 22 Nov 2009 07:47:18 -0600
\r
28 From: "Jeffrey C. Ollie" <jeff@ocjtech.us>
\r
29 To: Not Much Mail <notmuch@notmuchmail.org>
\r
30 Date: Sun, 22 Nov 2009 07:47:10 -0600
\r
31 Message-Id: <1258897630-22282-1-git-send-email-jeff@ocjtech.us>
\r
32 X-Mailer: git-send-email 1.6.5.2
\r
33 Subject: [notmuch] [PATCH] Add SCons build files.
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.12
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sun, 22 Nov 2009 13:47:25 -0000
\r
48 The SCons build files included here *should* do everything that the
\r
49 current Makefiles do, plus a little bit of configuration checking. To
\r
54 sudo scons install-emacs
\r
55 sudo scons install-desktop
\r
57 Various installation directories can be customized:
\r
59 sudo scons install DESTDIR=/tmp/buildroot prefix=/opt/notmuch
\r
61 See the output of 'scons -h' for a complete list of the variables that
\r
64 Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
\r
67 SConstruct | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
68 lib/SConscript | 19 +++++
\r
69 3 files changed, 248 insertions(+), 0 deletions(-)
\r
70 create mode 100644 SConstruct
\r
71 create mode 100644 lib/SConscript
\r
73 diff --git a/.gitignore b/.gitignore
\r
74 index 8794354..6661b3b 100644
\r
77 @@ -8,3 +8,6 @@ notmuch.1.gz
\r
84 diff --git a/SConstruct b/SConstruct
\r
85 new file mode 100644
\r
86 index 0000000..8d6960d
\r
90 +# -*- mode: python; coding: utf-8 -*-
\r
94 +variables = Variables('custom.py')
\r
96 +variables.Add('DESTDIR',
\r
97 + 'Destination directory',
\r
100 +variables.Add('prefix',
\r
101 + 'Installation prefix',
\r
104 +variables.Add('bindir',
\r
105 + 'Directory that user binaries go into',
\r
108 +variables.Add('datadir',
\r
109 + 'Directory that static data files go into',
\r
110 + '${prefix}/share')
\r
112 +variables.Add('mandir',
\r
113 + 'Directory that manual pages go into',
\r
114 + '${datadir}/man')
\r
116 +variables.Add('emacs_lispdir',
\r
117 + 'Directory that Emacs LISP files go into',
\r
118 + '${default_emacs_lispdir}')
\r
120 +variables.Add('sysconfdir',
\r
121 + 'Directory that system configuration files go into',
\r
124 +variables.Add('bash_completion_dir',
\r
125 + 'Directory that Bash completion files go into',
\r
126 + '${sysconfdir}/bash_completion.d')
\r
128 +variables.Add('desktop_dir',
\r
129 + 'Directory that desktop files go into',
\r
130 + '${datadir}/applications')
\r
132 +variables.Add('gzip',
\r
133 + 'Gzip executable',
\r
136 +variables.Add('emacs',
\r
137 + 'Emacs executable',
\r
140 +def InstallPerm(env, dest, files, perm):
\r
141 + obj = env.Install(dest, files)
\r
143 + env.AddPostAction(i, Chmod(str(i), perm))
\r
146 +def InstallAsPerm(env, dest, files, perm):
\r
147 + obj = env.InstallAs(dest, files)
\r
149 + env.AddPostAction(i, Chmod(str(i), perm))
\r
152 +topenv = Environment(variables = variables,
\r
153 + BUILDERS = {'InstallPerm': InstallPerm,
\r
154 + 'InstallAsPerm': InstallAsPerm})
\r
156 +topenv.Append(CPPPATH=['#/lib'])
\r
159 +if os.environ.has_key('CFLAGS'):
\r
160 + cflags = topenv.ParseFlags(os.environ['CFLAGS'])
\r
161 + topenv.MergeFlags(cflags)
\r
163 +if os.environ.has_key('CXXFLAGS'):
\r
164 + cxxflags = topenv.ParseFlags(os.environ['CXXFLAGS'])
\r
165 + topenv.MergeFlags(cxxflags)
\r
167 +if cflags is None or cxxflags is None:
\r
168 + optflags = topenv.ParseFlags('-O2')
\r
169 + topenv.MergeFlags(optflags)
\r
171 +warnflags = topenv.ParseFlags('-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum')
\r
172 +topenv.MergeFlags(warnflags)
\r
174 +def CheckPkgConfig(context, version):
\r
175 + context.Message('Checking for pkg-config... ')
\r
176 + result = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
\r
177 + context.Result(result)
\r
180 +def CheckPkg(context, name):
\r
181 + context.Message('Checking for %s... ' % name)
\r
182 + result = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
\r
183 + context.Result(result)
\r
186 +def CheckXapian(context):
\r
187 + context.Message('Checking for xapian-core... ')
\r
188 + for xapian_config in ['xapian-config-1.1', 'xapian-config']:
\r
189 + result, output = context.TryAction('%s --version > $TARGET' % xapian_config)
\r
191 + xapian_version = output.strip().split()[-1]
\r
192 + context.env['xapian_config'] = xapian_config
\r
193 + context.env['xapian_version'] = xapian_version
\r
194 + context.Result(xapian_version)
\r
196 + context.Result(False)
\r
199 +def CheckEmacs(context):
\r
200 + context.Message('Checking for emacs... ')
\r
201 + context.env['default_emacs_lispdir'] = '${prefix}/share/emacs/site-lisp'
\r
202 + result = context.TryAction('pkg-config --exists emacs')
\r
204 + result, output = context.TryAction('pkg-config emacs --variable sitepkglispdir > $TARGET')
\r
206 + context.env['default_emacs_lispdir'] = output.strip()
\r
207 + context.Result(True)
\r
209 + context.Result(False)
\r
212 +def CheckDesktopFileInstall(context):
\r
213 + context.Message('Checking for desktop-file-install... ')
\r
214 + result = context.TryAction('desktop-file-install -h')[0]
\r
215 + context.Result(result)
\r
218 +conf = Configure(topenv, custom_tests = {'CheckPkgConfig': CheckPkgConfig,
\r
219 + 'CheckPkg': CheckPkg,
\r
220 + 'CheckXapian': CheckXapian,
\r
221 + 'CheckEmacs': CheckEmacs,
\r
222 + 'CheckDesktopFileInstall': CheckDesktopFileInstall})
\r
224 +if not conf.CheckPkgConfig('0.23'):
\r
225 + print 'pkg-config >= 0.23 not found.'
\r
228 +if not conf.CheckPkg('glib-2.0 >= 2.22'):
\r
229 + print 'glib-2.0 >= 2.22 not found'
\r
232 +if not conf.CheckPkg('gmime-2.4 >= 2.4.0'):
\r
233 + print 'gmime-2.4 >= 2.4.0 not found'
\r
236 +if not conf.CheckPkg('talloc >= 2.0.0'):
\r
237 + print 'talloc >= 2.0.0 not found'
\r
240 +if not conf.CheckXapian():
\r
241 + print 'xapian not found'
\r
244 +emacs = conf.CheckEmacs()
\r
246 +valgrind = conf.CheckPkg('valgrind >= 3.5.0')
\r
248 +desktop = conf.CheckDesktopFileInstall()
\r
250 +if not conf.CheckFunc('strndup'):
\r
251 + conf.env.Append(CPPDEFINES = ['NEED_STRNDUP'])
\r
253 +if not conf.CheckFunc('getline'):
\r
254 + conf.env.Append(CPPDEFINES = ['NEED_GETLINE'])
\r
256 +topenv = conf.Finish()
\r
258 +topenv.ParseConfig('pkg-config glib-2.0 --cflags --libs')
\r
259 +topenv.ParseConfig('pkg-config gmime-2.4 --cflags --libs')
\r
260 +topenv.ParseConfig('pkg-config talloc --cflags --libs')
\r
261 +topenv.ParseConfig('${xapian_config} --cxxflags --libs')
\r
263 + topenv.ParseConfig('pkg-config valgrind --cflags')
\r
264 + topenv.Append(CPPDEFINES = ['HAVE_VALGRIND'])
\r
266 +Help(variables.GenerateHelpText(topenv))
\r
270 +libnotmuch = SConscript(['lib/SConscript'])
\r
272 +env = topenv.Clone()
\r
274 +notmuch = env.Program('notmuch', ['debugger.c',
\r
275 + 'gmime-filter-reply.c',
\r
277 + 'notmuch-config.c',
\r
278 + 'notmuch-dump.c',
\r
280 + 'notmuch-reply.c',
\r
281 + 'notmuch-restore.c',
\r
282 + 'notmuch-search.c',
\r
283 + 'notmuch-setup.c',
\r
284 + 'notmuch-show.c',
\r
286 + 'notmuch-time.c',
\r
287 + 'query-string.c',
\r
288 + 'show-message.c',
\r
290 +env.Alias('all', notmuch)
\r
292 +env.Install('${DESTDIR}${bindir}', notmuch)
\r
293 +env.Alias('install', '${DESTDIR}${bindir}')
\r
295 +manpage = env.Command('notmuch.1.gz', 'notmuch.1', '${gzip} -9 < $SOURCE > $TARGET')
\r
296 +env.Alias('all', manpage)
\r
298 +env.InstallPerm('${DESTDIR}${mandir}/man1', manpage, 0644)
\r
299 +env.Alias('install', '${DESTDIR}${mandir}/man1')
\r
301 +env.InstallAsPerm('${DESTDIR}${bash_completion_dir}/notmuch', 'contrib/notmuch-completion.bash', 0644)
\r
302 +env.Alias('install', '${DESTDIR}${bash_completion_dir}')
\r
305 + env.Command('${DESTDIR}${desktop_dir}/notmuch.desktop', 'notmuch.desktop', 'desktop-file-install --mode 0644 --dir ${DESTDIR}${desktop_dir} ${SOURCE}')
\r
306 + env.Alias('install-desktop', '${DESTDIR}${desktop_dir}')
\r
309 + elisp = env.Command('notmuch.elc', 'notmuch.el', '${emacs} --no-window-system --no-site-file --no-init-file --no-splash --batch --funcall batch-byte-compile $SOURCE')
\r
310 + env.Alias('emacs', elisp)
\r
311 + env.InstallPerm('${DESTDIR}${emacs_lispdir}', elisp, 0644)
\r
312 + env.InstallPerm('${DESTDIR}${emacs_lispdir}', 'notmuch.el', 0644)
\r
313 + env.Alias('install-emacs', '${DESTDIR}${emacs_lispdir}')
\r
316 diff --git a/lib/SConscript b/lib/SConscript
\r
317 new file mode 100644
\r
318 index 0000000..eb38516
\r
320 +++ b/lib/SConscript
\r
322 +# -*- mode: python; coding: utf-8 -*-
\r
326 +env = topenv.Clone()
\r
328 +libnotmuch = env.Library('notmuch', ['libsha1.c',
\r
329 + 'message-file.c',
\r
340 +Return('libnotmuch')
\r