2008-06-05 14:05:55 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# WAF build script - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
#
|
2012-06-18 01:13:05 +02:00
|
|
|
# Copyright 2008-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
# Copyright 2008-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2008-06-05 14:05:55 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
"""
|
|
|
|
This is a WAF build script (http://code.google.com/p/waf/).
|
|
|
|
It can be used as an alternative build system to autotools
|
|
|
|
for Geany. It does not (yet) cover all of the autotools tests and
|
|
|
|
configure options but all important things are working.
|
|
|
|
"make dist" should be done with autotools, most other targets and
|
|
|
|
functions should work better (regarding performance and flexibility)
|
|
|
|
or at least equally.
|
|
|
|
|
|
|
|
Missing features: --enable-binreloc, make targets: dist, pdf (in doc/)
|
2008-06-08 14:19:49 +00:00
|
|
|
Known issues: Dependency handling is buggy, e.g. if src/document.h is
|
2010-11-11 13:43:47 +00:00
|
|
|
changed, depending source files are not rebuilt (maybe Waf bug).
|
2008-06-05 14:05:55 +00:00
|
|
|
|
2009-08-16 21:49:09 +00:00
|
|
|
The code of this file itself loosely follows PEP 8 with some exceptions
|
2009-08-13 21:51:06 +00:00
|
|
|
(line width 100 characters and some other minor things).
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
Requires WAF 1.6.1 and Python 2.5 (or later).
|
2008-06-05 14:05:55 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2009-08-13 21:51:06 +00:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import tempfile
|
2010-11-11 13:43:47 +00:00
|
|
|
from waflib import Logs, Options, Scripting, Utils
|
2014-08-29 16:12:40 +02:00
|
|
|
from waflib.Build import BuildContext
|
2010-11-11 13:43:47 +00:00
|
|
|
from waflib.Configure import ConfigurationContext
|
2012-04-12 23:07:33 +02:00
|
|
|
from waflib.Errors import WafError
|
2013-04-14 15:02:36 +03:00
|
|
|
from waflib.TaskGen import feature, before_method
|
2013-04-24 22:05:56 +02:00
|
|
|
from waflib.Tools.compiler_c import c_compiler
|
2013-06-07 21:27:09 +03:00
|
|
|
from waflib.Tools.compiler_cxx import cxx_compiler
|
2008-06-05 14:05:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
APPNAME = 'geany'
|
2014-04-13 19:33:23 +02:00
|
|
|
VERSION = '1.25'
|
2014-05-24 11:32:45 +02:00
|
|
|
LINGUAS_FILE = os.path.join('po', 'LINGUAS')
|
2014-04-27 04:25:38 -07:00
|
|
|
MINIMUM_GTK_VERSION = '2.24.0'
|
2013-03-10 18:21:05 +01:00
|
|
|
MINIMUM_GTK3_VERSION = '3.0.0'
|
2014-04-27 04:25:38 -07:00
|
|
|
MINIMUM_GLIB_VERSION = '2.28.0'
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2015-01-18 15:53:01 +01:00
|
|
|
GEANY_LIB_VERSION = '0.0.0'
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
top = '.'
|
|
|
|
out = '_build_'
|
|
|
|
|
2011-03-05 22:40:50 +00:00
|
|
|
mio_sources = set(['tagmanager/mio/mio.c'])
|
|
|
|
|
2012-05-08 22:35:55 +02:00
|
|
|
ctags_sources = set([
|
2012-12-03 15:17:43 +01:00
|
|
|
'tagmanager/ctags/abaqus.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/args.c',
|
|
|
|
'tagmanager/ctags/abc.c',
|
|
|
|
'tagmanager/ctags/actionscript.c',
|
2012-11-01 11:14:55 +11:00
|
|
|
'tagmanager/ctags/asciidoc.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/asm.c',
|
|
|
|
'tagmanager/ctags/basic.c',
|
|
|
|
'tagmanager/ctags/c.c',
|
|
|
|
'tagmanager/ctags/cobol.c',
|
|
|
|
'tagmanager/ctags/conf.c',
|
|
|
|
'tagmanager/ctags/css.c',
|
|
|
|
'tagmanager/ctags/ctags.c',
|
|
|
|
'tagmanager/ctags/diff.c',
|
|
|
|
'tagmanager/ctags/docbook.c',
|
2015-03-15 13:41:23 +08:00
|
|
|
'tagmanager/ctags/erlang.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/entry.c',
|
|
|
|
'tagmanager/ctags/fortran.c',
|
|
|
|
'tagmanager/ctags/get.c',
|
2014-11-07 17:09:53 +01:00
|
|
|
'tagmanager/ctags/go.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/haskell.c',
|
|
|
|
'tagmanager/ctags/haxe.c',
|
|
|
|
'tagmanager/ctags/html.c',
|
|
|
|
'tagmanager/ctags/js.c',
|
2014-11-28 16:22:33 +01:00
|
|
|
'tagmanager/ctags/json.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/keyword.c',
|
|
|
|
'tagmanager/ctags/latex.c',
|
|
|
|
'tagmanager/ctags/lregex.c',
|
|
|
|
'tagmanager/ctags/lua.c',
|
|
|
|
'tagmanager/ctags/make.c',
|
|
|
|
'tagmanager/ctags/markdown.c',
|
|
|
|
'tagmanager/ctags/matlab.c',
|
|
|
|
'tagmanager/ctags/nsis.c',
|
|
|
|
'tagmanager/ctags/nestlevel.c',
|
|
|
|
'tagmanager/ctags/objc.c',
|
|
|
|
'tagmanager/ctags/options.c',
|
|
|
|
'tagmanager/ctags/parse.c',
|
|
|
|
'tagmanager/ctags/pascal.c',
|
|
|
|
'tagmanager/ctags/r.c',
|
|
|
|
'tagmanager/ctags/perl.c',
|
|
|
|
'tagmanager/ctags/php.c',
|
2015-04-25 16:17:03 +02:00
|
|
|
'tagmanager/ctags/powershell.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/python.c',
|
|
|
|
'tagmanager/ctags/read.c',
|
|
|
|
'tagmanager/ctags/rest.c',
|
|
|
|
'tagmanager/ctags/ruby.c',
|
2013-10-16 17:19:29 -04:00
|
|
|
'tagmanager/ctags/rust.c',
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/ctags/sh.c',
|
|
|
|
'tagmanager/ctags/sort.c',
|
|
|
|
'tagmanager/ctags/sql.c',
|
|
|
|
'tagmanager/ctags/strlist.c',
|
|
|
|
'tagmanager/ctags/txt2tags.c',
|
|
|
|
'tagmanager/ctags/tcl.c',
|
|
|
|
'tagmanager/ctags/vhdl.c',
|
|
|
|
'tagmanager/ctags/verilog.c',
|
|
|
|
'tagmanager/ctags/vstring.c'])
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
tagmanager_sources = set([
|
2012-05-08 22:35:55 +02:00
|
|
|
'tagmanager/src/tm_source_file.c',
|
|
|
|
'tagmanager/src/tm_tag.c',
|
|
|
|
'tagmanager/src/tm_workspace.c'])
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2010-11-24 21:29:16 +00:00
|
|
|
scintilla_sources = set(['scintilla/gtk/scintilla-marshal.c'])
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
geany_sources = set([
|
|
|
|
'src/about.c', 'src/build.c', 'src/callbacks.c', 'src/dialogs.c', 'src/document.c',
|
|
|
|
'src/editor.c', 'src/encodings.c', 'src/filetypes.c', 'src/geanyentryaction.c',
|
|
|
|
'src/geanymenubuttonaction.c', 'src/geanyobject.c', 'src/geanywraplabel.c',
|
2011-12-11 12:00:46 +01:00
|
|
|
'src/highlighting.c', 'src/keybindings.c',
|
2015-01-18 15:53:01 +01:00
|
|
|
'src/keyfile.c', 'src/log.c', 'src/libmain.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c', 'src/osx.c',
|
2010-11-11 13:43:47 +00:00
|
|
|
'src/plugins.c', 'src/pluginutils.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c',
|
Add a spawn module for Geany
g_spawn_async_with_pipes() under Windows has various drawbacks:
- There is no g_shell_parse_argv() for windows. It's not hard to write
one, but the command line recreated by mscvrt may be wrong.
- GLib converts the argument vector to UNICODE. For non-UTF8 arguments,
the result is often "Invalid string in argument vector at %d: %s:
Invalid byte sequence in conversion input" (YMMV). Our tools (make,
grep, gcc, ...) are "ANSI", so converting to UNICODE and then back
only causes problems.
- For various reasons, GLib uses an intermediate program to start
children (see gspawn-win32.c), with the side effect that the
grandchildren output (such as make -> gcc) is not captured.
- With non-blocking pipes, the g_io_add_watch() callbacks are never
invoked, while with blocking pipes, g_io_channel_read_line() blocks.
- Some smaller problems, explained in spawn.c as inline comments.
The spawn module tries to fix these problems, and to provide easier
APIs, which guarantee that the callbacks will synchronized as expected,
and g_io_channel_read_line() will not be required, since even under
Unix, it may buffer lines of unlimited length.
This initial commit only adds the module source and header files, and
includes it in the various build systems.
You can see PR 274 for a long discussion about the module.
2015-03-10 21:24:42 +02:00
|
|
|
'src/sciwrappers.c', 'src/search.c', 'src/socket.c', 'src/spawn.c', 'src/stash.c',
|
2010-11-11 13:43:47 +00:00
|
|
|
'src/symbols.c',
|
|
|
|
'src/templates.c', 'src/toolbar.c', 'src/tools.c', 'src/sidebar.c',
|
|
|
|
'src/ui_utils.c', 'src/utils.c'])
|
2008-06-08 19:02:21 +00:00
|
|
|
|
2015-04-12 22:54:16 +02:00
|
|
|
geany_bin_sources = set(['src/main.c'])
|
|
|
|
|
2012-10-17 22:18:54 +02:00
|
|
|
geany_icons = {
|
|
|
|
'hicolor/16x16/apps': ['16x16/classviewer-class.png',
|
|
|
|
'16x16/classviewer-macro.png',
|
|
|
|
'16x16/classviewer-member.png',
|
|
|
|
'16x16/classviewer-method.png',
|
|
|
|
'16x16/classviewer-namespace.png',
|
|
|
|
'16x16/classviewer-other.png',
|
|
|
|
'16x16/classviewer-struct.png',
|
|
|
|
'16x16/classviewer-var.png',
|
|
|
|
'16x16/geany.png'],
|
|
|
|
'hicolor/16x16/actions': ['16x16/geany-build.png',
|
|
|
|
'16x16/geany-close-all.png',
|
|
|
|
'16x16/geany-save-all.png'],
|
|
|
|
'hicolor/24x24/actions': ['24x24/geany-build.png',
|
|
|
|
'24x24/geany-close-all.png',
|
|
|
|
'24x24/geany-save-all.png'],
|
|
|
|
'hicolor/32x32/actions': ['32x32/geany-build.png',
|
|
|
|
'32x32/geany-close-all.png',
|
|
|
|
'32x32/geany-save-all.png'],
|
2015-03-15 23:31:40 +01:00
|
|
|
'hicolor/32x32/apps': ['32x32/geany.png'],
|
2012-10-17 22:18:54 +02:00
|
|
|
'hicolor/48x48/actions': ['48x48/geany-build.png',
|
|
|
|
'48x48/geany-close-all.png',
|
|
|
|
'48x48/geany-save-all.png'],
|
|
|
|
'hicolor/48x48/apps': ['48x48/geany.png'],
|
|
|
|
'hicolor/scalable/apps': ['scalable/geany.svg'],
|
|
|
|
'hicolor/scalable/actions': ['scalable/geany-build.svg',
|
|
|
|
'scalable/geany-close-all.svg',
|
|
|
|
'scalable/geany-save-all.svg'],
|
|
|
|
'Tango/16x16/actions': ['tango/16x16/geany-save-all.png'],
|
|
|
|
'Tango/24x24/actions': ['tango/24x24/geany-save-all.png'],
|
|
|
|
'Tango/32x32/actions': ['tango/32x32/geany-save-all.png'],
|
|
|
|
'Tango/48x48/actions': ['tango/48x48/geany-save-all.png'],
|
|
|
|
'Tango/scalable/actions': ['tango/scalable/geany-save-all.svg']
|
|
|
|
}
|
2013-01-15 22:28:00 +01:00
|
|
|
geany_icons_indexes = {
|
|
|
|
'hicolor': ['index.theme'],
|
|
|
|
'Tango': ['tango/index.theme']
|
|
|
|
}
|
2012-10-17 22:18:54 +02:00
|
|
|
|
2008-06-08 19:02:21 +00:00
|
|
|
|
2008-06-05 14:05:55 +00:00
|
|
|
def configure(conf):
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
conf.check_waf_version(mini='1.6.1')
|
|
|
|
|
|
|
|
conf.load('compiler_c')
|
|
|
|
is_win32 = _target_is_win32(conf)
|
|
|
|
|
2015-01-18 16:44:57 +01:00
|
|
|
visibility_hidden_supported = conf.check_cc(cflags=['-Werror', '-fvisibility=hidden'], mandatory=False)
|
2010-11-11 17:48:21 +00:00
|
|
|
conf.check_cc(header_name='fcntl.h', mandatory=False)
|
|
|
|
conf.check_cc(header_name='fnmatch.h', mandatory=False)
|
|
|
|
conf.check_cc(header_name='glob.h', mandatory=False)
|
|
|
|
conf.check_cc(header_name='sys/time.h', mandatory=False)
|
|
|
|
conf.check_cc(header_name='sys/types.h', mandatory=False)
|
|
|
|
conf.check_cc(header_name='sys/stat.h', mandatory=False)
|
2012-04-12 23:07:33 +02:00
|
|
|
conf.define('HAVE_STDLIB_H', 1) # are there systems without stdlib.h?
|
|
|
|
conf.define('STDC_HEADERS', 1) # an optimistic guess ;-)
|
|
|
|
_add_to_env_and_define(conf, 'HAVE_REGCOMP', 1) # needed for CTags
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2010-11-11 17:48:21 +00:00
|
|
|
conf.check_cc(function_name='fgetpos', header_name='stdio.h', mandatory=False)
|
2014-11-09 17:11:31 +01:00
|
|
|
conf.check_cc(function_name='fnmatch', header_name='fnmatch.h', mandatory=False)
|
2010-11-11 17:48:21 +00:00
|
|
|
conf.check_cc(function_name='ftruncate', header_name='unistd.h', mandatory=False)
|
|
|
|
conf.check_cc(function_name='mkstemp', header_name='stdlib.h', mandatory=False)
|
|
|
|
conf.check_cc(function_name='strstr', header_name='string.h')
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2014-04-29 02:03:06 +02:00
|
|
|
conf.check_cc(function_name='pow', header_name='math.h', lib='m', uselib_store='M')
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# check sunOS socket support
|
|
|
|
if Options.platform == 'sunos':
|
|
|
|
conf.check_cc(function_name='socket', lib='socket',
|
|
|
|
header_name='sys/socket.h', uselib_store='SUNOS_SOCKET', mandatory=True)
|
|
|
|
|
|
|
|
# check for cxx after the header and function checks have been done to ensure they are
|
|
|
|
# checked with cc not cxx
|
|
|
|
conf.load('compiler_cxx')
|
|
|
|
if is_win32:
|
|
|
|
conf.load('winres')
|
|
|
|
_load_intltool_if_available(conf)
|
|
|
|
|
|
|
|
# GTK / GIO version check
|
2013-03-11 19:54:28 +01:00
|
|
|
gtk_package_name = 'gtk+-3.0' if conf.options.use_gtk3 else 'gtk+-2.0'
|
|
|
|
minimum_gtk_version = MINIMUM_GTK3_VERSION if conf.options.use_gtk3 else MINIMUM_GTK_VERSION
|
2013-03-10 18:21:05 +01:00
|
|
|
conf.check_cfg(package=gtk_package_name, atleast_version=minimum_gtk_version, uselib_store='GTK',
|
2010-11-11 13:43:47 +00:00
|
|
|
mandatory=True, args='--cflags --libs')
|
2012-04-12 23:00:39 +02:00
|
|
|
conf.check_cfg(package='glib-2.0', atleast_version=MINIMUM_GLIB_VERSION, uselib_store='GLIB',
|
2011-06-13 18:41:15 +00:00
|
|
|
mandatory=True, args='--cflags --libs')
|
2012-04-02 14:56:19 +02:00
|
|
|
conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE',
|
|
|
|
mandatory=True, args='--cflags --libs')
|
2011-06-13 18:41:15 +00:00
|
|
|
conf.check_cfg(package='gio-2.0', uselib_store='GIO', args='--cflags --libs', mandatory=True)
|
2013-03-10 18:21:05 +01:00
|
|
|
gtk_version = conf.check_cfg(modversion=gtk_package_name, uselib_store='GTK') or 'Unknown'
|
2011-03-27 15:04:58 +00:00
|
|
|
conf.check_cfg(package='gthread-2.0', uselib_store='GTHREAD', args='--cflags --libs')
|
2015-02-04 00:27:34 +01:00
|
|
|
if conf.options.enable_mac_integration:
|
|
|
|
pkgname = 'gtk-mac-integration-gtk3' if conf.options.use_gtk3 else 'gtk-mac-integration-gtk2'
|
2015-04-12 22:54:16 +02:00
|
|
|
conf.check_cfg(package=pkgname, uselib_store='MAC_INTEGRATION',
|
2015-02-04 00:27:34 +01:00
|
|
|
mandatory=True, args='--cflags --libs')
|
2013-03-10 18:21:05 +01:00
|
|
|
# remember GTK version for the build step
|
|
|
|
conf.env['gtk_package_name'] = gtk_package_name
|
2015-06-23 07:11:08 +02:00
|
|
|
conf.env['gtk_version'] = gtk_version
|
2013-03-10 18:21:05 +01:00
|
|
|
conf.env['minimum_gtk_version'] = minimum_gtk_version
|
2013-03-11 19:54:28 +01:00
|
|
|
conf.env['use_gtk3'] = conf.options.use_gtk3
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2014-08-29 14:39:26 +02:00
|
|
|
revision = _get_git_rev(conf)
|
|
|
|
|
2014-08-29 14:10:56 +02:00
|
|
|
# rst2html for the HTML manual
|
2014-08-29 14:39:26 +02:00
|
|
|
if not conf.options.no_html_doc and revision is not None:
|
2014-08-29 14:27:12 +02:00
|
|
|
try:
|
|
|
|
conf.env['RST2HTML'] = _find_rst2html(conf)
|
|
|
|
except WafError:
|
|
|
|
error_msg = '''Documentation enabled but rst2html not found.
|
|
|
|
You can explicitly disable building of the HTML manual with --disable-html-docs,
|
|
|
|
but you then may not have a local copy of the HTML manual.'''
|
|
|
|
raise WafError(error_msg)
|
2014-08-29 14:10:56 +02:00
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# Windows specials
|
|
|
|
if is_win32:
|
|
|
|
if conf.env['PREFIX'].lower() == tempfile.gettempdir().lower():
|
|
|
|
# overwrite default prefix on Windows (tempfile.gettempdir() is the Waf default)
|
|
|
|
new_prefix = os.path.join(str(conf.root), '%s-%s' % (APPNAME, VERSION))
|
|
|
|
_add_to_env_and_define(conf, 'PREFIX', new_prefix, quote=True)
|
2010-11-11 17:48:21 +00:00
|
|
|
_add_to_env_and_define(conf, 'BINDIR', os.path.join(new_prefix, 'bin'), quote=True)
|
2010-11-11 13:43:47 +00:00
|
|
|
_add_to_env_and_define(conf, 'DOCDIR', os.path.join(conf.env['PREFIX'], 'doc'), quote=True)
|
2014-04-11 00:06:29 +02:00
|
|
|
_add_to_env_and_define(conf, 'LIBDIR', '%s/lib' % conf.env['PREFIX'], quote=True)
|
2010-11-11 13:43:47 +00:00
|
|
|
conf.define('LOCALEDIR', os.path.join('share' 'locale'), quote=True)
|
|
|
|
# overwrite LOCALEDIR to install message catalogues properly
|
2014-05-24 11:32:45 +02:00
|
|
|
conf.env['LOCALEDIR'] = os.path.join(conf.env['PREFIX'], 'share', 'locale')
|
2010-11-11 13:43:47 +00:00
|
|
|
# DATADIR is defined in objidl.h, so we remove it from config.h but keep it in env
|
|
|
|
conf.undefine('DATADIR')
|
|
|
|
conf.env['DATADIR'] = os.path.join(conf.env['PREFIX'], 'data')
|
2014-04-13 11:00:56 +02:00
|
|
|
conf.env.append_value('LINKFLAGS_cprogram', [
|
|
|
|
'-mwindows',
|
|
|
|
'-static-libgcc',
|
|
|
|
'-static-libstdc++'])
|
2015-04-01 07:18:46 +02:00
|
|
|
conf.env.append_value('LIB_WIN32', ['wsock32', 'uuid', 'ole32', 'comdlg32'])
|
2010-11-11 13:43:47 +00:00
|
|
|
else:
|
|
|
|
conf.env['cshlib_PATTERN'] = '%s.so'
|
|
|
|
# DATADIR and LOCALEDIR are defined by the intltool tool
|
|
|
|
# but they are not added to the environment, so we need to
|
|
|
|
_add_define_to_env(conf, 'DATADIR')
|
|
|
|
_add_define_to_env(conf, 'LOCALEDIR')
|
|
|
|
docdir = os.path.join(conf.env['DATADIR'], 'doc', 'geany')
|
|
|
|
libdir = os.path.join(conf.env['PREFIX'], 'lib')
|
|
|
|
mandir = os.path.join(conf.env['DATADIR'], 'man')
|
|
|
|
_define_from_opt(conf, 'DOCDIR', conf.options.docdir, docdir)
|
|
|
|
_define_from_opt(conf, 'LIBDIR', conf.options.libdir, libdir)
|
|
|
|
_define_from_opt(conf, 'MANDIR', conf.options.mandir, mandir)
|
|
|
|
|
|
|
|
conf.define('ENABLE_NLS', 1)
|
|
|
|
conf.define('GEANY_LOCALEDIR', '' if is_win32 else conf.env['LOCALEDIR'], quote=True)
|
|
|
|
conf.define('GEANY_DATADIR', 'data' if is_win32 else conf.env['DATADIR'], quote=True)
|
|
|
|
conf.define('GEANY_DOCDIR', conf.env['DOCDIR'], quote=True)
|
|
|
|
conf.define('GEANY_LIBDIR', '' if is_win32 else conf.env['LIBDIR'], quote=True)
|
|
|
|
conf.define('GEANY_PREFIX', '' if is_win32 else conf.env['PREFIX'], quote=True)
|
|
|
|
conf.define('PACKAGE', APPNAME, quote=True)
|
|
|
|
conf.define('VERSION', VERSION, quote=True)
|
2011-10-10 00:37:14 +02:00
|
|
|
conf.define('REVISION', revision or '-1', quote=True)
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
conf.define('GETTEXT_PACKAGE', APPNAME, quote=True)
|
|
|
|
|
2010-11-11 17:48:21 +00:00
|
|
|
# no VTE on Windows
|
|
|
|
if is_win32:
|
|
|
|
conf.options.no_vte = True
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
_define_from_opt(conf, 'HAVE_PLUGINS', not conf.options.no_plugins, None)
|
|
|
|
_define_from_opt(conf, 'HAVE_SOCKET', not conf.options.no_socket, None)
|
|
|
|
_define_from_opt(conf, 'HAVE_VTE', not conf.options.no_vte, None)
|
|
|
|
|
|
|
|
conf.write_config_header('config.h', remove=False)
|
|
|
|
|
2014-10-28 15:31:01 +01:00
|
|
|
# GEANY_EXPORT_SYMBOL and GEANY_API_SYMBOL
|
|
|
|
if is_win32:
|
2015-04-06 01:52:38 +02:00
|
|
|
geanyexport_cflags = []
|
|
|
|
geanyexport_defines = ['GEANY_EXPORT_SYMBOL=__declspec(dllexport)']
|
2015-01-18 16:44:57 +01:00
|
|
|
elif visibility_hidden_supported:
|
2015-04-06 01:52:38 +02:00
|
|
|
geanyexport_cflags = ['-fvisibility=hidden']
|
|
|
|
geanyexport_defines = ['GEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))']
|
2014-10-28 15:31:01 +01:00
|
|
|
else: # unknown, define to nothing
|
2015-04-06 01:52:38 +02:00
|
|
|
geanyexport_cflags = []
|
|
|
|
geanyexport_defines = ['GEANY_EXPORT_SYMBOL=']
|
|
|
|
geanyexport_defines.append('GEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL')
|
|
|
|
conf.env['DEFINES_geanyexport'] = geanyexport_defines
|
|
|
|
conf.env['CFLAGS_geanyexport'] = geanyexport_cflags
|
|
|
|
conf.env['CXXFLAGS_geanyexport'] = geanyexport_cflags
|
2014-10-28 15:31:01 +01:00
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# some more compiler flags
|
|
|
|
conf.env.append_value('CFLAGS', ['-DHAVE_CONFIG_H'])
|
2014-10-26 23:44:19 +01:00
|
|
|
if conf.env['CC_NAME'] == 'gcc' and '-O' not in ''.join(conf.env['CFLAGS']):
|
|
|
|
conf.env.append_value('CFLAGS', ['-O2'])
|
2011-10-09 22:46:19 +02:00
|
|
|
if revision is not None:
|
2010-11-11 13:43:47 +00:00
|
|
|
conf.env.append_value('CFLAGS', ['-g', '-DGEANY_DEBUG'])
|
|
|
|
# Scintilla flags
|
|
|
|
conf.env.append_value('CFLAGS', ['-DGTK'])
|
|
|
|
conf.env.append_value('CXXFLAGS',
|
2010-11-24 21:29:16 +00:00
|
|
|
['-DNDEBUG', '-DGTK', '-DSCI_LEXER', '-DG_THREADS_IMPL_NONE'])
|
2015-06-18 10:28:02 +02:00
|
|
|
if conf.env['CXX_NAME'] == 'gcc' and '-O' not in ''.join(conf.env['CXXFLAGS']):
|
|
|
|
conf.env.append_value('CXXFLAGS', ['-O2'])
|
|
|
|
if revision is not None:
|
|
|
|
conf.env.append_value('CXXFLAGS', ['-g'])
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
# summary
|
|
|
|
Logs.pprint('BLUE', 'Summary:')
|
|
|
|
conf.msg('Install Geany ' + VERSION + ' in', conf.env['PREFIX'])
|
|
|
|
conf.msg('Using GTK version', gtk_version)
|
|
|
|
conf.msg('Build with plugin support', conf.options.no_plugins and 'no' or 'yes')
|
|
|
|
conf.msg('Use virtual terminal support', conf.options.no_vte and 'no' or 'yes')
|
2011-10-09 22:46:19 +02:00
|
|
|
if revision is not None:
|
|
|
|
conf.msg('Compiling Git revision', revision)
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def options(opt):
|
2013-06-06 20:19:15 +03:00
|
|
|
# Disable MSVC detection on win32: building Geany with MSVC is currently not supported
|
2013-04-24 22:05:56 +02:00
|
|
|
# If anyone wants to add support for building with MSVC, this hack should be removed.
|
|
|
|
c_compiler['win32'] = ['gcc']
|
2013-06-06 20:19:15 +03:00
|
|
|
cxx_compiler['win32'] = ['g++']
|
2013-04-24 22:05:56 +02:00
|
|
|
|
2013-04-14 15:02:36 +03:00
|
|
|
opt.load('compiler_cc')
|
|
|
|
opt.load('compiler_cxx')
|
|
|
|
opt.load('intltool')
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2014-04-13 10:43:55 +02:00
|
|
|
# Option
|
|
|
|
opt.add_option('--no-scm', action='store_true', default=False,
|
|
|
|
help='Disable SCM detection [default: No]', dest='no_scm')
|
2010-11-11 13:43:47 +00:00
|
|
|
# Features
|
|
|
|
opt.add_option('--disable-plugins', action='store_true', default=False,
|
|
|
|
help='compile without plugin support [default: No]', dest='no_plugins')
|
|
|
|
opt.add_option('--disable-socket', action='store_true', default=False,
|
|
|
|
help='compile without support to detect a running instance [[default: No]',
|
|
|
|
dest='no_socket')
|
|
|
|
opt.add_option('--disable-vte', action='store_true', default=False,
|
|
|
|
help='compile without support for an embedded virtual terminal [[default: No]',
|
|
|
|
dest='no_vte')
|
2013-03-10 18:21:05 +01:00
|
|
|
opt.add_option('--enable-gtk3', action='store_true', default=False,
|
|
|
|
help='compile with GTK3 support (experimental) [[default: No]',
|
2013-03-11 19:54:28 +01:00
|
|
|
dest='use_gtk3')
|
2015-02-04 00:27:34 +01:00
|
|
|
opt.add_option('--enable-mac-integration', action='store_true', default=False,
|
|
|
|
help='use gtk-mac-integration to enable improved OS X integration [[default: No]',
|
|
|
|
dest='enable_mac_integration')
|
2014-08-29 14:27:12 +02:00
|
|
|
opt.add_option('--disable-html-docs', action='store_true', default=False,
|
|
|
|
help='do not generate HTML documentation using rst2html [[default: No]',
|
|
|
|
dest='no_html_doc')
|
2010-11-11 13:43:47 +00:00
|
|
|
# Paths
|
|
|
|
opt.add_option('--mandir', type='string', default='',
|
|
|
|
help='man documentation', dest='mandir')
|
|
|
|
opt.add_option('--docdir', type='string', default='',
|
|
|
|
help='documentation root', dest='docdir')
|
|
|
|
opt.add_option('--libdir', type='string', default='',
|
|
|
|
help='object code libraries', dest='libdir')
|
2008-06-05 14:05:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def build(bld):
|
2010-11-11 13:43:47 +00:00
|
|
|
is_win32 = _target_is_win32(bld)
|
|
|
|
|
|
|
|
if bld.cmd == 'clean':
|
|
|
|
_remove_linguas_file()
|
|
|
|
if bld.cmd in ('install', 'uninstall'):
|
|
|
|
bld.add_post_fun(_post_install)
|
|
|
|
|
2014-04-29 02:03:06 +02:00
|
|
|
def build_plugin(plugin_name, install=True, uselib_add=[]):
|
2010-11-11 13:43:47 +00:00
|
|
|
if install:
|
2015-06-27 23:49:20 +02:00
|
|
|
instpath = '${LIBDIR}/geany'
|
2010-11-11 13:43:47 +00:00
|
|
|
else:
|
|
|
|
instpath = None
|
|
|
|
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = ['c', 'cshlib'],
|
|
|
|
source = 'plugins/%s.c' % plugin_name,
|
2012-05-08 22:35:55 +02:00
|
|
|
includes = ['.', 'src/', 'scintilla/include', 'tagmanager/src'],
|
2010-11-11 13:43:47 +00:00
|
|
|
defines = 'G_LOG_DOMAIN="%s"' % plugin_name,
|
|
|
|
target = plugin_name,
|
2014-04-29 02:03:06 +02:00
|
|
|
uselib = ['GTK', 'GLIB', 'GMODULE'] + uselib_add,
|
2015-01-18 15:53:01 +01:00
|
|
|
use = ['geany'],
|
2010-11-11 13:43:47 +00:00
|
|
|
install_path = instpath)
|
|
|
|
|
2012-05-08 22:35:55 +02:00
|
|
|
# CTags
|
2015-04-06 02:22:53 +02:00
|
|
|
bld.objects(
|
|
|
|
features = ['c'],
|
2012-05-08 22:35:55 +02:00
|
|
|
source = ctags_sources,
|
|
|
|
name = 'ctags',
|
|
|
|
target = 'ctags',
|
|
|
|
includes = ['.', 'tagmanager', 'tagmanager/ctags'],
|
|
|
|
defines = 'G_LOG_DOMAIN="CTags"',
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = ['cshlib', 'GLIB', 'geanyexport'])
|
2012-05-08 22:35:55 +02:00
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# Tagmanager
|
2015-04-06 02:22:53 +02:00
|
|
|
bld.objects(
|
|
|
|
features = ['c'],
|
2010-11-11 13:43:47 +00:00
|
|
|
source = tagmanager_sources,
|
|
|
|
name = 'tagmanager',
|
|
|
|
target = 'tagmanager',
|
2012-05-08 22:35:55 +02:00
|
|
|
includes = ['.', 'tagmanager', 'tagmanager/ctags'],
|
2014-10-09 20:51:32 +02:00
|
|
|
defines = ['GEANY_PRIVATE', 'G_LOG_DOMAIN="Tagmanager"'],
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = ['cshlib', 'GTK', 'GLIB', 'geanyexport'])
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2011-03-05 22:40:50 +00:00
|
|
|
# MIO
|
2015-04-06 02:22:53 +02:00
|
|
|
bld.objects(
|
|
|
|
features = ['c'],
|
2011-03-05 22:40:50 +00:00
|
|
|
source = mio_sources,
|
|
|
|
name = 'mio',
|
|
|
|
target = 'mio',
|
|
|
|
includes = ['.', 'tagmanager/mio/'],
|
|
|
|
defines = 'G_LOG_DOMAIN="MIO"',
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = ['cshlib', 'GTK', 'GLIB', 'geanyexport'])
|
2011-03-05 22:40:50 +00:00
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# Scintilla
|
2010-11-24 21:29:16 +00:00
|
|
|
files = bld.srcnode.ant_glob('scintilla/**/*.cxx', src=True, dir=False)
|
2015-01-09 01:35:43 +01:00
|
|
|
scintilla_sources.update([file.path_from(bld.srcnode) for file in files])
|
2015-04-06 02:22:53 +02:00
|
|
|
bld.objects(
|
|
|
|
features = ['c', 'cxx'],
|
2010-11-11 13:43:47 +00:00
|
|
|
name = 'scintilla',
|
|
|
|
target = 'scintilla',
|
|
|
|
source = scintilla_sources,
|
2010-11-24 21:29:16 +00:00
|
|
|
includes = ['.', 'scintilla/include', 'scintilla/src', 'scintilla/lexlib'],
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = ['cshlib', 'cxxshlib', 'GTK', 'GLIB', 'GMODULE', 'M', 'geanyexport'])
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
# Geany
|
|
|
|
if bld.env['HAVE_VTE'] == 1:
|
|
|
|
geany_sources.add('src/vte.c')
|
|
|
|
if is_win32:
|
|
|
|
geany_sources.add('src/win32.c')
|
2015-04-12 22:54:16 +02:00
|
|
|
geany_bin_sources.add('geany_private.rc')
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2015-03-15 14:30:14 +01:00
|
|
|
def gen_signallist(task):
|
|
|
|
from xml.etree import ElementTree
|
|
|
|
|
|
|
|
def find_handlers(xml_filename):
|
|
|
|
tree = ElementTree.parse(xml_filename)
|
|
|
|
signals = tree.getroot().findall(".//signal")
|
|
|
|
return [sig.attrib["handler"] for sig in signals]
|
|
|
|
|
|
|
|
handlers = []
|
|
|
|
for node in task.inputs:
|
|
|
|
handlers += find_handlers(node.abspath())
|
|
|
|
handlers = sorted(set(handlers))
|
|
|
|
|
|
|
|
for node in task.outputs:
|
|
|
|
node.write("/* This file is auto-generated, do not edit. */\n" +
|
|
|
|
''.join(["ITEM(%s)\n" % h for h in handlers]))
|
|
|
|
|
|
|
|
# signallist.i
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2015-03-15 14:30:14 +01:00
|
|
|
source = 'data/geany.glade',
|
2015-04-13 23:00:43 +02:00
|
|
|
target = bld.path.get_bld().make_node('src/signallist.i'),
|
2015-03-15 14:30:14 +01:00
|
|
|
name = 'signallist.i',
|
|
|
|
rule = gen_signallist)
|
|
|
|
|
2015-01-18 15:53:01 +01:00
|
|
|
base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M']
|
2015-04-01 07:18:46 +02:00
|
|
|
|
2015-01-18 15:53:01 +01:00
|
|
|
# libgeany
|
2015-04-06 02:22:53 +02:00
|
|
|
bld.shlib(
|
|
|
|
features = ['c', 'cxx'],
|
2010-11-11 13:43:47 +00:00
|
|
|
name = 'geany',
|
|
|
|
target = 'geany',
|
|
|
|
source = geany_sources,
|
2015-03-15 14:30:14 +01:00
|
|
|
includes = ['.', 'scintilla/include', 'tagmanager/src', 'src'],
|
2010-11-11 13:43:47 +00:00
|
|
|
defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'],
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = base_uselibs + ['geanyexport'],
|
2015-01-18 15:53:01 +01:00
|
|
|
use = ['scintilla', 'ctags', 'tagmanager', 'mio'],
|
2015-04-05 16:54:55 +02:00
|
|
|
linkflags = bld.env['LINKFLAGS_cprogram'],
|
2015-04-01 07:18:46 +02:00
|
|
|
vnum = GEANY_LIB_VERSION,
|
2015-04-05 16:54:55 +02:00
|
|
|
install_path = '${PREFIX}/bin' if is_win32 else '${LIBDIR}')
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2015-01-18 15:53:01 +01:00
|
|
|
# geany executable
|
2015-04-06 02:22:53 +02:00
|
|
|
t = bld.program(
|
|
|
|
features = ['c', 'cxx'],
|
2015-01-18 15:53:01 +01:00
|
|
|
name = 'geany_bin',
|
|
|
|
target = 'geany',
|
2015-04-12 22:54:16 +02:00
|
|
|
source = geany_bin_sources,
|
2012-05-08 22:35:55 +02:00
|
|
|
includes = ['.', 'scintilla/include', 'tagmanager/src'],
|
2010-11-11 13:43:47 +00:00
|
|
|
defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'],
|
2015-04-06 01:52:38 +02:00
|
|
|
uselib = base_uselibs + ['geanyexport'],
|
2015-01-18 15:53:01 +01:00
|
|
|
use = ['geany'])
|
2015-04-05 20:03:59 +02:00
|
|
|
if not is_win32:
|
|
|
|
# http://www.freehackers.org/~tnagy/testdoc/single.html#common_c
|
|
|
|
t.rpath = bld.env['LIBDIR']
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
# Plugins
|
|
|
|
if bld.env['HAVE_PLUGINS'] == 1:
|
|
|
|
build_plugin('classbuilder')
|
|
|
|
build_plugin('demoplugin', False)
|
2014-04-29 02:03:06 +02:00
|
|
|
build_plugin('export', uselib_add=['M'])
|
2010-11-11 13:43:47 +00:00
|
|
|
build_plugin('filebrowser')
|
|
|
|
build_plugin('htmlchars')
|
|
|
|
build_plugin('saveactions')
|
2011-05-09 13:22:02 +00:00
|
|
|
build_plugin('splitwindow')
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
# Translations
|
|
|
|
if bld.env['INTLTOOL']:
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = ['linguas', 'intltool_po'],
|
|
|
|
podir = 'po',
|
|
|
|
install_path = '${LOCALEDIR}',
|
|
|
|
appname = 'geany')
|
|
|
|
|
2014-08-29 14:10:56 +02:00
|
|
|
# HTML documentation (build if it is not part of the tree already, as it is required for install)
|
|
|
|
html_doc_filename = os.path.join(bld.out_dir, 'doc', 'geany.html')
|
|
|
|
if bld.env['RST2HTML']:
|
|
|
|
rst2html = bld.env['RST2HTML']
|
|
|
|
bld(
|
|
|
|
source = ['doc/geany.txt'],
|
|
|
|
deps = ['doc/geany.css'],
|
2015-04-13 23:00:43 +02:00
|
|
|
target = bld.path.get_bld().make_node('doc/geany.html'),
|
2014-08-29 14:10:56 +02:00
|
|
|
name = 'geany.html',
|
|
|
|
cwd = os.path.join(bld.path.abspath(), 'doc'),
|
|
|
|
rule = '%s -stg --stylesheet=geany.css geany.txt %s' % (rst2html, html_doc_filename))
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
# geany.pc
|
2014-05-29 17:47:37 +02:00
|
|
|
if is_win32:
|
|
|
|
# replace backward slashes by forward slashes as they could be interepreted as escape
|
|
|
|
# characters
|
|
|
|
geany_pc_prefix = bld.env['PREFIX'].replace('\\', '/')
|
|
|
|
else:
|
|
|
|
geany_pc_prefix = bld.env['PREFIX']
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
source = 'geany.pc.in',
|
2012-04-12 23:07:33 +02:00
|
|
|
dct = {'VERSION': VERSION,
|
2013-03-10 18:21:05 +01:00
|
|
|
'DEPENDENCIES': '%s >= %s glib-2.0 >= %s' % \
|
|
|
|
(bld.env['gtk_package_name'],
|
|
|
|
bld.env['minimum_gtk_version'],
|
|
|
|
MINIMUM_GLIB_VERSION),
|
2014-05-29 17:47:37 +02:00
|
|
|
'prefix': geany_pc_prefix,
|
2010-11-11 13:43:47 +00:00
|
|
|
'exec_prefix': '${prefix}',
|
2014-05-29 17:47:37 +02:00
|
|
|
'libdir': '${exec_prefix}/lib',
|
|
|
|
'includedir': '${prefix}/include',
|
|
|
|
'datarootdir': '${prefix}/share',
|
2010-11-11 13:43:47 +00:00
|
|
|
'datadir': '${datarootdir}',
|
2014-06-22 14:09:04 +02:00
|
|
|
'localedir': '${datarootdir}/locale'})
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2015-06-23 07:11:08 +02:00
|
|
|
# geany.nsi
|
|
|
|
bld(
|
|
|
|
features = 'subst',
|
|
|
|
source = 'geany.nsi.in',
|
|
|
|
target = 'geany.nsi',
|
|
|
|
dct = {'VERSION': VERSION,
|
|
|
|
'GTK_VERSION': bld.env['gtk_version']},
|
|
|
|
install_path = None)
|
|
|
|
|
2010-11-11 17:48:21 +00:00
|
|
|
if not is_win32:
|
2010-11-11 13:43:47 +00:00
|
|
|
# geany.desktop
|
|
|
|
if bld.env['INTLTOOL']:
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = 'intltool_in',
|
|
|
|
source = 'geany.desktop.in',
|
2012-04-12 23:07:33 +02:00
|
|
|
flags = ['-d', '-q', '-u', '-c'],
|
2010-11-11 13:43:47 +00:00
|
|
|
install_path = '${DATADIR}/applications')
|
|
|
|
|
|
|
|
# geany.1
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = 'subst',
|
|
|
|
source = 'doc/geany.1.in',
|
|
|
|
target = 'geany.1',
|
2012-04-12 23:07:33 +02:00
|
|
|
dct = {'VERSION': VERSION,
|
2010-11-11 13:43:47 +00:00
|
|
|
'GEANY_DATA_DIR': bld.env['DATADIR'] + '/geany'},
|
|
|
|
install_path = '${MANDIR}/man1')
|
|
|
|
|
|
|
|
# geany.spec
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = 'subst',
|
|
|
|
source = 'geany.spec.in',
|
|
|
|
target = 'geany.spec',
|
|
|
|
install_path = None,
|
2012-04-12 23:07:33 +02:00
|
|
|
dct = {'VERSION': VERSION})
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
# Doxyfile
|
2013-04-14 15:02:36 +03:00
|
|
|
bld(
|
2010-11-11 13:43:47 +00:00
|
|
|
features = 'subst',
|
|
|
|
source = 'doc/Doxyfile.in',
|
|
|
|
target = 'doc/Doxyfile',
|
|
|
|
install_path = None,
|
2014-05-02 21:41:02 +02:00
|
|
|
dct = {'VERSION': VERSION,
|
|
|
|
'top_builddir': bld.out_dir,
|
|
|
|
'top_srcdir': bld.top_dir,})
|
2010-11-11 13:43:47 +00:00
|
|
|
|
2015-04-12 20:57:17 +02:00
|
|
|
# disable build/install phase interleaving
|
|
|
|
bld.add_group()
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
###
|
|
|
|
# Install files
|
|
|
|
###
|
2014-04-11 00:06:29 +02:00
|
|
|
# Headers
|
|
|
|
bld.install_files('${PREFIX}/include/geany', '''
|
2015-04-01 07:18:46 +02:00
|
|
|
src/app.h
|
|
|
|
src/build.h
|
|
|
|
src/dialogs.h
|
|
|
|
src/document.h
|
|
|
|
src/editor.h
|
|
|
|
src/encodings.h
|
|
|
|
src/filetypes.h
|
|
|
|
src/geany.h
|
|
|
|
src/highlighting.h
|
|
|
|
src/keybindings.h
|
|
|
|
src/main.h
|
|
|
|
src/msgwindow.h
|
|
|
|
src/navqueue.h
|
|
|
|
src/plugindata.h
|
|
|
|
src/pluginutils.h
|
|
|
|
src/prefs.h
|
|
|
|
src/project.h
|
|
|
|
src/sciwrappers.h
|
|
|
|
src/search.h
|
2015-07-12 10:02:56 +02:00
|
|
|
src/spawn.h
|
2015-04-01 07:18:46 +02:00
|
|
|
src/stash.h
|
|
|
|
src/support.h
|
|
|
|
src/symbols.h
|
|
|
|
src/templates.h
|
|
|
|
src/toolbar.h
|
|
|
|
src/ui_utils.h
|
|
|
|
src/utils.h
|
|
|
|
src/gtkcompat.h
|
|
|
|
plugins/geanyplugin.h
|
|
|
|
plugins/geanyfunctions.h
|
|
|
|
''')
|
2014-04-11 00:06:29 +02:00
|
|
|
bld.install_files('${PREFIX}/include/geany/scintilla', '''
|
|
|
|
scintilla/include/SciLexer.h scintilla/include/Scintilla.h
|
|
|
|
scintilla/include/Scintilla.iface scintilla/include/ScintillaWidget.h ''')
|
|
|
|
bld.install_files('${PREFIX}/include/geany/tagmanager', '''
|
2014-10-09 20:51:32 +02:00
|
|
|
tagmanager/src/tm_source_file.h
|
2014-10-05 19:26:37 +02:00
|
|
|
tagmanager/src/tm_tag.h
|
2014-10-10 16:18:06 +02:00
|
|
|
tagmanager/src/tm_tagmanager.h
|
2014-04-11 00:06:29 +02:00
|
|
|
tagmanager/src/tm_workspace.h ''')
|
2010-11-11 13:43:47 +00:00
|
|
|
# Docs
|
|
|
|
base_dir = '${PREFIX}' if is_win32 else '${DOCDIR}'
|
|
|
|
ext = '.txt' if is_win32 else ''
|
|
|
|
for filename in 'AUTHORS ChangeLog COPYING README NEWS THANKS TODO'.split():
|
|
|
|
basename = _uc_first(filename, bld)
|
|
|
|
destination_filename = '%s%s' % (basename, ext)
|
|
|
|
destination = os.path.join(base_dir, destination_filename)
|
|
|
|
bld.install_as(destination, filename)
|
|
|
|
|
2014-08-29 14:10:56 +02:00
|
|
|
# install HTML documentation only if it exists, i.e. it was built before
|
2014-08-29 14:39:26 +02:00
|
|
|
# local_html_doc_filename supports installing HTML doc from in-tree geany.html if it exists
|
|
|
|
local_html_doc_filename = os.path.join(bld.path.abspath(), 'doc', 'geany.html')
|
|
|
|
if os.path.exists(html_doc_filename) or os.path.exists(local_html_doc_filename):
|
2014-08-29 14:10:56 +02:00
|
|
|
html_dir = '' if is_win32 else 'html/'
|
|
|
|
html_name = 'Manual.html' if is_win32 else 'index.html'
|
|
|
|
start_dir = bld.path.find_dir('doc/images')
|
|
|
|
bld.install_files('${DOCDIR}/%simages' % html_dir, start_dir.ant_glob('*.png'), cwd=start_dir)
|
|
|
|
bld.install_as('${DOCDIR}/%s%s' % (html_dir, html_name), 'doc/geany.html')
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
bld.install_as('${DOCDIR}/%s' % _uc_first('manual.txt', bld), 'doc/geany.txt')
|
|
|
|
bld.install_as('${DOCDIR}/ScintillaLicense.txt', 'scintilla/License.txt')
|
|
|
|
if is_win32:
|
|
|
|
bld.install_as('${DOCDIR}/ReadMe.I18n.txt', 'README.I18N')
|
|
|
|
bld.install_as('${DOCDIR}/Hacking.txt', 'HACKING')
|
|
|
|
# Data
|
|
|
|
data_dir = '' if is_win32 else 'geany'
|
|
|
|
start_dir = bld.path.find_dir('data')
|
|
|
|
bld.install_as('${DATADIR}/%s/GPL-2' % data_dir, 'COPYING')
|
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, start_dir.ant_glob('filetype*'), cwd=start_dir)
|
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, start_dir.ant_glob('*.tags'), cwd=start_dir)
|
2011-12-11 12:00:46 +01:00
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, 'data/geany.glade')
|
2010-11-11 13:43:47 +00:00
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, 'data/snippets.conf')
|
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, 'data/ui_toolbar.xml')
|
2013-03-11 19:54:28 +01:00
|
|
|
if bld.env['use_gtk3']:
|
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, 'data/geany.css')
|
|
|
|
else:
|
|
|
|
bld.install_files('${DATADIR}/%s' % data_dir, 'data/geany.gtkrc')
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
start_dir = bld.path.find_dir('data/colorschemes')
|
|
|
|
template_dest = '${DATADIR}/%s/colorschemes' % data_dir
|
|
|
|
bld.install_files(template_dest, start_dir.ant_glob('*'), cwd=start_dir)
|
|
|
|
start_dir = bld.path.find_dir('data/templates')
|
|
|
|
template_dest = '${DATADIR}/%s/templates' % data_dir
|
|
|
|
bld.install_files(template_dest, start_dir.ant_glob('**/*'), cwd=start_dir, relative_trick=True)
|
|
|
|
# Icons
|
2013-01-15 22:28:00 +01:00
|
|
|
for dest, srcs in geany_icons.items():
|
2013-01-14 19:20:01 +01:00
|
|
|
dest_dir = os.path.join('${PREFIX}/share/icons' if is_win32 else '${DATADIR}/icons', dest)
|
2013-01-15 22:28:00 +01:00
|
|
|
bld.install_files(dest_dir, srcs, cwd=bld.path.find_dir('icons'))
|
|
|
|
# install theme indexes on Windows
|
|
|
|
if is_win32:
|
|
|
|
for dest, srcs in geany_icons_indexes.items():
|
|
|
|
bld.install_files(os.path.join('${PREFIX}/share/icons', dest), srcs, cwd=bld.path.find_dir('icons'))
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def distclean(ctx):
|
|
|
|
Scripting.distclean(ctx)
|
|
|
|
_remove_linguas_file()
|
|
|
|
|
|
|
|
|
|
|
|
def _remove_linguas_file():
|
|
|
|
# remove LINGUAS file as well
|
|
|
|
try:
|
|
|
|
os.unlink(LINGUAS_FILE)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@feature('linguas')
|
2013-04-14 15:02:36 +03:00
|
|
|
@before_method('apply_intltool_po')
|
2010-01-17 18:37:34 +00:00
|
|
|
def write_linguas_file(self):
|
2010-11-11 13:43:47 +00:00
|
|
|
if os.path.exists(LINGUAS_FILE):
|
|
|
|
return
|
|
|
|
linguas = ''
|
|
|
|
if 'LINGUAS' in self.env:
|
|
|
|
files = self.env['LINGUAS']
|
|
|
|
for po_filename in files.split(' '):
|
2012-04-12 23:07:33 +02:00
|
|
|
if os.path.exists('po/%s.po' % po_filename):
|
2010-11-11 13:43:47 +00:00
|
|
|
linguas += '%s ' % po_filename
|
|
|
|
else:
|
|
|
|
files = os.listdir('%s/po' % self.path.abspath())
|
|
|
|
files.sort()
|
|
|
|
for filename in files:
|
|
|
|
if filename.endswith('.po'):
|
|
|
|
linguas += '%s ' % filename[:-3]
|
|
|
|
file_h = open(LINGUAS_FILE, 'w')
|
|
|
|
file_h.write('# This file is autogenerated. Do not edit.\n%s\n' % linguas)
|
|
|
|
file_h.close()
|
|
|
|
|
|
|
|
|
|
|
|
def _post_install(ctx):
|
|
|
|
is_win32 = _target_is_win32(ctx)
|
|
|
|
if is_win32:
|
|
|
|
return
|
2012-10-17 22:18:54 +02:00
|
|
|
for d in 'hicolor', 'Tango':
|
|
|
|
theme_dir = Utils.subst_vars('${DATADIR}/icons/' + d, ctx.env)
|
|
|
|
icon_cache_updated = False
|
|
|
|
if not ctx.options.destdir:
|
|
|
|
ctx.exec_command('gtk-update-icon-cache -q -f -t %s' % theme_dir)
|
|
|
|
Logs.pprint('GREEN', 'GTK icon cache updated.')
|
|
|
|
icon_cache_updated = True
|
|
|
|
if not icon_cache_updated:
|
|
|
|
Logs.pprint('YELLOW', 'Icon cache not updated. After install, run this:')
|
|
|
|
Logs.pprint('YELLOW', 'gtk-update-icon-cache -q -f -t %s' % theme_dir)
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def updatepo(ctx):
|
|
|
|
"""update the message catalogs for internationalization"""
|
|
|
|
potfile = '%s.pot' % APPNAME
|
|
|
|
os.chdir('%s/po' % top)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
old_size = os.stat(potfile).st_size
|
|
|
|
except OSError:
|
|
|
|
old_size = 0
|
|
|
|
ctx.exec_command('intltool-update --pot -g %s' % APPNAME)
|
|
|
|
size_new = os.stat(potfile).st_size
|
|
|
|
if size_new != old_size:
|
|
|
|
Logs.pprint('CYAN', 'Updated POT file.')
|
|
|
|
Logs.pprint('CYAN', 'Updating translations')
|
|
|
|
ret = ctx.exec_command('intltool-update -r -g %s' % APPNAME)
|
|
|
|
if ret != 0:
|
|
|
|
Logs.pprint('RED', 'Updating translations failed')
|
|
|
|
else:
|
|
|
|
Logs.pprint('CYAN', 'POT file is up to date.')
|
|
|
|
except OSError:
|
|
|
|
Logs.pprint('RED', 'Failed to generate pot file.')
|
|
|
|
|
|
|
|
|
|
|
|
def apidoc(ctx):
|
|
|
|
"""generate API reference documentation"""
|
2014-08-29 16:12:40 +02:00
|
|
|
ctx = BuildContext() # create our own context to have ctx.top_dir
|
|
|
|
basedir = ctx.top_dir
|
2010-11-11 13:43:47 +00:00
|
|
|
doxygen = _find_program(ctx, 'doxygen')
|
2014-08-29 16:12:40 +02:00
|
|
|
doxyfile = '%s/doc/Doxyfile' % ctx.out_dir
|
2010-11-11 13:43:47 +00:00
|
|
|
Logs.pprint('CYAN', 'Generating API documentation')
|
|
|
|
ret = ctx.exec_command('%s %s' % (doxygen, doxyfile))
|
|
|
|
if ret != 0:
|
|
|
|
raise WafError('Generating API documentation failed')
|
|
|
|
|
|
|
|
|
2014-08-29 14:13:57 +02:00
|
|
|
def hackingdoc(ctx):
|
|
|
|
"""generate HACKING documentation"""
|
2014-08-29 16:12:40 +02:00
|
|
|
ctx = BuildContext() # create our own context to have ctx.top_dir
|
2014-08-29 14:13:57 +02:00
|
|
|
Logs.pprint('CYAN', 'Generating HACKING documentation')
|
|
|
|
cmd = _find_rst2html(ctx)
|
2014-08-29 16:12:40 +02:00
|
|
|
hacking_file = os.path.join(ctx.top_dir, 'HACKING')
|
|
|
|
hacking_html_file = os.path.join(ctx.top_dir, 'doc', 'hacking.html')
|
|
|
|
stylesheet = os.path.join(ctx.top_dir, 'doc', 'geany.css')
|
|
|
|
ret = ctx.exec_command('%s -stg --stylesheet=%s %s %s' % (
|
|
|
|
cmd, stylesheet, hacking_file, hacking_html_file))
|
2014-08-29 14:13:57 +02:00
|
|
|
if ret != 0:
|
|
|
|
raise WafError('Generating HACKING documentation failed')
|
|
|
|
|
|
|
|
|
2010-11-11 13:43:47 +00:00
|
|
|
def _find_program(ctx, cmd, **kw):
|
|
|
|
def noop(*args):
|
|
|
|
pass
|
|
|
|
|
2014-08-29 15:46:44 +02:00
|
|
|
if ctx is None or not isinstance(ctx, ConfigurationContext):
|
|
|
|
ctx = ConfigurationContext()
|
|
|
|
ctx.to_log = noop
|
|
|
|
ctx.msg = noop
|
2010-11-11 13:43:47 +00:00
|
|
|
return ctx.find_program(cmd, **kw)
|
|
|
|
|
|
|
|
|
|
|
|
def _find_rst2html(ctx):
|
2014-08-29 15:40:47 +02:00
|
|
|
cmds = ['rst2html', 'rst2html2']
|
2010-11-11 13:43:47 +00:00
|
|
|
for command in cmds:
|
2014-08-29 15:40:47 +02:00
|
|
|
cmd = _find_program(ctx, command, mandatory=False, exts=',.py')
|
2010-11-11 13:43:47 +00:00
|
|
|
if cmd:
|
|
|
|
break
|
|
|
|
if not cmd:
|
|
|
|
raise WafError(
|
|
|
|
'rst2html.py could not be found. Please install the Python docutils package.')
|
|
|
|
return cmd
|
|
|
|
|
|
|
|
|
|
|
|
def _add_define_to_env(conf, key):
|
|
|
|
value = conf.get_define(key)
|
|
|
|
# strip quotes
|
|
|
|
value = value.replace('"', '')
|
|
|
|
conf.env[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
def _add_to_env_and_define(conf, key, value, quote=False):
|
|
|
|
conf.define(key, value, quote)
|
|
|
|
conf.env[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
def _define_from_opt(conf, define_name, opt_value, default_value, quote=1):
|
|
|
|
value = default_value
|
|
|
|
if opt_value:
|
|
|
|
if isinstance(opt_value, bool):
|
|
|
|
opt_value = 1
|
|
|
|
value = opt_value
|
|
|
|
|
|
|
|
if value is not None:
|
|
|
|
_add_to_env_and_define(conf, define_name, value, quote)
|
|
|
|
else:
|
|
|
|
conf.undefine(define_name)
|
|
|
|
|
|
|
|
|
2011-10-09 22:46:19 +02:00
|
|
|
def _get_git_rev(conf):
|
2014-04-13 10:43:55 +02:00
|
|
|
if conf.options.no_scm:
|
|
|
|
return
|
|
|
|
|
2011-10-09 22:46:19 +02:00
|
|
|
if not os.path.isdir('.git'):
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
cmd = 'git rev-parse --short --revs-only HEAD'
|
2011-10-10 00:34:42 +02:00
|
|
|
revision = conf.cmd_and_log(cmd).strip()
|
2011-10-09 22:46:19 +02:00
|
|
|
except WafError:
|
|
|
|
return None
|
|
|
|
else:
|
|
|
|
return revision
|
2010-11-11 13:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def _load_intltool_if_available(conf):
|
|
|
|
try:
|
2013-04-14 15:02:36 +03:00
|
|
|
conf.load('intltool')
|
2010-11-11 13:43:47 +00:00
|
|
|
if 'LINGUAS' in os.environ:
|
|
|
|
conf.env['LINGUAS'] = os.environ['LINGUAS']
|
|
|
|
except WafError:
|
|
|
|
# on Windows, we don't hard depend on intltool, on all other platforms raise an error
|
|
|
|
if not _target_is_win32(conf):
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
def _target_is_win32(ctx):
|
|
|
|
if 'is_win32' in ctx.env:
|
|
|
|
# cached
|
|
|
|
return ctx.env['is_win32']
|
|
|
|
is_win32 = None
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
is_win32 = True
|
|
|
|
if is_win32 is None:
|
|
|
|
if ctx.env and 'CC' in ctx.env:
|
|
|
|
env_cc = ctx.env['CC']
|
|
|
|
if not isinstance(env_cc, str):
|
|
|
|
env_cc = ''.join(env_cc)
|
|
|
|
is_win32 = (env_cc.find('mingw') != -1)
|
|
|
|
if is_win32 is None:
|
|
|
|
is_win32 = False
|
|
|
|
# cache for future checks
|
|
|
|
ctx.env['is_win32'] = is_win32
|
|
|
|
return is_win32
|
|
|
|
|
|
|
|
|
|
|
|
def _uc_first(string, ctx):
|
|
|
|
if _target_is_win32(ctx):
|
|
|
|
return string.title()
|
|
|
|
return string
|