2008-05-31 09:55:54 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# WAF build script for midori
|
2008-10-11 05:27:52 +00:00
|
|
|
# This file is licensed under the terms of the expat license, see the file EXPAT.
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-01-19 00:12:43 +00:00
|
|
|
import sys
|
|
|
|
|
|
|
|
# Waf version check, for global waf installs
|
|
|
|
try:
|
|
|
|
from Constants import WAFVERSION
|
|
|
|
except:
|
|
|
|
WAFVERSION='1.0.0'
|
|
|
|
if WAFVERSION[:3] != '1.5':
|
|
|
|
print 'Incompatible Waf, use 1.5'
|
|
|
|
sys.exit (1)
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
import Build
|
|
|
|
import Options
|
|
|
|
import Utils
|
2008-05-31 12:20:36 +00:00
|
|
|
import pproc as subprocess
|
2008-10-03 20:14:14 +00:00
|
|
|
import os
|
2008-11-14 01:46:23 +00:00
|
|
|
import UnitTest
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2008-11-30 00:22:03 +00:00
|
|
|
major = 0
|
|
|
|
minor = 1
|
2009-03-01 20:11:31 +00:00
|
|
|
micro = 4
|
2008-11-30 00:22:03 +00:00
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
APPNAME = 'midori'
|
2008-11-30 00:22:03 +00:00
|
|
|
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
|
2008-05-31 09:55:54 +00:00
|
|
|
|
|
|
|
try:
|
2009-02-19 01:07:03 +00:00
|
|
|
git = Utils.cmd_output (['git', 'rev-parse', '--short', 'HEAD'], silent=True)
|
2009-02-23 00:03:59 +00:00
|
|
|
if git:
|
|
|
|
VERSION = (VERSION + '-' + git).strip ()
|
2008-05-31 09:55:54 +00:00
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
srcdir = '.'
|
|
|
|
blddir = '_build_'
|
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
def option_enabled (option):
|
2009-01-04 20:38:06 +00:00
|
|
|
if eval ('Options.options.enable_' + option):
|
2008-12-07 00:56:42 +00:00
|
|
|
return True
|
2009-01-04 20:38:06 +00:00
|
|
|
if eval ('Options.options.disable_' + option):
|
2008-12-07 00:56:42 +00:00
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
def configure (conf):
|
2008-12-07 00:56:42 +00:00
|
|
|
def option_checkfatal (option, desc):
|
2009-01-04 20:38:06 +00:00
|
|
|
if eval ('Options.options.enable_' + option):
|
2009-01-20 03:53:01 +00:00
|
|
|
Utils.pprint ('RED', desc + ' N/A')
|
2008-12-07 00:56:42 +00:00
|
|
|
sys.exit (1)
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
def dirname_default (dirname, default):
|
|
|
|
if eval ('Options.options.' + dirname) == '':
|
|
|
|
dirvalue = default
|
|
|
|
else:
|
|
|
|
dirvalue = eval ('Options.options.' + dirname)
|
|
|
|
conf.define (dirname, dirvalue)
|
|
|
|
return dirvalue
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.check_tool ('compiler_cc')
|
2009-01-08 01:29:07 +00:00
|
|
|
conf.check_tool ('glib2')
|
2008-06-14 00:23:33 +00:00
|
|
|
|
2008-12-07 03:00:00 +00:00
|
|
|
if option_enabled ('userdocs'):
|
2008-10-03 20:14:14 +00:00
|
|
|
conf.find_program ('rst2html.py', var='RST2HTML')
|
|
|
|
# debian renames the executable, check that as well :(
|
|
|
|
if not conf.env['RST2HTML']:
|
|
|
|
conf.find_program ('rst2html', var='RST2HTML')
|
|
|
|
if conf.env['RST2HTML']:
|
2008-12-07 00:56:42 +00:00
|
|
|
user_docs = 'yes'
|
2008-10-03 20:14:14 +00:00
|
|
|
else:
|
2008-12-07 03:00:00 +00:00
|
|
|
option_checkfatal ('userdocs', 'user documentation')
|
2009-01-20 03:53:01 +00:00
|
|
|
user_docs = 'N/A'
|
2008-10-03 20:14:14 +00:00
|
|
|
else:
|
2009-01-20 03:53:01 +00:00
|
|
|
user_docs = 'no '
|
2008-10-03 20:14:14 +00:00
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
if option_enabled ('nls'):
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.check_tool ('intltool')
|
2008-06-01 21:47:27 +00:00
|
|
|
if conf.env['INTLTOOL'] and conf.env['POCOM']:
|
2008-05-31 09:55:54 +00:00
|
|
|
nls = 'yes'
|
|
|
|
else:
|
2008-12-07 00:56:42 +00:00
|
|
|
option_checkfatal ('nls', 'localization')
|
2009-01-20 03:53:01 +00:00
|
|
|
nls = 'N/A'
|
2008-05-31 09:55:54 +00:00
|
|
|
else:
|
2009-01-20 03:53:01 +00:00
|
|
|
nls = 'no '
|
2009-01-27 01:57:40 +00:00
|
|
|
conf.define ('ENABLE_NLS', [0,1][nls == 'yes'])
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
dirname_default ('DATADIR', os.path.join (conf.env['PREFIX'], 'share'))
|
|
|
|
dirname_default ('DOCDIR', os.path.join (conf.env['DATADIR'], 'doc'))
|
2009-01-31 18:07:27 +00:00
|
|
|
dirname_default ('LIBDIR', os.path.join (conf.env['PREFIX'], 'lib'))
|
2009-02-02 00:10:30 +00:00
|
|
|
if conf.env['PREFIX'] == '/usr':
|
|
|
|
dirname_default ('SYSCONFDIR', '/etc')
|
|
|
|
else:
|
|
|
|
dirname_default ('SYSCONFDIR', os.path.join (conf.env['PREFIX'], 'etc'))
|
2008-10-03 20:14:14 +00:00
|
|
|
|
2008-12-07 03:00:00 +00:00
|
|
|
if option_enabled ('apidocs'):
|
2008-09-07 19:48:04 +00:00
|
|
|
conf.find_program ('gtkdoc-scan', var='GTKDOC_SCAN')
|
|
|
|
conf.find_program ('gtkdoc-mktmpl', var='GTKDOC_MKTMPL')
|
|
|
|
conf.find_program ('gtkdoc-mkdb', var='GTKDOC_MKDB')
|
|
|
|
conf.find_program ('gtkdoc-mkhtml', var='GTKDOC_MKHTML')
|
|
|
|
if conf.env['GTKDOC_SCAN'] and conf.env['GTKDOC_MKTMPL'] \
|
|
|
|
and conf.env['GTKDOC_MKDB'] and conf.env['GTKDOC_MKHTML']:
|
|
|
|
api_docs = 'yes'
|
|
|
|
else:
|
2008-12-07 03:00:00 +00:00
|
|
|
option_checkfatal ('apidocs', 'API documentation')
|
2009-01-20 03:53:01 +00:00
|
|
|
api_docs = 'N/A'
|
2008-09-07 19:48:04 +00:00
|
|
|
else:
|
2009-01-20 03:53:01 +00:00
|
|
|
api_docs = 'no '
|
2008-09-07 19:48:04 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
def check_pkg (name, version='', mandatory=True, var=None):
|
|
|
|
if not var:
|
|
|
|
var = name.split ('-')[0].upper ()
|
|
|
|
conf.check_cfg (package=name, uselib_store=var, args='--cflags --libs',
|
|
|
|
atleast_version=version, mandatory=mandatory)
|
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
if option_enabled ('unique'):
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('unique-1.0', '0.9', False)
|
2009-01-20 03:53:01 +00:00
|
|
|
unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1]
|
2008-08-26 22:44:21 +00:00
|
|
|
else:
|
2008-12-07 00:56:42 +00:00
|
|
|
option_checkfatal ('unique', 'single instance')
|
2009-01-20 03:53:01 +00:00
|
|
|
unique = 'no '
|
2009-01-27 01:57:40 +00:00
|
|
|
conf.define ('HAVE_UNIQUE', [0,1][unique == 'yes'])
|
2008-08-22 01:59:07 +00:00
|
|
|
|
2009-02-16 23:16:14 +00:00
|
|
|
if option_enabled ('libidn'):
|
|
|
|
check_pkg ('libidn', '1.0', False)
|
|
|
|
libidn = ['N/A','yes'][conf.env['HAVE_LIBIDN'] == 1]
|
|
|
|
else:
|
|
|
|
option_checkfatal ('libidn', 'international domain names')
|
|
|
|
libidn = 'no '
|
|
|
|
conf.define ('HAVE_LIBIDN', [0,1][libidn == 'yes'])
|
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
if option_enabled ('sqlite'):
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('sqlite3', '3.0', False, var='SQLITE')
|
2009-01-20 03:53:01 +00:00
|
|
|
sqlite = ['N/A','yes'][conf.env['HAVE_SQLITE'] == 1]
|
2008-10-13 15:50:07 +00:00
|
|
|
else:
|
2008-12-07 00:56:42 +00:00
|
|
|
option_checkfatal ('sqlite', 'history database')
|
2009-01-20 03:53:01 +00:00
|
|
|
sqlite = 'no '
|
2009-01-27 01:57:40 +00:00
|
|
|
conf.define ('HAVE_SQLITE', [0,1][sqlite == 'yes'])
|
2008-10-13 15:50:07 +00:00
|
|
|
|
2009-03-12 17:20:14 +00:00
|
|
|
conf.check (lib='m', mandatory=True)
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('gmodule-2.0', '2.8.0', False)
|
|
|
|
check_pkg ('gthread-2.0', '2.8.0', False)
|
2009-03-16 00:18:22 +00:00
|
|
|
check_pkg ('gio-2.0', '2.16.0')
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('gtk+-2.0', '2.10.0', var='GTK')
|
2009-03-16 00:18:22 +00:00
|
|
|
check_pkg ('webkit-1.0', '1.1.1')
|
|
|
|
check_pkg ('libsoup-2.4', '2.25.2')
|
|
|
|
conf.define ('HAVE_LIBSOUP_2_25_2', 1)
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('libxml-2.0', '2.6')
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-01-27 01:57:40 +00:00
|
|
|
if option_enabled ('hildon'):
|
|
|
|
check_pkg ('hildon-1', mandatory=False, var='HILDON')
|
|
|
|
hildon = ['N/A','yes'][conf.env['HAVE_HILDON'] == 1]
|
|
|
|
else:
|
|
|
|
option_checkfatal ('hildon', 'Maemo integration')
|
|
|
|
hildon = 'no '
|
|
|
|
conf.define ('HAVE_HILDON', [0,1][hildon == 'yes'])
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
conf.check (header_name='unistd.h')
|
2009-01-09 21:54:40 +00:00
|
|
|
conf.define ('HAVE_OSX', int(sys.platform == 'darwin'))
|
2008-06-01 13:16:40 +00:00
|
|
|
|
2008-08-10 13:53:07 +00:00
|
|
|
if conf.find_program ('rsvg-convert', var='RSVG_CONVERT'):
|
2008-05-31 09:55:54 +00:00
|
|
|
icons = 'yes'
|
|
|
|
else:
|
2009-01-20 03:53:01 +00:00
|
|
|
icons = 'no '
|
2008-05-31 09:55:54 +00:00
|
|
|
|
|
|
|
conf.define ('PACKAGE_VERSION', VERSION)
|
|
|
|
conf.define ('PACKAGE_NAME', APPNAME)
|
2008-08-22 01:59:07 +00:00
|
|
|
conf.define ('PACKAGE_BUGREPORT', 'http://www.twotoasts.de/bugs')
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.define ('GETTEXT_PACKAGE', APPNAME)
|
|
|
|
|
2008-11-30 00:22:03 +00:00
|
|
|
conf.define ('MIDORI_MAJOR_VERSION', major)
|
|
|
|
conf.define ('MIDORI_MINOR_VERSION', minor)
|
|
|
|
conf.define ('MIDORI_MICRO_VERSION', micro)
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.write_config_header ('config.h')
|
2008-06-19 22:28:33 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H')
|
2009-01-04 20:38:06 +00:00
|
|
|
debug_level = Options.options.debug_level
|
2009-01-09 23:35:10 +00:00
|
|
|
compiler = conf.env['CC_NAME']
|
|
|
|
if debug_level == '':
|
|
|
|
if compiler == 'gcc':
|
|
|
|
debug_level = 'debug'
|
|
|
|
else:
|
|
|
|
debug_level = 'none'
|
|
|
|
if debug_level != 'none':
|
2009-01-04 20:38:06 +00:00
|
|
|
if compiler == 'gcc':
|
|
|
|
if debug_level == 'debug':
|
2009-02-19 00:00:19 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-Wall -O0 -g'.split ())
|
2009-01-09 21:54:40 +00:00
|
|
|
elif debug_level == 'full':
|
|
|
|
# -Wdeclaration-after-statement
|
|
|
|
# -Wmissing-declarations -Wmissing-prototypes
|
|
|
|
# -Wwrite-strings
|
|
|
|
conf.env.append_value ('CCFLAGS',
|
|
|
|
'-Wall -Wextra -O1 -g '
|
|
|
|
'-Waggregate-return -Wno-unused-parameter '
|
|
|
|
'-Wno-missing-field-initializers '
|
|
|
|
'-Wunsafe-loop-optimizations '
|
|
|
|
'-Wredundant-decls -Wmissing-noreturn '
|
|
|
|
'-Wshadow -Wpointer-arith -Wcast-align '
|
|
|
|
'-Winline -Wformat-security '
|
|
|
|
'-Winit-self -Wmissing-include-dirs -Wundef '
|
|
|
|
'-Wmissing-format-attribute -Wnested-externs '
|
2009-02-19 00:00:19 +00:00
|
|
|
'-DG_ENABLE_DEBUG'.split ())
|
2009-01-04 20:38:06 +00:00
|
|
|
else:
|
|
|
|
conf.env.append_value ('CCFLAGS', '-O2')
|
|
|
|
else:
|
|
|
|
Utils.pprint ('RED', 'No debugging level support for ' + compiler)
|
|
|
|
sys.exit (1)
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2008-11-10 21:18:35 +00:00
|
|
|
print
|
2009-01-20 03:53:01 +00:00
|
|
|
print "Optional build time dependencies:"
|
|
|
|
print "Localization: " + nls + " (intltool)"
|
|
|
|
print "Icon optimizations: " + icons + " (rsvg-convert)"
|
|
|
|
print "User documentation: " + user_docs + " (docutils)"
|
|
|
|
print "API documentation: " + api_docs + " (gtk-doc)"
|
|
|
|
print
|
|
|
|
print "Optional run time dependencies:"
|
|
|
|
print "Single instance: " + unique + " (unique)"
|
|
|
|
if unique == 'yes' and conf.check_cfg (modversion='unique-1.0') == '1.0.4':
|
|
|
|
Utils.pprint ('RED', 'unique 1.0.4 found, this version is erroneous.')
|
|
|
|
Utils.pprint ('RED', 'Please use an older or newer version.')
|
2009-02-16 23:16:14 +00:00
|
|
|
print "IDN support: " + libidn + " (libidn)"
|
2009-01-20 03:53:01 +00:00
|
|
|
print "Persistent history: " + sqlite + " (sqlite3)"
|
2009-01-27 01:57:40 +00:00
|
|
|
print "Maemo integration: " + hildon + " (hildon)"
|
2008-11-10 21:18:35 +00:00
|
|
|
|
2008-05-31 12:20:36 +00:00
|
|
|
def set_options (opt):
|
2008-12-07 03:00:00 +00:00
|
|
|
def add_enable_option (option, desc, group=None, disable=False):
|
|
|
|
if group == None:
|
|
|
|
group = opt
|
2008-12-07 00:56:42 +00:00
|
|
|
option_ = option.replace ('-', '_')
|
2008-12-07 03:00:00 +00:00
|
|
|
group.add_option ('--enable-' + option, action='store_true',
|
2008-12-07 00:56:42 +00:00
|
|
|
default=False, help='Enable ' + desc, dest='enable_' + option_)
|
2008-12-07 03:00:00 +00:00
|
|
|
group.add_option ('--disable-' + option, action='store_true',
|
|
|
|
default=disable, help='Disable ' + desc, dest='disable_' + option_)
|
2008-12-07 00:56:42 +00:00
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
opt.tool_options ('compiler_cc')
|
2009-01-04 20:38:06 +00:00
|
|
|
opt.get_option_group ('--check-c-compiler').add_option('-d', '--debug-level',
|
2009-01-09 23:35:10 +00:00
|
|
|
action = 'store', default = '',
|
|
|
|
help = 'Specify the debugging level. [\'none\', \'debug\', \'full\']',
|
|
|
|
choices = ['', 'none', 'debug', 'full'], dest = 'debug_level')
|
2009-01-04 20:38:06 +00:00
|
|
|
opt.tool_options ('gnu_dirs')
|
|
|
|
opt.parser.remove_option ('--oldincludedir')
|
|
|
|
opt.parser.remove_option ('--htmldir')
|
|
|
|
opt.parser.remove_option ('--dvidir')
|
|
|
|
opt.parser.remove_option ('--pdfdir')
|
|
|
|
opt.parser.remove_option ('--psdir')
|
2008-05-31 09:55:54 +00:00
|
|
|
opt.tool_options ('intltool')
|
2008-12-12 09:10:10 +00:00
|
|
|
opt.add_option ('--run', action='store_true', default=False,
|
|
|
|
help='Run application after building it', dest='run')
|
2008-12-07 00:56:42 +00:00
|
|
|
|
2008-12-07 03:00:00 +00:00
|
|
|
group = opt.add_option_group ('Localization and documentation', '')
|
|
|
|
add_enable_option ('nls', 'native language support', group)
|
|
|
|
group.add_option ('--update-po', action='store_true', default=False,
|
|
|
|
help='Update localization files', dest='update_po')
|
|
|
|
add_enable_option ('docs', 'informational text files', group)
|
|
|
|
add_enable_option ('userdocs', 'user documentation', group)
|
|
|
|
add_enable_option ('apidocs', 'API documentation', group, disable=True)
|
2008-11-10 00:08:38 +00:00
|
|
|
|
2008-12-07 03:00:00 +00:00
|
|
|
group = opt.add_option_group ('Optional features', '')
|
|
|
|
add_enable_option ('unique', 'single instance support', group)
|
2009-02-16 23:16:14 +00:00
|
|
|
add_enable_option ('libidn', 'international domain name support', group)
|
2008-12-07 03:00:00 +00:00
|
|
|
add_enable_option ('sqlite', 'history database support', group)
|
|
|
|
add_enable_option ('addons', 'building of extensions', group)
|
2009-01-27 01:57:40 +00:00
|
|
|
add_enable_option ('hildon', 'Maemo integration', group)
|
2008-11-18 01:07:53 +00:00
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
def build (bld):
|
2008-07-27 05:39:39 +00:00
|
|
|
bld.add_subdirs ('katze midori icons')
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2008-12-07 03:00:00 +00:00
|
|
|
if option_enabled ('addons'):
|
2008-11-18 01:07:53 +00:00
|
|
|
bld.add_subdirs ('extensions')
|
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
if option_enabled ('docs'):
|
2009-01-12 23:50:01 +00:00
|
|
|
bld.install_files ('${DOCDIR}/' + APPNAME + '/', \
|
2008-12-07 00:56:42 +00:00
|
|
|
'AUTHORS ChangeLog COPYING EXPAT README TRANSLATE')
|
2008-10-03 20:14:14 +00:00
|
|
|
|
2009-01-31 18:07:27 +00:00
|
|
|
# Install default configuration
|
|
|
|
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + '/', 'data/search')
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
if bld.env['RST2HTML']:
|
2008-10-03 20:14:14 +00:00
|
|
|
# FIXME: Build only if needed
|
2009-02-19 01:07:03 +00:00
|
|
|
Utils.check_dir (blddir)
|
|
|
|
Utils.check_dir (blddir + '/docs')
|
|
|
|
Utils.check_dir (blddir + '/docs/user')
|
2008-10-03 20:14:14 +00:00
|
|
|
os.chdir (blddir + '/docs/user')
|
2009-01-04 20:38:06 +00:00
|
|
|
command = bld.env['RST2HTML'] + ' -stg ' + \
|
|
|
|
'--stylesheet=../../../docs/user/midori.css ' + \
|
|
|
|
'../../../docs/user/midori.txt ' + 'midori.html'
|
|
|
|
Utils.exec_command (command)
|
2008-10-03 20:14:14 +00:00
|
|
|
os.chdir ('../../..')
|
2009-01-12 23:50:01 +00:00
|
|
|
bld.install_files ('${DOCDIR}/midori/user/', blddir + '/docs/user/midori.html')
|
2008-10-03 20:14:14 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
if bld.env['INTLTOOL']:
|
|
|
|
obj = bld.new_task_gen ('intltool_po')
|
2008-11-10 00:08:38 +00:00
|
|
|
obj.podir = 'po'
|
|
|
|
obj.appname = APPNAME
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
if bld.env['GTKDOC_SCAN'] and Options.commands['build']:
|
2008-09-07 19:48:04 +00:00
|
|
|
bld.add_subdirs ('docs/api')
|
2009-01-12 23:50:01 +00:00
|
|
|
bld.install_files ('${DOCDIR}/midori/api/', blddir + '/docs/api/*')
|
2008-09-07 19:48:04 +00:00
|
|
|
|
2009-01-27 01:57:40 +00:00
|
|
|
if bld.env['HAVE_HILDON']:
|
|
|
|
appdir = '${DATADIR}/applications/hildon'
|
|
|
|
bld.install_files ('${DATADIR}/dbus-1/services',
|
|
|
|
'data/com.nokia.' + APPNAME + '.service')
|
|
|
|
else:
|
|
|
|
appdir = '${DATADIR}/applications'
|
2009-01-04 20:38:06 +00:00
|
|
|
if bld.env['INTLTOOL']:
|
|
|
|
obj = bld.new_task_gen ('intltool_in')
|
2009-01-27 01:57:40 +00:00
|
|
|
obj.source = 'data/' + APPNAME + '.desktop.in'
|
2009-01-28 00:03:16 +00:00
|
|
|
obj.install_path = appdir
|
2009-01-27 01:57:40 +00:00
|
|
|
obj.flags = '-d'
|
|
|
|
bld.install_files (appdir, 'data/' + APPNAME + '.desktop')
|
2008-12-07 04:10:08 +00:00
|
|
|
else:
|
2009-01-27 01:57:40 +00:00
|
|
|
folder = os.path.dirname (bld.env['waf_config_files'][0]) + '/data'
|
2008-12-07 04:10:08 +00:00
|
|
|
desktop = APPNAME + '.desktop'
|
2009-01-30 13:15:15 +00:00
|
|
|
pre = open ('data/' + desktop + '.in')
|
2008-12-07 04:10:08 +00:00
|
|
|
after = open (folder + '/' + desktop, 'w')
|
|
|
|
try:
|
2009-01-05 21:08:52 +00:00
|
|
|
try:
|
|
|
|
for line in pre:
|
|
|
|
if line != '':
|
|
|
|
if line[0] == '_':
|
|
|
|
after.write (line[1:])
|
|
|
|
else:
|
|
|
|
after.write (line)
|
|
|
|
after.close ()
|
|
|
|
Utils.pprint ('BLUE', desktop + '.in -> ' + desktop)
|
2009-01-27 01:57:40 +00:00
|
|
|
bld.install_files (appdir, folder + '/' + desktop)
|
2009-01-05 21:08:52 +00:00
|
|
|
except:
|
|
|
|
Utils.pprint ('BLUE', 'File ' + desktop + ' not generated')
|
2008-12-07 04:10:08 +00:00
|
|
|
finally:
|
|
|
|
pre.close ()
|
2008-05-31 12:20:36 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
if bld.env['RSVG_CONVERT']:
|
2009-02-19 01:07:03 +00:00
|
|
|
Utils.check_dir (blddir + '/data')
|
2009-01-04 20:38:06 +00:00
|
|
|
command = bld.env['RSVG_CONVERT'] + \
|
|
|
|
' -o ' + blddir + '/data/logo-shade.png ' + \
|
|
|
|
srcdir + '/data/logo-shade.svg'
|
|
|
|
if not Utils.exec_command (command):
|
2009-01-12 23:50:01 +00:00
|
|
|
bld.install_files ('${DATADIR}/' + APPNAME, blddir + '/data/logo-shade.png')
|
2008-10-16 01:51:39 +00:00
|
|
|
else:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('BLUE', "logo-shade could not be rasterized.")
|
2008-10-16 01:51:39 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
if Options.commands['check']:
|
2008-11-14 01:46:23 +00:00
|
|
|
bld.add_subdirs ('tests')
|
|
|
|
|
2008-05-31 12:20:36 +00:00
|
|
|
def shutdown ():
|
2009-01-04 20:38:06 +00:00
|
|
|
if Options.commands['install'] or Options.commands['uninstall']:
|
|
|
|
dir = Build.bld.get_install_path ('${DATADIR}/icons/hicolor')
|
2008-06-01 13:16:40 +00:00
|
|
|
icon_cache_updated = False
|
2009-01-04 20:38:06 +00:00
|
|
|
if not Options.options.destdir:
|
2008-06-01 13:16:40 +00:00
|
|
|
# update the pixmap cache directory
|
|
|
|
try:
|
2009-01-04 20:38:06 +00:00
|
|
|
command = 'gtk-update-icon-cache -q -f -t %s' % dir
|
|
|
|
if not Utils.exec_command (command):
|
|
|
|
Utils.pprint ('YELLOW', "Updated Gtk icon cache.")
|
2008-07-27 05:39:39 +00:00
|
|
|
icon_cache_updated = True
|
2008-06-01 13:16:40 +00:00
|
|
|
except:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('RED', "Failed to update icon cache.")
|
2008-06-01 13:16:40 +00:00
|
|
|
if not icon_cache_updated:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('YELLOW', "Icon cache not updated. "
|
2008-12-06 04:43:24 +00:00
|
|
|
"After install, run this:")
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('YELLOW', "gtk-update-icon-cache -q -f -t %s" % dir)
|
2008-11-10 00:08:38 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
elif Options.commands['check']:
|
2008-11-14 01:46:23 +00:00
|
|
|
test = UnitTest.unit_test ()
|
|
|
|
test.change_to_testfile_dir = True
|
|
|
|
test.want_to_see_test_output = True
|
|
|
|
test.want_to_see_test_error = True
|
|
|
|
test.run ()
|
|
|
|
test.print_results ()
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
elif Options.options.update_po:
|
2008-11-10 00:08:38 +00:00
|
|
|
os.chdir('./po')
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
size_old = os.stat (APPNAME + '.pot').st_size
|
|
|
|
except:
|
|
|
|
size_old = 0
|
2008-12-06 04:34:33 +00:00
|
|
|
subprocess.call (['intltool-update', '-p', '-g', APPNAME])
|
2008-11-10 00:08:38 +00:00
|
|
|
size_new = os.stat (APPNAME + '.pot').st_size
|
|
|
|
if size_new <> size_old:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('YELLOW', "Updated po template.")
|
2008-11-10 00:08:38 +00:00
|
|
|
try:
|
2009-01-04 20:38:06 +00:00
|
|
|
command = 'intltool-update -r -g %s' % APPNAME
|
|
|
|
Utils.exec_command (command)
|
|
|
|
Utils.pprint ('YELLOW', "Updated translations.")
|
2008-11-10 00:08:38 +00:00
|
|
|
except:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('RED', "Failed to update translations.")
|
2008-11-10 00:08:38 +00:00
|
|
|
except:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('RED', "Failed to generate po template.")
|
|
|
|
Utils.pprint ('RED', "Make sure intltool is installed.")
|
2008-11-10 00:08:38 +00:00
|
|
|
os.chdir ('..')
|
2009-01-04 20:38:06 +00:00
|
|
|
elif Options.options.run:
|
|
|
|
folder = os.path.dirname (Build.bld.env['waf_config_files'][0])
|
2008-12-12 09:10:10 +00:00
|
|
|
try:
|
2009-01-22 00:59:23 +00:00
|
|
|
ext = 'MIDORI_EXTENSION_PATH=' + folder + os.sep + 'extensions'
|
|
|
|
nls = 'NLSPATH=' + folder + os.sep + 'po'
|
|
|
|
lang = os.environ['LANG']
|
|
|
|
try:
|
|
|
|
for lang in os.listdir (folder + os.sep + 'po'):
|
|
|
|
if lang[3:] == 'mo':
|
|
|
|
lang = lang[:-3]
|
|
|
|
else:
|
|
|
|
continue
|
2009-02-19 01:07:03 +00:00
|
|
|
Utils.check_dir (folder + os.sep + 'po' + os.sep + lang)
|
|
|
|
Utils.check_dir (folder + os.sep + 'po' + os.sep + lang + \
|
2009-01-22 00:59:23 +00:00
|
|
|
os.sep + 'LC_MESSAGES')
|
|
|
|
os.symlink (folder + os.sep + 'po' + os.sep + lang + '.mo',
|
|
|
|
folder + os.sep + 'po' + os.sep + lang + os.sep + \
|
|
|
|
'LC_MESSAGES' + os.sep + APPNAME + '.mo')
|
|
|
|
except:
|
|
|
|
pass
|
2009-01-04 20:38:06 +00:00
|
|
|
command = folder + os.sep + APPNAME + os.sep + APPNAME
|
2009-01-22 00:59:23 +00:00
|
|
|
print ext + ' ' + nls + ' ' + command
|
|
|
|
Utils.exec_command (ext + ' ' + nls + ' ' + command)
|
2008-12-12 09:10:10 +00:00
|
|
|
except:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('RED', "Failed to run application.")
|