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':
|
2010-10-22 19:41:18 +00:00
|
|
|
print ('Incompatible Waf, use 1.5')
|
2009-01-19 00:12:43 +00:00
|
|
|
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
|
2010-04-23 20:51:10 +00:00
|
|
|
try:
|
|
|
|
import UnitTest
|
|
|
|
except:
|
|
|
|
import unittestw as UnitTest
|
2009-07-09 17:55:41 +00:00
|
|
|
import Task
|
2010-01-16 06:46:58 +00:00
|
|
|
from TaskGen import extension, feature, taskgen
|
2009-07-09 17:55:41 +00:00
|
|
|
import misc
|
2010-04-24 22:11:57 +00:00
|
|
|
from Configure import find_program_impl
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2008-11-30 00:22:03 +00:00
|
|
|
major = 0
|
2011-08-01 22:06:36 +00:00
|
|
|
minor = 4
|
2012-03-08 22:34:45 +00:00
|
|
|
micro = 4
|
2008-11-30 00:22:03 +00:00
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
APPNAME = 'midori'
|
2011-10-23 17:23:03 +00:00
|
|
|
VERSION = VERSION_FULL = str (major) + '.' + str (minor) + '.' + str (micro)
|
2011-11-08 00:53:53 +00:00
|
|
|
VERSION_SUFFIX = ' (%s)' % VERSION
|
2008-05-31 09:55:54 +00:00
|
|
|
|
|
|
|
try:
|
2010-09-01 18:45:07 +00:00
|
|
|
if os.path.isdir ('.git'):
|
|
|
|
git = Utils.cmd_output (['git', 'describe'], silent=True)
|
|
|
|
if git:
|
2011-10-23 17:23:03 +00:00
|
|
|
VERSION_FULL = git.strip ()
|
2011-11-08 00:53:53 +00:00
|
|
|
VERSION_SUFFIX = VERSION_FULL.replace (VERSION, '')
|
2008-05-31 09:55:54 +00:00
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
srcdir = '.'
|
2012-04-04 20:36:00 +00:00
|
|
|
blddir = '_build' # recognized by ack
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2008-12-07 00:56:42 +00:00
|
|
|
def option_enabled (option):
|
2009-05-30 21:56:31 +00:00
|
|
|
if getattr (Options.options, 'enable_' + option):
|
2008-12-07 00:56:42 +00:00
|
|
|
return True
|
2009-05-30 21:56:31 +00:00
|
|
|
if getattr (Options.options, 'disable_' + option):
|
2008-12-07 00:56:42 +00:00
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2009-06-06 04:30:34 +00:00
|
|
|
def is_mingw (env):
|
|
|
|
if 'CC' in env:
|
|
|
|
cc = env['CC']
|
|
|
|
if not isinstance (cc, str):
|
|
|
|
cc = ''.join (cc)
|
|
|
|
return cc.find ('mingw') != -1# or cc.find ('wine') != -1
|
|
|
|
return False
|
|
|
|
|
2012-01-03 20:52:41 +00:00
|
|
|
def is_win32 (env):
|
|
|
|
return is_mingw (env) or Options.platform == 'win32'
|
|
|
|
|
2009-07-09 17:55:41 +00:00
|
|
|
# Compile Win32 res files to (resource) object files
|
|
|
|
def rc_file(self, node):
|
|
|
|
rctask = self.create_task ('winrc')
|
|
|
|
rctask.set_inputs (node)
|
|
|
|
rctask.set_outputs (node.change_ext ('.rc.o'))
|
|
|
|
self.compiled_tasks.append (rctask)
|
2009-10-30 20:14:05 +00:00
|
|
|
rc_file = extension ('.rc')(rc_file)
|
2009-07-09 17:55:41 +00:00
|
|
|
Task.simple_task_type ('winrc', '${WINRC} -o${TGT} ${SRC}', color='BLUE',
|
|
|
|
before='cc cxx', shell=False)
|
|
|
|
|
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-05-30 21:56:31 +00:00
|
|
|
if hasattr (Options.options, 'enable_' + option):
|
2009-06-02 23:49:47 +00:00
|
|
|
if getattr (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-06-06 04:22:35 +00:00
|
|
|
def dirname_default (dirname, default, defname=None):
|
2009-05-30 21:56:31 +00:00
|
|
|
if getattr (Options.options, dirname) == '':
|
2009-01-04 20:38:06 +00:00
|
|
|
dirvalue = default
|
|
|
|
else:
|
2009-05-30 21:56:31 +00:00
|
|
|
dirvalue = getattr (Options.options, dirname)
|
2009-06-06 04:22:35 +00:00
|
|
|
if not defname:
|
|
|
|
defname = dirname
|
|
|
|
conf.define (defname, dirvalue)
|
2009-01-04 20:38:06 +00:00
|
|
|
return dirvalue
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.check_tool ('compiler_cc')
|
2011-06-17 09:25:37 +00:00
|
|
|
conf.check_tool ('vala')
|
2011-06-17 09:32:55 +00:00
|
|
|
conf.check_tool ('glib2')
|
2008-06-14 00:23:33 +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-07-09 18:02:23 +00:00
|
|
|
if conf.find_program ('rsvg-convert', var='RSVG_CONVERT'):
|
|
|
|
icons = 'yes'
|
|
|
|
else:
|
|
|
|
icons = 'no '
|
|
|
|
|
2012-01-03 20:52:41 +00:00
|
|
|
if is_win32 (conf.env):
|
2009-07-09 17:55:41 +00:00
|
|
|
conf.find_program ('windres', var='WINRC')
|
2010-02-15 21:43:51 +00:00
|
|
|
conf.env['platform'] = 'win32'
|
2009-07-09 17:55:41 +00:00
|
|
|
|
2009-06-06 04:30:34 +00:00
|
|
|
# This is specific to cross compiling with mingw
|
|
|
|
if is_mingw (conf.env) and Options.platform != 'win32':
|
2009-06-15 23:47:03 +00:00
|
|
|
if not 'AR' in os.environ and not 'RANLIB' in os.environ:
|
|
|
|
conf.env['AR'] = os.environ['CC'][:-3] + 'ar'
|
2009-07-09 17:55:41 +00:00
|
|
|
if conf.find_program (os.environ['CC'][:-3] + 'windres', var='WINRC'):
|
|
|
|
os.environ['WINRC'] = os.environ['CC'][:-3] + 'windres'
|
2009-06-06 04:30:34 +00:00
|
|
|
Options.platform = 'win32'
|
|
|
|
# Make sure we don't have -fPIC in the CCFLAGS
|
|
|
|
conf.env["shlib_CCFLAGS"] = []
|
|
|
|
# Adjust file naming
|
|
|
|
conf.env["shlib_PATTERN"] = 'lib%s.dll'
|
|
|
|
conf.env['program_PATTERN'] = '%s.exe'
|
|
|
|
# Use Visual C++ compatible alignment
|
|
|
|
conf.env.append_value ('CCFLAGS', '-mms-bitfields')
|
2009-06-06 16:43:40 +00:00
|
|
|
conf.env['staticlib_LINKFLAGS'] = []
|
2009-06-06 04:30:34 +00:00
|
|
|
|
2009-06-07 16:42:48 +00:00
|
|
|
Utils.pprint ('BLUE', 'Mingw recognized, assuming cross compile.')
|
2009-06-06 04:30:34 +00:00
|
|
|
|
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'))
|
2009-06-06 04:22:35 +00:00
|
|
|
dirname_default ('DATADIR', os.path.join (conf.env['PREFIX'], 'share'),
|
|
|
|
# Use MDATADIR because DATADIR is a constant in objidl.h on Windows
|
|
|
|
'MDATADIR')
|
|
|
|
conf.undefine ('DATADIR')
|
2009-06-06 19:41:26 +00:00
|
|
|
dirname_default ('DOCDIR', os.path.join (conf.env['MDATADIR'], 'doc'))
|
2010-10-18 20:17:19 +00:00
|
|
|
if not APPNAME in conf.env['DOCDIR']:
|
|
|
|
conf.env['DOCDIR'] += '/' + APPNAME
|
2010-11-01 20:21:58 +00:00
|
|
|
conf.define ('DOCDIR', conf.env['DOCDIR'])
|
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-06-06 04:58:50 +00:00
|
|
|
def check_pkg (name, version='', mandatory=True, var=None, args=''):
|
2009-01-04 20:38:06 +00:00
|
|
|
if not var:
|
|
|
|
var = name.split ('-')[0].upper ()
|
2009-06-06 04:58:50 +00:00
|
|
|
conf.check_cfg (package=name, uselib_store=var, args='--cflags --libs ' + args,
|
2009-01-04 20:38:06 +00:00
|
|
|
atleast_version=version, mandatory=mandatory)
|
2009-06-14 19:25:33 +00:00
|
|
|
return conf.env['HAVE_' + var]
|
2009-01-04 20:38:06 +00:00
|
|
|
|
2011-10-21 00:51:33 +00:00
|
|
|
def check_version (given_version, major, minor, micro):
|
|
|
|
if '.' in given_version:
|
|
|
|
given_major, given_minor, given_micro = given_version.split ('.')
|
|
|
|
else:
|
|
|
|
given_major, given_minor, given_micro = given_version
|
|
|
|
return int(given_major) > major or \
|
|
|
|
int(given_major) == major and int(given_minor) > minor or \
|
|
|
|
int(given_major) == major and int(given_minor) == minor and int(given_micro) >= micro
|
|
|
|
|
2011-11-09 21:56:21 +00:00
|
|
|
if option_enabled ('unique'):
|
|
|
|
if option_enabled('gtk3'): unique_pkg = 'unique-3.0'
|
|
|
|
else: unique_pkg = 'unique-1.0'
|
|
|
|
check_pkg (unique_pkg, '0.9', False)
|
2009-01-20 03:53:01 +00:00
|
|
|
unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1]
|
2009-06-05 21:14:53 +00:00
|
|
|
if unique != 'yes':
|
|
|
|
option_checkfatal ('unique', 'single instance')
|
2011-10-31 02:57:51 +00:00
|
|
|
conf.define ('UNIQUE_VERSION', 'No')
|
|
|
|
else:
|
2011-11-09 21:56:21 +00:00
|
|
|
conf.define ('UNIQUE_VERSION', conf.check_cfg (modversion=unique_pkg))
|
2008-08-26 22:44:21 +00:00
|
|
|
else:
|
2009-01-20 03:53:01 +00:00
|
|
|
unique = 'no '
|
2011-10-31 02:57:51 +00:00
|
|
|
conf.define ('UNIQUE_VERSION', '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-12-14 22:51:05 +00:00
|
|
|
if option_enabled ('libnotify'):
|
|
|
|
check_pkg ('libnotify', mandatory=False)
|
|
|
|
libnotify = ['N/A','yes'][conf.env['HAVE_LIBNOTIFY'] == 1]
|
|
|
|
if libnotify != 'yes':
|
|
|
|
option_checkfatal ('libnotify', 'notifications')
|
2011-10-31 02:57:51 +00:00
|
|
|
conf.define ('LIBNOTIFY_VERSION', 'No')
|
|
|
|
else:
|
|
|
|
conf.define ('LIBNOTIFY_VERSION', conf.check_cfg (modversion='libnotify'))
|
2009-12-14 22:51:05 +00:00
|
|
|
else:
|
|
|
|
libnotify = 'no '
|
2011-10-31 02:57:51 +00:00
|
|
|
conf.define ('LIBNOTIFY_VERSION', 'No')
|
2009-12-14 22:51:05 +00:00
|
|
|
conf.define ('HAVE_LIBNOTIFY', [0,1][libnotify == 'yes'])
|
|
|
|
|
2012-03-14 19:55:34 +00:00
|
|
|
if option_enabled ('granite'):
|
2012-03-18 13:12:17 +00:00
|
|
|
if not option_enabled ('gtk3'):
|
2012-03-14 19:55:34 +00:00
|
|
|
option_checkfatal ('granite', 'granite requires --enable-gtk3')
|
|
|
|
check_pkg ('granite', '0.1', False)
|
|
|
|
granite = ['N/A', 'yes'][conf.env['HAVE_GRANITE'] == 1]
|
|
|
|
if granite != 'yes':
|
|
|
|
option_checkfatal ('granite', 'new notebook, pop-overs')
|
|
|
|
conf.define ('GRANITE_VERSION', 'No')
|
|
|
|
else:
|
|
|
|
conf.define ('GRANITE_VERSION', conf.check_cfg (modversion='granite'))
|
|
|
|
else:
|
|
|
|
granite = 'no '
|
|
|
|
conf.define ('GRANITE_VERSION', 'No')
|
|
|
|
|
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)
|
2011-10-15 17:16:19 +00:00
|
|
|
check_pkg ('gio-2.0', '2.22.0')
|
2009-06-06 04:58:50 +00:00
|
|
|
args = ''
|
|
|
|
if Options.platform == 'win32':
|
|
|
|
args = '--define-variable=target=win32'
|
2009-11-12 20:53:02 +00:00
|
|
|
elif sys.platform != 'darwin':
|
|
|
|
check_pkg ('x11')
|
2010-04-30 21:34:07 +00:00
|
|
|
# Pass /usr/X11R6/include for OpenBSD
|
|
|
|
conf.check (header_name='X11/extensions/scrnsaver.h',
|
|
|
|
includes='/usr/X11R6/include', mandatory=False)
|
|
|
|
conf.check (lib='Xss', libpath='/usr/X11R6/lib', mandatory=False)
|
2011-10-01 13:12:04 +00:00
|
|
|
if option_enabled ('gtk3'):
|
2012-04-11 19:02:59 +00:00
|
|
|
if option_enabled ('addons') and not check_version (conf.env['VALAC_VERSION'], 0, 14, 0):
|
|
|
|
Utils.pprint ('RED', 'Vala 0.14.0 or later is required ' \
|
2011-10-20 07:47:11 +00:00
|
|
|
'to build with GTK+ 3 and extensions.\n' \
|
|
|
|
'Pass --disable-addons to build without extensions.\n' \
|
|
|
|
'Pass --disable-gtk3 to build with extensions and GTK+ 2.')
|
|
|
|
sys.exit (1)
|
2011-10-01 13:12:04 +00:00
|
|
|
check_pkg ('gtk+-3.0', '3.0.0', var='GTK', mandatory=False)
|
|
|
|
check_pkg ('webkitgtk-3.0', '1.1.17', var='WEBKIT', mandatory=False)
|
|
|
|
if not conf.env['HAVE_GTK'] or not conf.env['HAVE_WEBKIT']:
|
|
|
|
Utils.pprint ('RED', 'GTK+3 was not found.\n' \
|
|
|
|
'Pass --disable-gtk3 to build without GTK+3.')
|
|
|
|
sys.exit (1)
|
2011-10-21 00:51:33 +00:00
|
|
|
if check_version (conf.check_cfg (modversion='webkitgtk-3.0'), 1, 5, 1):
|
2011-12-06 22:14:39 +00:00
|
|
|
check_pkg ('javascriptcoregtk-3.0', '1.5.1', args=args)
|
2011-10-01 13:12:04 +00:00
|
|
|
conf.env.append_value ('VALAFLAGS', '-D HAVE_GTK3')
|
|
|
|
else:
|
|
|
|
check_pkg ('gtk+-2.0', '2.10.0', var='GTK')
|
|
|
|
check_pkg ('webkit-1.0', '1.1.17', args=args)
|
2011-10-21 00:51:33 +00:00
|
|
|
if check_version (conf.check_cfg (modversion='webkit-1.0'), 1, 5, 1):
|
|
|
|
check_pkg ('javascriptcoregtk-1.0', '1.5.1', args=args)
|
2011-10-01 13:12:04 +00:00
|
|
|
conf.env['HAVE_GTK3'] = option_enabled ('gtk3')
|
2011-10-15 16:27:07 +00:00
|
|
|
check_pkg ('libsoup-2.4', '2.27.90')
|
2011-04-30 10:00:12 +00:00
|
|
|
conf.define ('LIBSOUP_VERSION', conf.check_cfg (modversion='libsoup-2.4'))
|
2012-03-18 13:12:17 +00:00
|
|
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 3):
|
|
|
|
conf.define ('LIBSOUP_2_29_3', 1)
|
|
|
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 29, 91):
|
|
|
|
conf.define ('LIBSOUP_2_29_91', 1)
|
|
|
|
if check_version (conf.env['LIBSOUP_VERSION'], 2, 37, 1):
|
|
|
|
conf.define ('LIBSOUP_2_37_1', 1)
|
2009-01-04 20:38:06 +00:00
|
|
|
check_pkg ('libxml-2.0', '2.6')
|
2010-07-01 18:58:20 +00:00
|
|
|
check_pkg ('sqlite3', '3.0', True, var='SQLITE')
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-01-27 01:57:40 +00:00
|
|
|
if option_enabled ('hildon'):
|
2009-06-14 19:25:33 +00:00
|
|
|
if check_pkg ('hildon-1', mandatory=False, var='HILDON'):
|
|
|
|
check_pkg ('libosso', var='HILDON')
|
2009-10-28 22:54:26 +00:00
|
|
|
check_pkg ('hildon-1', '2.2', var='HILDON_2_2')
|
2009-11-14 16:38:16 +00:00
|
|
|
check_pkg ('hildon-fm-2', var='HILDON_FM')
|
2009-01-27 01:57:40 +00:00
|
|
|
hildon = ['N/A','yes'][conf.env['HAVE_HILDON'] == 1]
|
2009-06-05 21:14:53 +00:00
|
|
|
if hildon != 'yes':
|
|
|
|
option_checkfatal ('hildon', 'Maemo integration')
|
2009-06-02 23:49:47 +00:00
|
|
|
else:
|
2009-01-27 01:57:40 +00:00
|
|
|
hildon = 'no '
|
|
|
|
conf.define ('HAVE_HILDON', [0,1][hildon == 'yes'])
|
|
|
|
|
2009-06-06 04:37:55 +00:00
|
|
|
# Store options in env, since 'Options' is not persistent
|
2009-06-07 16:42:48 +00:00
|
|
|
if 'CC' in os.environ: conf.env['CC'] = os.environ['CC'].split()
|
2009-06-06 04:37:55 +00:00
|
|
|
conf.env['addons'] = option_enabled ('addons')
|
2010-05-02 10:26:32 +00:00
|
|
|
conf.env['tests'] = option_enabled ('tests')
|
2009-06-06 04:37:55 +00:00
|
|
|
conf.env['docs'] = option_enabled ('docs')
|
2010-01-16 06:46:58 +00:00
|
|
|
if 'LINGUAS' in os.environ: conf.env['LINGUAS'] = os.environ['LINGUAS']
|
2009-06-06 04:37:55 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
conf.check (header_name='unistd.h')
|
2009-06-15 21:58:19 +00:00
|
|
|
if not conf.env['HAVE_UNIQUE']:
|
|
|
|
if Options.platform == 'win32':
|
|
|
|
conf.check (lib='ws2_32')
|
|
|
|
conf.define ('HAVE_NETDB_H', [0,1][conf.check (header_name='netdb.h')])
|
|
|
|
conf.check (header_name='sys/wait.h')
|
|
|
|
conf.check (header_name='sys/select.h')
|
2010-02-17 20:59:34 +00:00
|
|
|
conf.check (function_name='inet_aton', header_name='sys/types.h sys/socket.h netinet/in.h arpa/inet.h')
|
|
|
|
conf.check (function_name='inet_addr', header_name='sys/types.h sys/socket.h netinet/in.h arpa/inet.h')
|
2009-01-09 21:54:40 +00:00
|
|
|
conf.define ('HAVE_OSX', int(sys.platform == 'darwin'))
|
2009-07-20 05:45:41 +00:00
|
|
|
if Options.platform == 'win32':
|
|
|
|
conf.env.append_value ('LINKFLAGS', '-mwindows')
|
2010-02-15 21:43:51 +00:00
|
|
|
conf.env.append_value ('program_LINKFLAGS', ['-Wl,--out-implib=default/midori/libmidori.a', '-Wl,--export-all-symbols'])
|
2009-12-10 20:53:43 +00:00
|
|
|
else:
|
|
|
|
conf.check (header_name='signal.h')
|
2008-06-01 13:16:40 +00:00
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.define ('PACKAGE_NAME', APPNAME)
|
2011-01-30 17:47:17 +00:00
|
|
|
conf.define ('PACKAGE_BUGREPORT', 'https://bugs.launchpad.net/midori')
|
2008-05-31 09:55:54 +00:00
|
|
|
conf.define ('GETTEXT_PACKAGE', APPNAME)
|
|
|
|
|
2011-10-23 17:23:03 +00:00
|
|
|
conf.define ('MIDORI_VERSION', VERSION)
|
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)
|
|
|
|
|
2010-07-04 08:45:35 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-DHAVE_CONFIG_H -include config.h'.split ())
|
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']
|
2010-04-22 21:54:46 +00:00
|
|
|
if debug_level != '' and compiler != 'gcc':
|
|
|
|
Utils.pprint ('RED', 'No debugging level support for ' + compiler)
|
|
|
|
sys.exit (1)
|
|
|
|
elif debug_level == '':
|
|
|
|
debug_level = 'debug'
|
2011-10-31 02:57:51 +00:00
|
|
|
|
|
|
|
if debug_level == 'full':
|
|
|
|
conf.define ('PACKAGE_VERSION', '%s (debug)' % VERSION_FULL)
|
2011-11-08 00:53:53 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-DMIDORI_VERSION_SUFFIX="%s (debug)"' % VERSION_SUFFIX)
|
2011-10-31 02:57:51 +00:00
|
|
|
else:
|
|
|
|
conf.define ('PACKAGE_VERSION', VERSION_FULL)
|
2011-11-08 00:53:53 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-DMIDORI_VERSION_SUFFIX="%s"' % VERSION_SUFFIX)
|
2011-10-31 02:57:51 +00:00
|
|
|
conf.write_config_header ('config.h')
|
|
|
|
|
2009-03-28 22:00:32 +00:00
|
|
|
if compiler == 'gcc':
|
2010-04-22 21:54:46 +00:00
|
|
|
if debug_level == 'none':
|
|
|
|
if 'CCFLAGS' in os.environ:
|
|
|
|
conf.env.append_value ('CCFLAGS', os.environ['CCFLAGS'].split ())
|
|
|
|
else:
|
2010-05-01 21:51:44 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT'.split ())
|
2010-04-22 21:54:46 +00:00
|
|
|
elif debug_level == 'debug':
|
2009-03-28 22:00:32 +00:00
|
|
|
conf.env.append_value ('CCFLAGS', '-Wall -O0 -g'.split ())
|
|
|
|
elif debug_level == 'full':
|
|
|
|
# -Wdeclaration-after-statement
|
|
|
|
# -Wmissing-declarations -Wmissing-prototypes
|
2009-09-18 17:36:09 +00:00
|
|
|
# -Wwrite-strings -Wunsafe-loop-optimizations -Wmissing-include-dirs
|
2009-03-28 22:00:32 +00:00
|
|
|
conf.env.append_value ('CCFLAGS',
|
|
|
|
'-Wall -Wextra -O1 -g '
|
|
|
|
'-Waggregate-return -Wno-unused-parameter '
|
|
|
|
'-Wno-missing-field-initializers '
|
|
|
|
'-Wredundant-decls -Wmissing-noreturn '
|
|
|
|
'-Wshadow -Wpointer-arith -Wcast-align '
|
2010-09-25 10:42:51 +00:00
|
|
|
'-Winline -Wformat-security -fno-common '
|
2010-01-31 19:39:58 +00:00
|
|
|
'-Winit-self -Wundef -Wdeclaration-after-statement '
|
2009-03-28 22:00:32 +00:00
|
|
|
'-Wmissing-format-attribute -Wnested-externs '
|
2010-01-31 19:39:58 +00:00
|
|
|
# -DGSEAL_ENABLE
|
|
|
|
'-DG_ENABLE_DEBUG -DG_DISABLE_DEPRECATED '
|
|
|
|
'-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED '
|
|
|
|
'-DGTK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED '
|
|
|
|
'-DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE'.split ())
|
2010-04-25 21:37:58 +00:00
|
|
|
if debug_level == 'full':
|
2011-10-19 07:01:28 +00:00
|
|
|
conf.env.append_value ('VALAFLAGS', '--debug --enable-checking'.split ())
|
|
|
|
elif debug_level == 'debug':
|
|
|
|
conf.env.append_value ('VALAFLAGS', '--debug'.split ())
|
2010-04-25 21:37:58 +00:00
|
|
|
elif debug_level == 'none':
|
|
|
|
conf.env.append_value ('VALAFLAGS', '--disable-assert')
|
2011-10-19 07:01:28 +00:00
|
|
|
conf.env.append_value ('VALAFLAGS', '--enable-deprecated')
|
2010-10-22 19:41:18 +00:00
|
|
|
print ('''
|
2009-06-14 19:35:24 +00:00
|
|
|
Localization: %(nls)s (intltool)
|
|
|
|
Icon optimizations: %(icons)s (rsvg-convert)
|
2009-12-14 22:51:05 +00:00
|
|
|
Notifications: %(libnotify)s (libnotify)
|
2009-06-14 19:35:24 +00:00
|
|
|
|
|
|
|
API documentation: %(api_docs)s (gtk-doc)
|
2010-10-22 19:41:18 +00:00
|
|
|
''' % locals ())
|
2009-01-20 03:53:01 +00:00
|
|
|
if unique == 'yes' and conf.check_cfg (modversion='unique-1.0') == '1.0.4':
|
2009-06-14 19:35:24 +00:00
|
|
|
Utils.pprint ('RED', 'unique 1.0.4 found, this version is erroneous.')
|
|
|
|
Utils.pprint ('RED', 'Please use an older or newer version.')
|
2008-11-10 21:18:35 +00:00
|
|
|
|
2008-05-31 12:20:36 +00:00
|
|
|
def set_options (opt):
|
2009-10-22 21:11:57 +00:00
|
|
|
def is_maemo (): return os.path.exists ('/etc/osso-af-init/')
|
2009-06-18 01:24:32 +00:00
|
|
|
|
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 ('-', '_')
|
2011-05-30 22:18:02 +00:00
|
|
|
group.add_option ('--enable-' + option, action='store_true', default=False,
|
|
|
|
help='Enable ' + desc + ' [Default: ' + str (not disable) + ']',
|
|
|
|
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 ('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', '')
|
2012-01-03 20:52:41 +00:00
|
|
|
add_enable_option ('unique', 'single instance support', group, disable=is_win32 (os.environ))
|
2009-12-14 22:51:05 +00:00
|
|
|
add_enable_option ('libnotify', 'notification support', group)
|
2012-03-14 19:55:34 +00:00
|
|
|
add_enable_option ('granite', 'new notebook, pop-overs', group)
|
2008-12-07 03:00:00 +00:00
|
|
|
add_enable_option ('addons', 'building of extensions', group)
|
2010-05-02 10:26:32 +00:00
|
|
|
add_enable_option ('tests', 'building of tests', group, disable=True)
|
2009-06-18 01:24:32 +00:00
|
|
|
add_enable_option ('hildon', 'Maemo integration', group, disable=not is_maemo ())
|
2011-10-09 12:30:45 +00:00
|
|
|
add_enable_option ('gtk3', 'GTK+3 and WebKitGTK+3 support', group, disable=True)
|
2008-11-18 01:07:53 +00:00
|
|
|
|
2009-10-31 21:44:30 +00:00
|
|
|
# Provided for compatibility
|
|
|
|
opt.add_option ('--build', help='Ignored')
|
|
|
|
opt.add_option ('--disable-maintainer-mode', help='Ignored')
|
|
|
|
|
2010-01-16 06:46:58 +00:00
|
|
|
# Taken from Geany's wscript, modified to support LINGUAS variable
|
|
|
|
def write_linguas_file (self):
|
|
|
|
linguas = ''
|
2010-02-15 21:34:28 +00:00
|
|
|
# Depending on Waf version, getcwd() is different
|
|
|
|
if os.path.exists ('./po'):
|
|
|
|
podir = './po'
|
|
|
|
else:
|
|
|
|
podir = '../po'
|
2010-01-16 06:46:58 +00:00
|
|
|
if 'LINGUAS' in Build.bld.env:
|
2010-03-08 20:12:00 +00:00
|
|
|
files = Build.bld.env['LINGUAS']
|
|
|
|
for f in files.split (' '):
|
|
|
|
if os.path.exists (podir + '/' + f + '.po'):
|
|
|
|
linguas += f + ' '
|
2010-01-16 06:46:58 +00:00
|
|
|
else:
|
2010-02-15 21:34:28 +00:00
|
|
|
files = os.listdir (podir)
|
2010-01-16 06:46:58 +00:00
|
|
|
for f in files:
|
|
|
|
if f.endswith ('.po'):
|
|
|
|
linguas += '%s ' % f[:-3]
|
2010-02-15 21:34:28 +00:00
|
|
|
f = open (podir + '/LINGUAS', 'w')
|
2010-01-16 06:46:58 +00:00
|
|
|
f.write ('# This file is autogenerated. Do not edit.\n%s\n' % linguas)
|
|
|
|
f.close ()
|
|
|
|
write_linguas_file = feature ('intltool_po')(write_linguas_file)
|
|
|
|
|
2008-05-31 09:55:54 +00:00
|
|
|
def build (bld):
|
2009-07-09 17:55:41 +00:00
|
|
|
bld.add_group ()
|
|
|
|
|
2010-01-01 17:20:08 +00:00
|
|
|
bld.add_subdirs ('midori icons')
|
2008-05-31 09:55:54 +00:00
|
|
|
|
2009-06-06 04:37:55 +00:00
|
|
|
if bld.env['addons']:
|
2008-11-18 01:07:53 +00:00
|
|
|
bld.add_subdirs ('extensions')
|
|
|
|
|
2009-06-06 04:32:20 +00:00
|
|
|
bld.add_group ()
|
|
|
|
|
2009-06-06 04:37:55 +00:00
|
|
|
if bld.env['docs']:
|
2010-11-01 20:21:58 +00:00
|
|
|
bld.install_files ('${DOCDIR}/', \
|
2011-03-08 22:25:37 +00:00
|
|
|
'AUTHORS COPYING ChangeLog EXPAT README data/faq.html data/faq.css')
|
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['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')
|
2010-10-18 20:17:19 +00:00
|
|
|
bld.install_files ('${DOCDIR}/api/', blddir + '/docs/api/*')
|
2008-09-07 19:48:04 +00:00
|
|
|
|
2011-09-05 23:20:27 +00:00
|
|
|
for desktop in [APPNAME + '.desktop', APPNAME + '-private.desktop']:
|
2012-01-03 20:52:41 +00:00
|
|
|
if is_win32 (bld.env):
|
2011-09-05 23:20:27 +00:00
|
|
|
break
|
2009-07-09 18:08:37 +00:00
|
|
|
if bld.env['HAVE_HILDON']:
|
|
|
|
appdir = '${MDATADIR}/applications/hildon'
|
|
|
|
bld.install_files ('${MDATADIR}/dbus-1/services',
|
|
|
|
'data/com.nokia.' + APPNAME + '.service')
|
|
|
|
else:
|
|
|
|
appdir = '${MDATADIR}/applications'
|
|
|
|
if bld.env['INTLTOOL']:
|
|
|
|
obj = bld.new_task_gen ('intltool_in')
|
2011-09-05 23:20:27 +00:00
|
|
|
obj.source = 'data/' + desktop + '.in'
|
2009-07-09 18:08:37 +00:00
|
|
|
obj.install_path = appdir
|
|
|
|
obj.flags = ['-d', '-c']
|
2011-09-05 23:20:27 +00:00
|
|
|
bld.install_files (appdir, 'data/' + desktop)
|
2009-07-09 18:08:37 +00:00
|
|
|
else:
|
|
|
|
folder = os.path.abspath (blddir + '/default/data')
|
|
|
|
Utils.check_dir (folder)
|
|
|
|
pre = open ('data/' + desktop + '.in')
|
|
|
|
after = open (folder + '/' + desktop, 'w')
|
2009-01-05 21:08:52 +00:00
|
|
|
try:
|
2009-07-09 18:08:37 +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)
|
|
|
|
bld.install_files (appdir, folder + '/' + desktop)
|
|
|
|
except:
|
|
|
|
Utils.pprint ('BLUE', 'File ' + desktop + ' not generated')
|
|
|
|
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-06-06 16:43:40 +00:00
|
|
|
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 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.")
|
2009-11-03 22:40:53 +00:00
|
|
|
|
2012-01-27 22:06:37 +00:00
|
|
|
for res_file in ['about.css', 'error.html', 'close.png']:
|
2011-10-11 00:12:07 +00:00
|
|
|
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/' + res_file)
|
2011-10-23 17:23:03 +00:00
|
|
|
bld.install_as ( \
|
|
|
|
'${MDATADIR}/' + APPNAME + '/res/speeddial-head-%s.html' % VERSION, \
|
|
|
|
'data/speeddial-head.html')
|
2009-11-03 22:40:53 +00:00
|
|
|
|
|
|
|
if bld.env['addons']:
|
|
|
|
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js')
|
|
|
|
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css')
|
|
|
|
|
2011-10-20 21:39:28 +00:00
|
|
|
if 1:
|
2010-06-26 13:38:37 +00:00
|
|
|
extensions = os.listdir ('data/extensions')
|
|
|
|
for extension in extensions:
|
|
|
|
source = 'data/extensions/' + extension + '/config'
|
|
|
|
if os.path.exists (source):
|
|
|
|
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \
|
2011-10-20 21:39:28 +00:00
|
|
|
'/extensions/' + extension, source)
|
2009-10-02 21:13:47 +00:00
|
|
|
|
2010-05-02 10:26:32 +00:00
|
|
|
if Options.commands['check'] or bld.env['tests']:
|
2008-11-14 01:46:23 +00:00
|
|
|
bld.add_subdirs ('tests')
|
|
|
|
|
2010-01-06 21:03:29 +00:00
|
|
|
if Options.commands['clean']:
|
|
|
|
distclean ()
|
|
|
|
|
2010-04-23 20:51:10 +00:00
|
|
|
def check (ctx):
|
|
|
|
# The real work happens in shutdown ()
|
|
|
|
pass
|
|
|
|
|
2010-01-06 21:03:29 +00:00
|
|
|
def distclean ():
|
2010-01-16 06:46:58 +00:00
|
|
|
if os.path.exists ('po/LINGUAS'):
|
|
|
|
os.remove ('po/LINGUAS')
|
2010-01-06 21:03:29 +00:00
|
|
|
if os.path.exists ('po/midori.pot'):
|
|
|
|
os.remove ('po/midori.pot')
|
|
|
|
|
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']:
|
2009-06-06 16:43:40 +00:00
|
|
|
dir = Build.bld.get_install_path ('${MDATADIR}/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
|
2010-10-22 19:41:18 +00:00
|
|
|
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:
|
2009-06-09 00:02:43 +00:00
|
|
|
folder = os.path.abspath (blddir + '/default')
|
2009-05-17 11:07:15 +00:00
|
|
|
try:
|
2009-06-06 17:28:58 +00:00
|
|
|
relfolder = folder
|
|
|
|
if not is_mingw (Build.bld.env):
|
|
|
|
relfolder = os.path.relpath (folder)
|
2009-05-17 11:07:15 +00:00
|
|
|
except:
|
|
|
|
pass
|
2008-12-12 09:10:10 +00:00
|
|
|
try:
|
2009-05-25 16:18:29 +00:00
|
|
|
ext = 'MIDORI_EXTENSION_PATH=' + relfolder + os.sep + 'extensions'
|
2009-10-03 00:27:51 +00:00
|
|
|
nls = 'MIDORI_NLSPATH=' + relfolder + os.sep + 'po'
|
2009-01-22 00:59:23 +00:00
|
|
|
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-06-06 17:28:58 +00:00
|
|
|
command = ext + ' ' + nls + ' '
|
|
|
|
if is_mingw (Build.bld.env):
|
|
|
|
# This works only if everything is installed to that prefix
|
|
|
|
os.chdir (Build.bld.env['PREFIX'] + os.sep + 'bin')
|
|
|
|
command += ' wine cmd /k "PATH=%PATH%;' + Build.bld.env['PREFIX'] + os.sep + 'bin' + ' && ' + APPNAME + '.exe"'
|
|
|
|
else:
|
|
|
|
command += ' ' + relfolder + os.sep + APPNAME + os.sep + APPNAME
|
2010-10-22 19:41:18 +00:00
|
|
|
print (command)
|
2009-06-06 17:28:58 +00:00
|
|
|
Utils.exec_command (command)
|
2010-10-31 21:44:24 +00:00
|
|
|
except Exception:
|
|
|
|
msg = sys.exc_info()[1] # Python 2/3 compatibility
|
2009-06-06 17:28:58 +00:00
|
|
|
Utils.pprint ('RED', "Failed to run application: " + str (msg))
|