Merge commit 'upstream/0.2.4'
[debian/pino.git] / wscript
1 #!/usr/bin/env python
2
3 import intltool
4
5 VERSION = "0.2.4"
6 VERSION_MAJOR_MINOR =  ".".join(VERSION.split(".")[0:2])
7 APPNAME = "pino"
8
9 srcdir = '.'
10 blddir = '_build_'
11
12 def set_options(opt):
13         opt.tool_options('compiler_cc')
14         opt.tool_options('gnu_dirs')
15
16 def configure(conf):
17         conf.check_tool('compiler_cc vala gnu_dirs intltool')
18         conf.check_cfg(package='glib-2.0', uselib_store='GLIB',
19                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
20         conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT',
21                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
22         conf.check_cfg(package='gtk+-2.0', uselib_store='GTK+',
23                 atleast_version='2.10.0', mandatory=True, args='--cflags --libs')
24         conf.check_cfg(package='gee-1.0', uselib_store='GEE',
25                 atleast_version='0.5.0', mandatory=True, args='--cflags --libs')
26         conf.check_cfg(package='gio-2.0', uselib_store='GIO',
27                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
28         conf.check_cfg(package='libnotify', uselib_store='LIBNOTIFY',
29                 mandatory=True, args='--cflags --libs')
30         #conf.check_cfg(package='libsexy', uselib_store='GTK+',
31         #               mandatory=True, args='--cflags --libs')
32         conf.check_cfg(package='libsoup-2.4', uselib_store='LIBSOUP',
33                 atleast_version='2.4', mandatory=True, args='--cflags --libs')
34         conf.check_cfg(package='libxml-2.0', uselib_store='LIBXML',
35                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
36         conf.check_cfg(package='webkit-1.0', uselib_store='WEBKIT',
37                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
38         conf.check_cfg(package='unique-1.0', uselib_store='LIBUNIQUE',
39                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
40         conf.check_cfg(package='gtkspell-2.0', uselib_store='GTKSPELL',
41                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
42
43         conf.env.append_value('CCFLAGS', '-std=c99')
44         
45         conf.define('PACKAGE', APPNAME)
46         conf.define('PACKAGE_NAME', APPNAME)
47         conf.define('PACKAGE_STRING', APPNAME + '-' + VERSION)
48         conf.define('PACKAGE_VERSION', APPNAME + '-' + VERSION)
49
50         conf.define('APP_VERSION', VERSION)
51         conf.define('LOGO_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino.svg')
52         conf.define('LOGO_FRESH_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino_fresh.svg')
53         conf.define('MENTIONS_PATH', conf.env.PREFIX + '/share/pino/icons/mentions.svg')
54         conf.define('MENTIONS_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/mentions_fresh.svg')
55         conf.define('TIMELINE_PATH', conf.env.PREFIX + '/share/pino/icons/timeline.svg')
56         conf.define('TIMELINE_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/timeline_fresh.svg')
57         conf.define('DIRECT_PATH', conf.env.PREFIX + '/share/pino/icons/direct.svg')
58         conf.define('DIRECT_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/direct_fresh.svg')
59         conf.define('PROGRESS_PATH', conf.env.PREFIX + '/share/pino/icons/progress.gif')
60         conf.define('DIRECT_REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/direct_reply.png')
61         conf.define('REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/reply.png')
62         conf.define('RETWEET_PATH', conf.env.PREFIX + '/share/pino/icons/re_tweet.png')
63         conf.define('DELETE_PATH', conf.env.PREFIX + '/share/pino/icons/delete_status.png')
64         conf.define('USERPIC_PATH', conf.env.PREFIX + '/share/pino/icons/userpic.svg')
65         conf.define('TEMPLATES_PATH', conf.env.PREFIX + '/share/pino/templates')
66         conf.define('VERSION_MAJOR_MINOR', VERSION_MAJOR_MINOR)
67         conf.define('LOCALE_DIR', conf.env.PREFIX + '/share/locale/')
68         conf.define('GETTEXT_PACKAGE', APPNAME)
69         conf.define('APPNAME', APPNAME)
70         conf.define('CONS_KEY', 'k6R1A0PPkmpRcThEdPF1Q')
71         conf.define('CONS_SEC', 'TKneXwqslxkbaR3RQGcvvvGU4Qk01qh8HAhRIMN74')
72         
73         # AUTHORS --> About dialog
74         f = open('AUTHORS', 'r')
75         data = f.read()
76         f.close()
77         import re
78         data = re.sub(r'\n', r'\\n', data)
79         conf.define('AUTHORS', data)
80         #end
81         
82         conf.write_config_header("config.h")
83         init_defs(conf.env.PREFIX)
84
85 def init_defs(prefix):
86         """
87         import re
88         data = re.sub(r'string PREFIX = \"(.*)\";', 'string PREFIX = "' + prefix + '";', data)
89         
90         f = open('src/defs.vala', 'w')
91         f.write(data)
92         f.close()
93         """
94
95 def build(bld):
96         bld.add_subdirs('src')
97         #bld.add_subdirs('liboauth-client')
98         bld.add_subdirs('templates')
99         bld.add_subdirs('po')
100         
101         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino.svg')
102         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino_fresh.svg')
103         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions.svg')
104         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions_fresh.svg')
105         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline.svg')
106         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline_fresh.svg')
107         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct.svg')
108         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_fresh.svg')
109         bld.install_files('${PREFIX}/share/pino/icons', 'img/progress.gif')
110         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_reply.png')
111         bld.install_files('${PREFIX}/share/pino/icons', 'img/reply.png')
112         bld.install_files('${PREFIX}/share/pino/icons', 'img/re_tweet.png')
113         bld.install_files('${PREFIX}/share/pino/icons', 'img/delete_status.png')
114         bld.install_files('${PREFIX}/share/pino/icons', 'img/userpic.svg')
115         bld.install_files('${PREFIX}/share/applications', 'pino.desktop')
116         bld.install_files('${PREFIX}/share/doc/pino', 'COPYING README AUTHORS INSTALL')
117         
118         #import subprocess
119         #subprocess.Popen(['desktop-file-install', '--rebuild-mime-info-cache', bld.env.PREFIX + '/share/applications/pino.desktop'], stdout=subprocess.PIPE)
120
121 def shutdown(bld):
122         """
123         import UnitTest
124         unittest = UnitTest.unit_test()
125         unittest.want_to_see_test_output = True
126         unittest.want_to_see_test_error = True
127         unittest.run()
128         unittest.print_results()
129         """