2008-07-27 05:39:39 +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-07-27 05:39:39 +00:00
|
|
|
|
2009-02-19 01:07:03 +00:00
|
|
|
import Utils
|
2009-06-09 00:02:43 +00:00
|
|
|
import os
|
2009-02-19 01:07:03 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
def add_image (bld, category, name):
|
2008-07-27 05:39:39 +00:00
|
|
|
|
|
|
|
srcdir = os.getcwd ()
|
2009-01-04 20:38:06 +00:00
|
|
|
blddir = bld.bdir
|
2008-07-27 05:39:39 +00:00
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
rsvg_convert = bld.env['RSVG_CONVERT']
|
2008-08-10 13:53:07 +00:00
|
|
|
|
|
|
|
if rsvg_convert:
|
2009-02-19 01:07:03 +00:00
|
|
|
Utils.check_dir (blddir + '/icons')
|
2008-07-27 05:39:39 +00:00
|
|
|
|
2009-11-03 22:40:21 +00:00
|
|
|
if bld.env['HAVE_HILDON']:
|
|
|
|
category = 'hildon'
|
|
|
|
icon_sizes = [48, 64]
|
|
|
|
else:
|
|
|
|
icon_sizes = [16, 22, 24, 32, 48]
|
|
|
|
|
|
|
|
for size in icon_sizes:
|
2008-07-27 05:39:39 +00:00
|
|
|
format = str (size) + 'x' + str (size)
|
|
|
|
if os.access (srcdir + '/icons/' + format + '/' + name + '.png', os.F_OK):
|
2009-06-06 16:43:40 +00:00
|
|
|
bld.install_files ('${MDATADIR}/icons/hicolor/' + format + '/' + category,
|
2009-01-12 23:50:01 +00:00
|
|
|
srcdir + '/icons/' + format + '/' + name + '.png')
|
2008-08-10 13:53:07 +00:00
|
|
|
elif not rsvg_convert:
|
2008-07-27 05:39:39 +00:00
|
|
|
pass
|
|
|
|
elif os.access (srcdir + '/icons/scalable/' + name + '.svg', os.F_OK):
|
2009-02-19 01:07:03 +00:00
|
|
|
Utils.check_dir (blddir + '/icons/' + format)
|
2009-01-04 20:38:06 +00:00
|
|
|
command = rsvg_convert + ' -w ' + str(size) + \
|
|
|
|
' -h ' + str(size) + \
|
|
|
|
' -o ' + blddir + '/icons/' + format + '/' + name + '.png' + \
|
|
|
|
' ' + srcdir + '/icons/scalable/' + name + '.svg'
|
|
|
|
if not Utils.exec_command (command):
|
2009-06-06 16:43:40 +00:00
|
|
|
bld.install_files ('${MDATADIR}/icons/hicolor/' + format + '/' + category,
|
2009-01-12 23:50:01 +00:00
|
|
|
blddir + '/icons/' + format + '/' + name + '.png')
|
2008-07-27 05:39:39 +00:00
|
|
|
else:
|
2009-01-04 20:38:06 +00:00
|
|
|
Utils.pprint ('BLUE', "Optimized icons could not be created.")
|
2008-07-27 05:39:39 +00:00
|
|
|
break
|
|
|
|
|
2009-01-04 20:38:06 +00:00
|
|
|
add_image (bld, 'categories', 'extension')
|
|
|
|
add_image (bld, 'apps', 'midori')
|
|
|
|
add_image (bld, 'status', 'news-feed')
|