2 # -*- coding: utf-8 -*-
4 # WAF build script - this file is part of Geany, a fast and lightweight IDE
6 # Copyright 2008-2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
7 # Copyright 2008-2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 This is a WAF build script (http://code.google.com/p/waf/).
27 It can be used as an alternative build system to autotools
28 for Geany. It does not (yet) cover all of the autotools tests and
29 configure options but all important things are working.
30 "make dist" should be done with autotools, most other targets and
31 functions should work better (regarding performance and flexibility)
34 Missing features: --enable-binreloc, make targets: dist, pdf (in doc/)
35 Known issues: Dependency handling is buggy, e.g. if src/document.h is
36 changed, depending source files are not rebuilt (maybe Waf bug).
38 The code of this file itself loosely follows PEP 8 with some exceptions
39 (line width 100 characters and some other minor things).
41 Requires WAF 1.5.7 and Python 2.4 (or later).
53 from distutils
import version
63 tagmanager_sources
= [
64 'tagmanager/args.c', 'tagmanager/abc.c', 'tagmanager/actionscript.c', 'tagmanager/asm.c',
65 'tagmanager/basic.c', 'tagmanager/c.c',
66 'tagmanager/conf.c', 'tagmanager/css.c', 'tagmanager/ctags.c', 'tagmanager/diff.c',
67 'tagmanager/docbook.c', 'tagmanager/entry.c', 'tagmanager/fortran.c', 'tagmanager/get.c',
68 'tagmanager/haskell.c', 'tagmanager/haxe.c', 'tagmanager/html.c', 'tagmanager/js.c',
69 'tagmanager/keyword.c', 'tagmanager/latex.c', 'tagmanager/lregex.c', 'tagmanager/lua.c',
70 'tagmanager/make.c', 'tagmanager/markdown.c', 'tagmanager/matlab.c', 'tagmanager/nsis.c',
71 'tagmanager/nestlevel.c', 'tagmanager/options.c',
72 'tagmanager/parse.c', 'tagmanager/pascal.c',
73 'tagmanager/perl.c', 'tagmanager/php.c', 'tagmanager/python.c', 'tagmanager/read.c',
74 'tagmanager/rest.c', 'tagmanager/ruby.c', 'tagmanager/sh.c', 'tagmanager/sort.c',
75 'tagmanager/sql.c', 'tagmanager/strlist.c', 'tagmanager/txt2tags.c', 'tagmanager/tcl.c',
76 'tagmanager/tm_file_entry.c',
77 'tagmanager/tm_project.c', 'tagmanager/tm_source_file.c', 'tagmanager/tm_symbol.c',
78 'tagmanager/tm_tag.c', 'tagmanager/tm_tagmanager.c', 'tagmanager/tm_work_object.c',
79 'tagmanager/tm_workspace.c', 'tagmanager/vhdl.c', 'tagmanager/vstring.c' ]
82 'scintilla/AutoComplete.cxx', 'scintilla/CallTip.cxx', 'scintilla/CellBuffer.cxx',
83 'scintilla/CharClassify.cxx', 'scintilla/ContractionState.cxx', 'scintilla/Decoration.cxx',
84 'scintilla/DocumentAccessor.cxx', 'scintilla/Document.cxx', 'scintilla/Editor.cxx',
85 'scintilla/ExternalLexer.cxx', 'scintilla/Indicator.cxx', 'scintilla/KeyMap.cxx',
86 'scintilla/KeyWords.cxx',
87 'scintilla/LexAda.cxx', 'scintilla/LexAsm.cxx', 'scintilla/LexBash.cxx',
88 'scintilla/LexBasic.cxx', 'scintilla/LexCaml.cxx', 'scintilla/LexCmake.cxx', 'scintilla/LexCPP.cxx',
89 'scintilla/LexCrontab.cxx', 'scintilla/LexCSS.cxx', 'scintilla/LexD.cxx',
90 'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx',
91 'scintilla/LexLua.cxx', 'scintilla/LexMarkdown.cxx', 'scintilla/LexMatlab.cxx',
92 'scintilla/LexNsis.cxx', 'scintilla/LexOthers.cxx',
93 'scintilla/LexPascal.cxx', 'scintilla/LexPerl.cxx', 'scintilla/LexPython.cxx',
95 'scintilla/LexRuby.cxx', 'scintilla/LexSQL.cxx', 'scintilla/LexTCL.cxx',
96 'scintilla/LexVHDL.cxx', 'scintilla/LexYAML.cxx',
97 'scintilla/LineMarker.cxx', 'scintilla/PerLine.cxx',
98 'scintilla/PlatGTK.cxx',
99 'scintilla/PositionCache.cxx', 'scintilla/PropSet.cxx', 'scintilla/RESearch.cxx',
100 'scintilla/RunStyles.cxx', 'scintilla/ScintillaBase.cxx', 'scintilla/ScintillaGTK.cxx',
101 'scintilla/scintilla-marshal.c', 'scintilla/StyleContext.cxx', 'scintilla/Style.cxx',
102 'scintilla/UniConversion.cxx', 'scintilla/ViewStyle.cxx', 'scintilla/WindowAccessor.cxx',
103 'scintilla/XPM.cxx' ]
106 'src/about.c', 'src/build.c', 'src/callbacks.c', 'src/dialogs.c', 'src/document.c',
107 'src/editor.c', 'src/encodings.c', 'src/filetypes.c', 'src/geanyentryaction.c',
108 'src/geanymenubuttonaction.c', 'src/geanyobject.c', 'src/geanywraplabel.c',
109 'src/highlighting.c', 'src/interface.c', 'src/keybindings.c',
110 'src/keyfile.c', 'src/log.c', 'src/main.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c',
111 'src/plugins.c', 'src/pluginutils.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c',
112 'src/sciwrappers.c', 'src/search.c', 'src/socket.c', 'src/stash.c',
114 'src/templates.c', 'src/toolbar.c', 'src/tools.c', 'src/sidebar.c',
115 'src/ui_utils.c', 'src/utils.c' ]
120 def conf_get_svn_rev():
122 if os
.path
.exists('.git'):
123 cmds
= [ 'git svn find-rev HEAD 2>/dev/null',
124 'git svn find-rev origin/trunk 2>/dev/null',
125 'git svn find-rev trunk 2>/dev/null',
126 'git svn find-rev master 2>/dev/null' ]
129 stdout
= Utils
.cmd_output(c
)
131 return stdout
.strip()
135 elif os
.path
.exists('.svn'):
137 _env
= None if is_win32
else {'LANG' : 'C'}
138 stdout
= Utils
.cmd_output(cmd
='svn info --non-interactive', silent
=True, env
=_env
)
139 lines
= stdout
.splitlines(True)
141 if line
.startswith('Last Changed Rev'):
142 key
, value
= line
.split(': ', 1)
150 def conf_define_from_opt(define_name
, opt_name
, default_value
, quote
=1):
152 if isinstance(opt_name
, bool):
154 conf
.define(define_name
, opt_name
, quote
)
156 conf
.define(define_name
, default_value
, quote
)
159 conf
.check_tool('compiler_cc')
160 is_win32
= target_is_win32(conf
.env
)
162 conf
.check(header_name
='fcntl.h')
163 conf
.check(header_name
='fnmatch.h')
164 conf
.check(header_name
='glob.h')
165 conf
.check(header_name
='sys/time.h')
166 conf
.check(header_name
='sys/types.h')
167 conf
.check(header_name
='sys/stat.h')
168 conf
.define('HAVE_STDLIB_H', 1) # are there systems without stdlib.h?
169 conf
.define('STDC_HEADERS', 1) # an optimistic guess ;-)
171 if Options
.options
.gnu_regex
:
172 conf
.define('HAVE_REGCOMP', 1, 0)
173 conf
.define('USE_INCLUDED_REGEX', 1, 0)
175 conf
.check(header_name
='regex.h')
176 if conf
.env
['HAVE_REGEX_H'] == 1:
177 conf
.check(function_name
='regcomp', header_name
='regex.h')
178 # fallback to included regex lib
179 if conf
.env
['HAVE_REGCOMP'] != 1 or conf
.env
['HAVE_REGEX_H'] != 1:
180 conf
.define('HAVE_REGCOMP', 1, 0)
181 conf
.define('USE_INCLUDED_REGEX', 1, 0)
182 Utils
.pprint('YELLOW', 'Using included GNU regex library.')
184 conf
.check(function_name
='fgetpos', header_name
='stdio.h')
185 conf
.check(function_name
='ftruncate', header_name
='unistd.h')
186 conf
.check(function_name
='gethostname', header_name
='unistd.h')
187 conf
.check(function_name
='mkstemp', header_name
='stdlib.h')
188 conf
.check(function_name
='strstr', header_name
='string.h', mandatory
=True)
190 # check for cxx after the header and function checks have been done to ensure they are
191 # checked with cc not cxx
192 conf
.check_tool('compiler_cxx misc')
194 conf
.check_tool('winres')
195 # we don't require intltool on Windows (it would require Perl) though it works well
197 conf
.check_tool('intltool')
202 # GTK / GIO version check
203 conf
.check_cfg(package
='gtk+-2.0', atleast_version
='2.8.0', uselib_store
='GTK',
204 mandatory
=True, args
='--cflags --libs')
206 gtk_version
= conf
.check_cfg(modversion
='gtk+-2.0', uselib_store
='GTK')
208 if version
.LooseVersion(gtk_version
) >= version
.LooseVersion('2.10.0'):
211 gtk_version
= 'Unknown'
212 conf
.check_cfg(package
='gio-2.0', uselib_store
='GIO', args
='--cflags --libs', mandatory
=False)
216 if conf
.env
['PREFIX'] == tempfile
.gettempdir():
217 # overwrite default prefix on Windows (tempfile.gettempdir() is the Waf default)
218 conf
.define('PREFIX', os
.path
.join(conf
.srcdir
, '%s-%s' % (APPNAME
, VERSION
)), 1)
219 conf
.define('DOCDIR', os
.path
.join(conf
.env
['PREFIX'], 'doc'), 1)
220 conf
.define('LOCALEDIR', os
.path
.join(conf
.env
['PREFIX'], 'share\locale'), 1)
221 conf
.define('LIBDIR', conf
.env
['PREFIX'], 1)
222 # DATADIR is defined in objidl.h, so we remove it from config.h but keep it in env
223 conf
.undefine('DATADIR')
224 conf
.env
['DATADIR'] = os
.path
.join(conf
.env
['PREFIX'], 'data')
225 # hack: we add the parent directory of the first include directory as this is missing in
226 # list returned from pkg-config
227 conf
.env
['CPPPATH_GTK'].insert(0, os
.path
.dirname(conf
.env
['CPPPATH_GTK'][0]))
228 # we don't need -fPIC when compiling on or for Windows
229 if '-fPIC' in conf
.env
['shlib_CCFLAGS']:
230 conf
.env
['shlib_CCFLAGS'].remove('-fPIC')
231 if '-fPIC' in conf
.env
['CXXFLAGS']:
232 conf
.env
['CXXFLAGS'].remove('-fPIC')
233 conf
.env
.append_value('program_LINKFLAGS', '-mwindows')
234 conf
.env
.append_value('LIB_WIN32', [ 'wsock32', 'uuid', 'ole32', 'iberty' ])
235 conf
.env
['shlib_PATTERN'] = '%s.dll'
236 conf
.env
['program_PATTERN'] = '%s.exe'
238 conf
.env
['shlib_PATTERN'] = '%s.so'
239 conf_define_from_opt('DOCDIR', Options
.options
.docdir
,
240 os
.path
.join(conf
.env
['DATADIR'], 'doc/geany'))
241 conf_define_from_opt('LIBDIR', Options
.options
.libdir
,
242 os
.path
.join(conf
.env
['PREFIX'], 'lib'))
243 conf_define_from_opt('MANDIR', Options
.options
.mandir
,
244 os
.path
.join(conf
.env
['DATADIR'], 'man'))
246 svn_rev
= conf_get_svn_rev()
247 conf
.define('ENABLE_NLS', 1)
248 conf
.define('GEANY_LOCALEDIR', '' if is_win32
else conf
.env
['LOCALEDIR'], 1)
249 conf
.define('GEANY_DATADIR', 'data' if is_win32
else conf
.env
['DATADIR'], 1)
250 conf
.define('GEANY_DOCDIR', conf
.env
['DOCDIR'], 1)
251 conf
.define('GEANY_LIBDIR', '' if is_win32
else conf
.env
['LIBDIR'], 1)
252 conf
.define('GEANY_PREFIX', '' if is_win32
else conf
.env
['PREFIX'], 1)
253 conf
.define('PACKAGE', APPNAME
, 1)
254 conf
.define('VERSION', VERSION
, 1)
255 conf
.define('REVISION', svn_rev
, 1)
257 conf
.define('GETTEXT_PACKAGE', APPNAME
, 1)
259 conf_define_from_opt('HAVE_PLUGINS', not Options
.options
.no_plugins
, None, 0)
260 conf_define_from_opt('HAVE_SOCKET', not Options
.options
.no_socket
, None, 0)
261 conf_define_from_opt('HAVE_VTE', not Options
.options
.no_vte
, None, 0)
263 conf
.write_config_header('config.h')
265 Utils
.pprint('BLUE', 'Summary:')
266 print_message(conf
, 'Install Geany ' + VERSION
+ ' in', conf
.env
['PREFIX'])
267 print_message(conf
, 'Using GTK version', gtk_version
)
268 print_message(conf
, 'Build with GTK printing support', have_gtk_210
and 'yes' or 'no')
269 print_message(conf
, 'Build with plugin support', Options
.options
.no_plugins
and 'no' or 'yes')
270 print_message(conf
, 'Use virtual terminal support', Options
.options
.no_vte
and 'no' or 'yes')
272 print_message(conf
, 'Compiling Subversion revision', svn_rev
)
273 conf
.env
.append_value('CCFLAGS', '-g -DGEANY_DEBUG'.split())
275 conf
.env
.append_value('CCFLAGS', '-DHAVE_CONFIG_H')
276 # for now define GEANY_PRIVATE for all files, even though it should just be for src/*.
277 conf
.env
.append_value('CCFLAGS', '-DGEANY_PRIVATE')
279 conf
.env
.append_value('CXXFLAGS',
280 '-DNDEBUG -DGTK -DGTK2 -DSCI_LEXER -DG_THREADS_IMPL_NONE'.split())
283 def set_options(opt
):
284 opt
.tool_options('compiler_cc')
285 opt
.tool_options('compiler_cxx')
286 opt
.tool_options('intltool')
288 if 'configure' in sys
.argv
:
290 opt
.add_option('--disable-plugins', action
='store_true', default
=False,
291 help='compile without plugin support [default: No]', dest
='no_plugins')
292 opt
.add_option('--disable-socket', action
='store_true', default
=False,
293 help='compile without support to detect a running instance [[default: No]',
295 opt
.add_option('--disable-vte', action
='store_true', default
=target_is_win32(os
.environ
),
296 help='compile without support for an embedded virtual terminal [[default: No]',
298 opt
.add_option('--enable-gnu-regex', action
='store_true', default
=False,
299 help='compile with included GNU regex library [default: No]', dest
='gnu_regex')
301 opt
.add_option('--mandir', type='string', default
='',
302 help='man documentation', dest
='mandir')
303 opt
.add_option('--docdir', type='string', default
='',
304 help='documentation root', dest
='docdir')
305 opt
.add_option('--libdir', type='string', default
='',
306 help='object code libraries', dest
='libdir')
308 opt
.add_option('--htmldoc', action
='store_true', default
=False,
309 help='generate HTML documentation', dest
='htmldoc')
310 opt
.add_option('--hackingdoc', action
='store_true', default
=False,
311 help='generate HTML documentation from HACKING file', dest
='hackingdoc')
312 opt
.add_option('--apidoc', action
='store_true', default
=False,
313 help='generate API reference documentation', dest
='apidoc')
314 opt
.add_option('--update-po', action
='store_true', default
=False,
315 help='update the message catalogs for translation', dest
='update_po')
319 is_win32
= target_is_win32(bld
.env
)
321 def build_plugin(plugin_name
, install
= True):
323 instpath
= '${PREFIX}/lib' if is_win32
else '${LIBDIR}/geany/'
328 features
= 'cc cshlib',
329 source
= 'plugins/' + plugin_name
+ '.c',
330 includes
= '. plugins/ src/ scintilla/include tagmanager/include',
331 target
= plugin_name
,
333 install_path
= instpath
338 if bld
.env
['USE_INCLUDED_REGEX'] == 1:
339 tagmanager_sources
.append('tagmanager/regex.c')
341 features
= 'cc cstaticlib',
342 source
= tagmanager_sources
,
344 target
= 'tagmanager',
345 includes
= '. tagmanager/ tagmanager/include/',
347 install_path
= None # do not install this library
352 features
= 'cc cxx cstaticlib',
354 target
= 'scintilla',
355 source
= scintilla_sources
,
356 includes
= 'scintilla/ scintilla/include/',
358 install_path
= None, # do not install this library
362 if bld
.env
['HAVE_VTE'] == 1:
363 geany_sources
.append('src/vte.c')
365 geany_sources
.append('src/win32.c')
368 features
= 'cc cxx cprogram',
371 source
= geany_sources
,
372 includes
= '. src/ scintilla/include/ tagmanager/include/',
373 uselib
= 'GTK GIO WIN32',
374 uselib_local
= 'scintilla tagmanager',
375 add_objects
= 'geany-rc' if is_win32
else None
380 source
= 'plugins/genapi.py src/plugins.c',
381 name
= 'geanyfunctions.h',
383 cwd
= '%s/plugins' % bld
.path
.abspath(),
384 rule
= 'python genapi.py -q'
388 if bld
.env
['HAVE_PLUGINS'] == 1:
389 build_plugin('classbuilder')
390 build_plugin('demoplugin', False)
391 build_plugin('export')
392 build_plugin('filebrowser')
393 build_plugin('htmlchars')
394 build_plugin('saveactions')
395 build_plugin('splitwindow', not is_win32
)
398 if bld
.env
['INTLTOOL']:
400 features
= 'intltool_po',
402 install_path
= '${LOCALEDIR}',
409 source
= 'geany.pc.in',
411 dict = { 'VERSION' : VERSION
,
412 'prefix': bld
.env
['PREFIX'],
413 'exec_prefix': '${prefix}',
414 'libdir': '${exec_prefix}/lib',
415 'includedir': '${prefix}/include',
416 'datarootdir': '${prefix}/share',
417 'datadir': '${datarootdir}',
418 'localedir': '${datarootdir}/locale' },
419 install_path
= None if is_win32
else '${LIBDIR}/pkgconfig'
424 if bld
.env
['INTLTOOL']:
426 features
= 'intltool_in',
427 source
= 'geany.desktop.in',
428 flags
= [ '-d', '-q', '-u', '-c' ],
429 install_path
= '${DATADIR}/applications'
435 source
= 'doc/geany.1.in',
437 dict = { 'VERSION' : VERSION
,
438 'GEANY_DATA_DIR': bld
.env
['DATADIR'] + '/geany' },
439 install_path
= '${MANDIR}/man1'
445 source
= 'geany.spec.in',
446 target
= 'geany.spec',
448 dict = { 'VERSION' : VERSION
}
454 source
= 'doc/Doxyfile.in',
455 target
= 'doc/Doxyfile',
457 dict = { 'VERSION' : VERSION
}
463 source
= 'geany_private.rc'
471 bld
.install_files('${PREFIX}/include/geany', '''
472 src/document.h src/editor.h src/encodings.h src/filetypes.h src/geany.h
473 src/highlighting.h src/keybindings.h src/msgwindow.h src/plugindata.h
474 src/prefs.h src/project.h src/search.h src/support.h
475 src/templates.h src/toolbar.h src/ui_utils.h src/utils.h plugins/pluginmacros.h
476 plugins/geanyplugin.h plugins/geanyfunctions.h''')
477 bld
.install_files('${PREFIX}/include/geany/scintilla', '''
478 scintilla/include/SciLexer.h scintilla/include/Scintilla.h
479 scintilla/include/Scintilla.iface scintilla/include/ScintillaWidget.h ''')
480 bld
.install_files('${PREFIX}/include/geany/tagmanager', '''
481 tagmanager/include/tm_file_entry.h tagmanager/include/tm_project.h
482 tagmanager/include/tm_source_file.h
483 tagmanager/include/tm_symbol.h tagmanager/include/tm_tag.h
484 tagmanager/include/tm_tagmanager.h tagmanager/include/tm_work_object.h
485 tagmanager/include/tm_workspace.h ''')
487 base_dir
= '${PREFIX}' if is_win32
else '${DOCDIR}'
488 ext
= '.txt' if is_win32
else ''
489 html_dir
= '' if is_win32
else 'html/'
490 html_name
= 'Manual.html' if is_win32
else 'index.html'
491 for f
in 'AUTHORS ChangeLog COPYING README NEWS THANKS TODO'.split():
492 bld
.install_as("%s/%s%s" % (base_dir
, uc_first(f
, is_win32
), ext
), f
)
493 bld
.install_files('${DOCDIR}/%simages' % html_dir
, 'doc/images/*.png')
494 bld
.install_as('${DOCDIR}/%s' % uc_first('manual.txt', is_win32
), 'doc/geany.txt')
495 bld
.install_as('${DOCDIR}/%s%s' % (html_dir
, html_name
), 'doc/geany.html')
496 bld
.install_as('${DOCDIR}/ScintillaLicense.txt', 'scintilla/License.txt')
498 bld
.install_as('${DOCDIR}/ReadMe.I18n.txt', 'README.I18N')
499 bld
.install_as('${DOCDIR}/Hacking.txt', 'HACKING')
501 dir = '' if is_win32
else 'geany'
502 bld
.install_files('${DATADIR}/%s' % dir, 'data/filetype*')
503 bld
.install_files('${DATADIR}/%s' % dir, 'data/*.tags')
504 bld
.install_files('${DATADIR}/%s' % dir, 'data/snippets.conf')
505 bld
.install_files('${DATADIR}/%s' % dir, 'data/ui_toolbar.xml')
506 bld
.install_files('${DATADIR}/%s/templates/files' % dir, 'data/templates/files/*.*')
507 bld
.install_as('${DATADIR}/%s/GPL-2' % dir, 'COPYING')
509 bld
.install_files('${PREFIX}/share/icons'
510 if is_win32
else '${DATADIR}/icons/hicolor/16x16/apps', 'icons/16x16/*.png')
512 bld
.install_files('${DATADIR}/icons/hicolor/48x48/apps', 'icons/48x48/*.png')
513 bld
.install_files('${DATADIR}/icons/hicolor/scalable/apps', 'icons/scalable/*.svg')
517 is_win32
= False if not Build
.bld
else target_is_win32(Build
.bld
.env
)
518 # the following code was taken from midori's WAF script, thanks
519 if not is_win32
and not Options
.options
.destdir
and (Options
.commands
['install'] or \
520 Options
.commands
['uninstall']):
521 dir = Build
.bld
.get_install_path('${DATADIR}/icons/hicolor')
522 icon_cache_updated
= False
524 Utils
.exec_command('gtk-update-icon-cache -q -f -t %s' % dir)
525 Utils
.pprint('GREEN', 'GTK icon cache updated.')
526 icon_cache_updated
= True
528 Utils
.pprint('YELLOW', 'Failed to update icon cache for %s.' % dir)
529 if not icon_cache_updated
:
530 print 'Icon cache not updated. After install, run this:'
531 print 'gtk-update-icon-cache -q -f -t %s' % dir
533 if Options
.options
.apidoc
:
534 doxyfile
= os
.path
.join(Build
.bld
.srcnode
.abspath(Build
.bld
.env
), 'doc', 'Doxyfile')
535 cmd
= Configure
.find_program_impl(Build
.bld
.env
, 'doxygen')
538 ret
= launch('%s %s' % (cmd
, doxyfile
), 'Generating API reference documentation')
541 'doxygen could not be found. Please install the doxygen package.')
544 if Options
.options
.htmldoc
or Options
.options
.hackingdoc
:
545 # first try rst2html.py as it is the upstream default, fall back to rst2html
546 cmd
= Configure
.find_program_impl(Build
.bld
.env
, 'rst2html.py')
548 cmd
= Configure
.find_program_impl(Build
.bld
.env
, 'rst2html')
550 if Options
.options
.hackingdoc
:
551 file_in
= '../HACKING'
552 file_out
= 'hacking.html'
555 file_in
= 'geany.txt'
556 file_out
= 'geany.html'
559 ret
= launch(cmd
+ ' -stg --stylesheet=geany.css %s %s' % (file_in
, file_out
),
560 'Generating %s documentation' % msg
)
563 'rst2html.py could not be found. Please install the Python docutils package.')
566 if Options
.options
.update_po
:
567 # the following code was taken from midori's WAF script, thanks
568 os
.chdir('%s/po' % srcdir
)
571 size_old
= os
.stat('geany.pot').st_size
574 Utils
.exec_command('intltool-update --pot -g %s' % APPNAME
)
575 size_new
= os
.stat('geany.pot').st_size
576 if size_new
!= size_old
:
577 Utils
.pprint('CYAN', 'Updated POT file.')
578 launch('intltool-update -r -g %s' % APPNAME
, 'Updating translations', 'CYAN')
580 Utils
.pprint('CYAN', 'POT file is up to date.')
582 Utils
.pprint('RED', 'Failed to generate pot file.')
586 # Simple function to execute a command and print its exit status
587 def launch(command
, status
, success_color
='GREEN'):
589 Utils
.pprint(success_color
, status
)
591 ret
= Utils
.exec_command(command
)
594 print str(e
), ":", command
599 Utils
.pprint('RED', status
+ ' failed')
604 def print_message(conf
, msg
, result
, color
= 'GREEN'):
605 conf
.check_message_1(msg
)
606 conf
.check_message_2(result
, color
)
609 def uc_first(s
, is_win32
):
615 def target_is_win32(env
):
616 if sys
.platform
== 'win32':
618 if env
and 'CC' in env
:
620 if not isinstance(cc
, str):
622 return cc
.find('mingw') != -1