Update Waf to its latest SVN version.
Don't update po files on normal build, add target --update-po for this task. Fix wrong handling of CCFlags and CXXFlags which caused the build to hang if CFLAGS were not already set. Don't make checks for header files and functions mandatory. Update some method names to latest API changes in Waf. Various other small fixes. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2661 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
454a871de2
commit
ca0de44c11
10
ChangeLog
10
ChangeLog
@ -9,6 +9,16 @@
|
||||
Use Python from CTags SVN.
|
||||
Adapt variable parsing code from the old parser code.
|
||||
Fix three bugs (see CTags bugs #1988026, 1988027 and 1988130).
|
||||
* waf:
|
||||
Update Waf to its latest SVN version.
|
||||
* wscript:
|
||||
Don't update po files on normal build, add target --update-po for
|
||||
this task.
|
||||
Fix wrong handling of CCFlags and CXXFlags which caused the build
|
||||
to hang if CFLAGS were not already set.
|
||||
Don't make checks for header files and functions mandatory.
|
||||
Update some method names to latest API changes in Waf.
|
||||
Various other small fixes.
|
||||
|
||||
|
||||
2008-06-07 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
|
||||
|
199
wscript
199
wscript
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# WAF build script - this file is part of Geany, a fast and lightweight IDE
|
||||
@ -31,14 +31,14 @@ functions should work better (regarding performance and flexibility)
|
||||
or at least equally.
|
||||
|
||||
Missing features: --enable-binreloc, make targets: dist, pdf (in doc/)
|
||||
Known issues: Dependency handling buggy, if src/document.h is changed,
|
||||
depending source files are not rebuild (maybe Waf bug).
|
||||
Known issues: Dependency handling is buggy, e.g. if src/document.h is
|
||||
changed, depending source files are not rebuilt (maybe Waf bug).
|
||||
|
||||
Requires WAF SVN r3530 (or later) and Python (>= 2.4).
|
||||
Requires WAF SVN r3624 (or later) and Python 2.4 (or later).
|
||||
"""
|
||||
|
||||
|
||||
import Params, Configure, Common, Runner, misc
|
||||
import Params, Configure, Runner, Task, Utils, Install
|
||||
import sys, os, subprocess, shutil
|
||||
|
||||
|
||||
@ -48,9 +48,6 @@ VERSION = '0.15'
|
||||
srcdir = '.'
|
||||
blddir = 'build'
|
||||
|
||||
# enable this once Waf 1.4.3 has been released
|
||||
#~ Utils.waf_version(mini='1.4.3')
|
||||
|
||||
|
||||
def configure(conf):
|
||||
def conf_get_svn_rev():
|
||||
@ -84,7 +81,7 @@ def configure(conf):
|
||||
headerconf.run()
|
||||
|
||||
# TODO this only checks in header files, not in libraries (fix this in Waf)
|
||||
def conf_check_function(func_name, header_files = [''], mand = 1):
|
||||
def conf_check_function(func_name, header_files = '', mand = 1):
|
||||
functest = conf.create_function_enumerator()
|
||||
functest.headers = header_files
|
||||
functest.mandatory = mand
|
||||
@ -92,7 +89,7 @@ def configure(conf):
|
||||
functest.define = 'HAVE_' + func_name.upper()
|
||||
functest.run()
|
||||
|
||||
def conf_define_from_opt(define_name, opt_name, default_value, quote = 1):
|
||||
def conf_define_from_opt(define_name, opt_name, default_value, quote=1):
|
||||
if opt_name:
|
||||
if isinstance(opt_name, bool):
|
||||
opt_name = 1
|
||||
@ -100,15 +97,14 @@ def configure(conf):
|
||||
elif default_value:
|
||||
conf.define(define_name, default_value, quote)
|
||||
|
||||
conf.check_tool('compiler_cc compiler_cxx intltool')
|
||||
conf.check_tool('compiler_cc')
|
||||
|
||||
conf_check_header('fcntl.h')
|
||||
conf_check_header('fnmatch.h')
|
||||
conf_check_header('glob.h')
|
||||
conf_check_header('regex.h')
|
||||
conf_check_header('sys/time.h')
|
||||
conf_check_header('sys/types.h')
|
||||
conf_check_header('sys/stat.h')
|
||||
conf_check_header('fcntl.h', 0)
|
||||
conf_check_header('fnmatch.h', 0)
|
||||
conf_check_header('glob.h', 0)
|
||||
conf_check_header('sys/time.h', 0)
|
||||
conf_check_header('sys/types.h', 0)
|
||||
conf_check_header('sys/stat.h', 0)
|
||||
conf.define('HAVE_STDLIB_H', 1) # are there systems without stdlib.h?
|
||||
conf.define('STDC_HEADERS', 1) # an optimistic guess ;-)
|
||||
|
||||
@ -116,13 +112,25 @@ def configure(conf):
|
||||
conf.define('HAVE_REGCOMP', 1, 0)
|
||||
conf.define('USE_INCLUDED_REGEX', 1, 0)
|
||||
else:
|
||||
conf_check_function('regcomp', ['regex.h'])
|
||||
conf_check_function('fgetpos', ['stdio.h'])
|
||||
conf_check_function('ftruncate', ['unistd.h'])
|
||||
conf_check_function('gethostname', ['unistd.h'])
|
||||
conf_check_function('mkstemp', ['stdlib.h'])
|
||||
conf_check_function('strerror', ['string.h'])
|
||||
conf_check_function('strstr', ['string.h'])
|
||||
conf_check_header('regex.h', 0)
|
||||
if conf.env['HAVE_REGEX_H'] == 1:
|
||||
conf_check_function('regcomp', ['regex.h'], 0)
|
||||
# fallback to included regex lib
|
||||
if conf.env['HAVE_REGCOMP'] != 1 or conf.env['HAVE_REGEX_H'] != 1:
|
||||
conf.define('HAVE_REGCOMP', 1, 0)
|
||||
conf.define('USE_INCLUDED_REGEX', 1, 0)
|
||||
Params.pprint('YELLOW', 'Using included GNU regex library.')
|
||||
|
||||
conf_check_function('fgetpos', ['stdio.h'], 0)
|
||||
conf_check_function('ftruncate', ['unistd.h'], 0)
|
||||
conf_check_function('gethostname', ['unistd.h'], 0)
|
||||
conf_check_function('mkstemp', ['stdlib.h'], 0)
|
||||
conf_check_function('strerror', ['string.h'], 0)
|
||||
conf_check_function('strstr', ['string.h'], 1)
|
||||
|
||||
# check for cxx after the header and function checks have been done to ensure they are
|
||||
# checked with cc not cxx
|
||||
conf.check_tool('compiler_cxx intltool misc')
|
||||
|
||||
# first check for GTK 2.10 for GTK printing message
|
||||
conf.check_pkg('gtk+-2.0', destvar='GTK', vnum='2.10.0')
|
||||
@ -164,9 +172,10 @@ def configure(conf):
|
||||
print_message('Use virtual terminal support', Params.g_options.no_vte and 'no' or 'yes')
|
||||
if svn_rev != '-1':
|
||||
print_message('Compiling Subversion revision', svn_rev)
|
||||
conf.env['CCFLAGS'] += ' -g -DGEANY_DEBUG'
|
||||
conf.env.append_value('CCFLAGS', '-g -DGEANY_DEBUG')
|
||||
|
||||
conf.env['CCFLAGS'] += ' -DHAVE_CONFIG_H'
|
||||
conf.env.append_value('CCFLAGS', '-DHAVE_CONFIG_H')
|
||||
conf.env.append_value('CXXFLAGS', ' -DNDEBUG -Os -DGTK -DGTK2 -DSCI_LEXER -DG_THREADS_IMPL_NONE')
|
||||
|
||||
|
||||
def set_options(opt):
|
||||
@ -192,42 +201,16 @@ def set_options(opt):
|
||||
help='object code libraries', dest='libdir')
|
||||
# Actions
|
||||
opt.add_option('--htmldoc', action='store_true', default=False,
|
||||
help='generate HTML documentation [default: No]', dest='htmldoc')
|
||||
help='generate HTML documentation', dest='htmldoc')
|
||||
opt.add_option('--apidoc', action='store_true', default=False,
|
||||
help='generate API reference documentation [default: No]', dest='apidoc')
|
||||
help='generate API reference documentation', dest='apidoc')
|
||||
opt.add_option('--update-po', action='store_true', default=False,
|
||||
help='update the message catalogs for translation', dest='update_po')
|
||||
|
||||
|
||||
def build(bld):
|
||||
def build_update_po(bld):
|
||||
# TODO: rework this code to not alter .po files on normal build
|
||||
# the following code was taken from midori's WAF script, thanks
|
||||
os.chdir('./po')
|
||||
try:
|
||||
try:
|
||||
size_old = os.stat('geany.pot').st_size
|
||||
except:
|
||||
size_old = 0
|
||||
subprocess.call(['intltool-update', '--pot'])
|
||||
size_new = os.stat('geany.pot').st_size
|
||||
if size_new != size_old:
|
||||
Params.pprint('YELLOW', "Updated pot file.")
|
||||
try:
|
||||
intltool_update = subprocess.Popen(['intltool-update', '-r'], stderr=subprocess.PIPE)
|
||||
intltool_update.wait()
|
||||
Params.pprint('YELLOW', "Updated translations.")
|
||||
except:
|
||||
Params.pprint('RED', "Failed to update translations.")
|
||||
except:
|
||||
Params.pprint('RED', "Failed to generate pot file.")
|
||||
os.chdir('..')
|
||||
|
||||
obj = bld.create_obj('intltool_po')
|
||||
obj.podir = 'po'
|
||||
obj.appname = 'geany'
|
||||
|
||||
|
||||
def build_plugin(plugin_name, local_inst_var = 'LIBDIR'):
|
||||
obj = bld.create_obj('cc', 'shlib')
|
||||
obj = bld.new_task_gen('cc', 'shlib')
|
||||
obj.source = 'plugins/' + plugin_name + '.c'
|
||||
obj.includes = '. plugins/ src/ scintilla/include tagmanager/include'
|
||||
obj.env['shlib_PATTERN'] = '%s.so'
|
||||
@ -238,11 +221,11 @@ def build(bld):
|
||||
#~ obj.want_libtool = 1
|
||||
|
||||
# Tagmanager
|
||||
if not Params.g_options.gnu_regex:
|
||||
excludes = ['regex.c']
|
||||
else:
|
||||
if bld.env['USE_INCLUDED_REGEX'] == 1:
|
||||
excludes = ''
|
||||
obj = bld.create_obj('cc', 'staticlib')
|
||||
else:
|
||||
excludes = ['regex.c']
|
||||
obj = bld.new_task_gen('cc', 'staticlib')
|
||||
obj.find_sources_in_dirs('tagmanager/', excludes)
|
||||
obj.name = 'tagmanager'
|
||||
obj.target = 'tagmanager'
|
||||
@ -251,7 +234,7 @@ def build(bld):
|
||||
obj.inst_var = 0 # do not install this library
|
||||
|
||||
# Scintilla
|
||||
obj = bld.create_obj('cpp', 'staticlib')
|
||||
obj = bld.new_task_gen('cxx', 'staticlib')
|
||||
obj.features.append('cc')
|
||||
obj.find_sources_in_dirs('scintilla/')
|
||||
obj.name = 'scintilla'
|
||||
@ -259,13 +242,12 @@ def build(bld):
|
||||
obj.includes = 'scintilla/ scintilla/include/'
|
||||
obj.uselib = 'GTK'
|
||||
obj.inst_var = 0 # do not install this library
|
||||
obj.env['CXXFLAGS'] += ' -DNDEBUG -Os -DGTK -DGTK2 -DSCI_LEXER -DG_THREADS_IMPL_NONE'
|
||||
|
||||
# Geany
|
||||
excludes = ['win32.c', 'gb.c', 'images.c']
|
||||
if bld.env()['HAVE_VTE'] != 1:
|
||||
if bld.env['HAVE_VTE'] != 1:
|
||||
excludes.append('vte.c')
|
||||
obj = bld.create_obj('cpp', 'program')
|
||||
obj = bld.new_task_gen('cxx', 'program')
|
||||
obj.features.append('cc')
|
||||
obj.find_sources_in_dirs('src/', excludes)
|
||||
obj.name = 'geany'
|
||||
@ -275,7 +257,7 @@ def build(bld):
|
||||
obj.uselib_local = 'scintilla tagmanager'
|
||||
|
||||
# Plugins
|
||||
if bld.env()['HAVE_PLUGINS'] == 1:
|
||||
if bld.env['HAVE_PLUGINS'] == 1:
|
||||
build_plugin('autosave')
|
||||
build_plugin('classbuilder')
|
||||
build_plugin('demoplugin', 0)
|
||||
@ -284,21 +266,24 @@ def build(bld):
|
||||
build_plugin('htmlchars')
|
||||
build_plugin('vcdiff')
|
||||
|
||||
# Translations
|
||||
obj = bld.new_task_gen('intltool_po')
|
||||
obj.podir = 'po'
|
||||
obj.appname = 'geany'
|
||||
|
||||
# geany.desktop
|
||||
obj = bld.create_obj('intltool_in')
|
||||
obj = bld.new_task_gen('intltool_in')
|
||||
obj.source = 'geany.desktop.in'
|
||||
obj.destvar = 'PREFIX'
|
||||
obj.subdir = 'share/applications'
|
||||
obj.inst_var = 'DATADIR'
|
||||
obj.inst_dir = 'applications'
|
||||
obj.flags = '-d'
|
||||
|
||||
build_update_po(bld)
|
||||
|
||||
# geany.pc
|
||||
obj = bld.create_obj('subst')
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'geany.pc.in'
|
||||
obj.target = 'geany.pc'
|
||||
obj.dict = { 'VERSION' : VERSION,
|
||||
'prefix': bld.env()['PREFIX'],
|
||||
'prefix': bld.env['PREFIX'],
|
||||
'exec_prefix': '${prefix}',
|
||||
'libdir': '${exec_prefix}/lib',
|
||||
'includedir': '${prefix}/include',
|
||||
@ -307,21 +292,21 @@ def build(bld):
|
||||
'localedir': '${datarootdir}/locale' }
|
||||
|
||||
# geany.1
|
||||
obj = bld.create_obj('subst')
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'doc/geany.1.in'
|
||||
obj.target = 'geany.1'
|
||||
obj.dict = { 'VERSION' : VERSION,
|
||||
'GEANY_DATA_DIR': bld.env()['DATADIR'] + '/geany' }
|
||||
'GEANY_DATA_DIR': bld.env['DATADIR'] + '/geany' }
|
||||
|
||||
# geany.spec
|
||||
obj = bld.create_obj('subst')
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'geany.spec.in'
|
||||
obj.target = 'geany.spec'
|
||||
obj.inst_var = 0
|
||||
obj.dict = { 'VERSION' : VERSION }
|
||||
|
||||
# Doxyfile
|
||||
obj = bld.create_obj('subst')
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'doc/Doxyfile.in'
|
||||
obj.target = 'Doxyfile'
|
||||
obj.inst_var = 0
|
||||
@ -330,43 +315,42 @@ def build(bld):
|
||||
###
|
||||
# Install files
|
||||
###
|
||||
install_files('DATADIR', 'applications', 'geany.desktop')
|
||||
install_files('LIBDIR', 'pkgconfig', 'geany.pc')
|
||||
bld.install_files('LIBDIR', 'pkgconfig', 'geany.pc')
|
||||
# Headers
|
||||
install_files('PREFIX', 'include/geany', '''
|
||||
bld.install_files('PREFIX', 'include/geany', '''
|
||||
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/msgwindow.h src/plugindata.h src/plugins.h
|
||||
src/prefs.h src/project.h src/sciwrappers.h src/search.h src/support.h src/templates.h
|
||||
src/ui_utils.h src/utils.h
|
||||
plugins/pluginmacros.h ''')
|
||||
install_files('PREFIX', 'include/geany/scintilla', '''
|
||||
bld.install_files('PREFIX', 'include/geany/scintilla', '''
|
||||
scintilla/include/SciLexer.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface
|
||||
scintilla/include/ScintillaWidget.h ''')
|
||||
install_files('PREFIX', 'include/geany/tagmanager', '''
|
||||
bld.install_files('PREFIX', 'include/geany/tagmanager', '''
|
||||
tagmanager/include/tm_file_entry.h tagmanager/include/tm_project.h tagmanager/include/tm_source_file.h
|
||||
tagmanager/include/tm_symbol.h tagmanager/include/tm_tag.h tagmanager/include/tm_tagmanager.h
|
||||
tagmanager/include/tm_work_object.h tagmanager/include/tm_workspace.h ''')
|
||||
# Docs
|
||||
install_files('MANDIR', 'man1', 'doc/geany.1')
|
||||
install_files('DOCDIR', '', 'AUTHORS ChangeLog COPYING README NEWS THANKS TODO')
|
||||
install_files('DOCDIR', 'html/images', 'doc/images/*.png')
|
||||
install_as('DOCDIR', 'manual.txt', 'doc/geany.txt')
|
||||
install_as('DOCDIR', 'html/index.html', 'doc/geany.html')
|
||||
install_as('DOCDIR', 'ScintillaLicense.txt', 'scintilla/License.txt')
|
||||
bld.install_files('MANDIR', 'man1', 'doc/geany.1')
|
||||
bld.install_files('DOCDIR', '', 'AUTHORS ChangeLog COPYING README NEWS THANKS TODO')
|
||||
bld.install_files('DOCDIR', 'html/images', 'doc/images/*.png')
|
||||
bld.install_as('DOCDIR', 'manual.txt', 'doc/geany.txt')
|
||||
bld.install_as('DOCDIR', 'html/index.html', 'doc/geany.html')
|
||||
bld.install_as('DOCDIR', 'ScintillaLicense.txt', 'scintilla/License.txt')
|
||||
# Data
|
||||
install_files('DATADIR', 'geany', 'data/filetype*')
|
||||
install_files('DATADIR', 'geany', 'data/*.tags')
|
||||
install_files('DATADIR', 'geany', 'data/snippets.conf')
|
||||
install_as('DATADIR', 'geany/GPL-2', 'COPYING')
|
||||
bld.install_files('DATADIR', 'geany', 'data/filetype*')
|
||||
bld.install_files('DATADIR', 'geany', 'data/*.tags')
|
||||
bld.install_files('DATADIR', 'geany', 'data/snippets.conf')
|
||||
bld.install_as('DATADIR', 'geany/GPL-2', 'COPYING')
|
||||
# Icons
|
||||
install_files('DATADIR', 'pixmaps', 'pixmaps/geany.png')
|
||||
install_files('DATADIR', 'icons/hicolor/16x16/apps', 'icons/16x16/*.png')
|
||||
bld.install_files('DATADIR', 'pixmaps', 'pixmaps/geany.png')
|
||||
bld.install_files('DATADIR', 'icons/hicolor/16x16/apps', 'icons/16x16/*.png')
|
||||
|
||||
|
||||
def shutdown():
|
||||
# the following code was taken from midori's WAF script, thanks
|
||||
if Params.g_commands['install'] or Params.g_commands['uninstall']:
|
||||
dir = Common.path_install('DATADIR', 'icons/hicolor')
|
||||
dir = Install.path_install('DATADIR', 'icons/hicolor')
|
||||
icon_cache_updated = False
|
||||
if not Params.g_options.destdir:
|
||||
try:
|
||||
@ -390,11 +374,30 @@ def shutdown():
|
||||
launch('rst2html -stg --stylesheet=geany.css geany.txt geany.html',
|
||||
'Generating HTML documentation')
|
||||
|
||||
if Params.g_options.update_po:
|
||||
# the following code was taken from midori's WAF script, thanks
|
||||
os.chdir('./po')
|
||||
try:
|
||||
try:
|
||||
size_old = os.stat('geany.pot').st_size
|
||||
except:
|
||||
size_old = 0
|
||||
subprocess.call(['intltool-update', '--pot'])
|
||||
size_new = os.stat('geany.pot').st_size
|
||||
if size_new != size_old:
|
||||
Params.pprint('CYAN', 'Updated POT file.')
|
||||
launch('intltool-update -r', 'Updating translations', 'CYAN')
|
||||
else:
|
||||
Params.pprint('CYAN', 'POT file is up to date.')
|
||||
except:
|
||||
Params.pprint('RED', 'Failed to generate pot file.')
|
||||
os.chdir('..')
|
||||
|
||||
|
||||
# Simple function to execute a command and print its exit status
|
||||
def launch(command, status):
|
||||
def launch(command, status, success_color='GREEN'):
|
||||
ret = 0
|
||||
Params.pprint('GREEN', status)
|
||||
Params.pprint(success_color, status)
|
||||
try:
|
||||
ret = subprocess.call(command.split())
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user