Do not install useless files
[debian/pino.git] / wscript
1 #!/usr/bin/env python
2
3 import intltool
4
5 VERSION = "0.2.9"
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         opt.add_option('--ubuntuicons', action = 'store_true', default = False,
16                 help = 'Install icons for Ubuntu mono themes')
17         opt.add_option('--debug', action = 'store_true', default = False,
18                 help = 'Enable debug messages')
19
20 def configure(conf):
21         conf.check_tool('compiler_cc vala gnu_dirs intltool')
22         conf.check_cfg(package='glib-2.0', uselib_store='GLIB',
23                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
24         conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT',
25                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
26         conf.check_cfg(package='gtk+-2.0', uselib_store='GTK+',
27                 atleast_version='2.10.0', mandatory=True, args='--cflags --libs')
28         conf.check_cfg(package='gee-1.0', uselib_store='GEE',
29                 atleast_version='0.5.0', mandatory=True, args='--cflags --libs')
30         conf.check_cfg(package='gio-2.0', uselib_store='GIO',
31                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
32         conf.check_cfg(package='libnotify', uselib_store='LIBNOTIFY',
33                 mandatory=True, args='--cflags --libs')
34         #conf.check_cfg(package='libsexy', uselib_store='GTK+',
35         #               mandatory=True, args='--cflags --libs')
36         conf.check_cfg(package='libsoup-2.4', uselib_store='LIBSOUP',
37                 atleast_version='2.4', mandatory=True, args='--cflags --libs')
38         conf.check_cfg(package='libxml-2.0', uselib_store='LIBXML',
39                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
40         conf.check_cfg(package='webkit-1.0', uselib_store='WEBKIT',
41                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
42         conf.check_cfg(package='unique-1.0', uselib_store='LIBUNIQUE',
43                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
44         conf.check_cfg(package='gtkspell-2.0', uselib_store='GTKSPELL',
45                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
46         conf.check_cfg(package='indicate', uselib_store='LIBINDICATE',
47                 atleast_version='0.3', mandatory=False, args='--cflags --libs')
48
49         conf.env.append_value('CCFLAGS', '-std=c99')
50         
51         conf.define('PACKAGE', APPNAME)
52         conf.define('PACKAGE_NAME', APPNAME)
53         conf.define('PACKAGE_STRING', APPNAME + '-' + VERSION)
54         conf.define('PACKAGE_VERSION', APPNAME + '-' + VERSION)
55
56         conf.define('APP_VERSION', VERSION)
57         conf.define('DESKTOP_FILE_PATH', conf.env.PREFIX + '/share/applications/pino.desktop')
58         conf.define('APP_PATH', conf.env.PREFIX + '/bin/pino')
59         conf.define('LOGO_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino.svg')
60         conf.define('LOGO_FRESH_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino_fresh.svg')
61         conf.define('MENTIONS_PATH', conf.env.PREFIX + '/share/pino/icons/mentions.svg')
62         conf.define('MENTIONS_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/mentions_fresh.svg')
63         conf.define('TIMELINE_PATH', conf.env.PREFIX + '/share/pino/icons/timeline.svg')
64         conf.define('TIMELINE_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/timeline_fresh.svg')
65         conf.define('DIRECT_PATH', conf.env.PREFIX + '/share/pino/icons/direct.svg')
66         conf.define('DIRECT_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/direct_fresh.svg')
67         conf.define('PROGRESS_PATH', conf.env.PREFIX + '/share/pino/icons/progress.gif')
68         conf.define('DIRECT_REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/direct_reply.png')
69         conf.define('FAVORITE_PATH', conf.env.PREFIX + '/share/pino/icons/favorite.png')
70         conf.define('FAVORITE_NO_PATH', conf.env.PREFIX + '/share/pino/icons/favorite_no.png')
71         #conf.define('FAVORITE_MENU_PATH', conf.env.PREFIX + '/share/pino/icons/favorite_menu.svg')
72         conf.define('REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/reply.png')
73         conf.define('RETWEET_PATH', conf.env.PREFIX + '/share/pino/icons/re_tweet.png')
74         conf.define('DELETE_PATH', conf.env.PREFIX + '/share/pino/icons/delete_status.png')
75         conf.define('USERPIC_PATH', conf.env.PREFIX + '/share/pino/icons/userpic.svg')
76         conf.define('TEMPLATES_PATH', conf.env.PREFIX + '/share/pino/templates')
77         conf.define('VERSION_MAJOR_MINOR', VERSION_MAJOR_MINOR)
78         conf.define('LOCALE_DIR', conf.env.PREFIX + '/share/locale/')
79         conf.define('GETTEXT_PACKAGE', APPNAME)
80         conf.define('APPNAME', APPNAME)
81
82         import Options
83         conf.env.UBUNTUICONS = Options.options.ubuntuicons
84         conf.env.DEBUG = Options.options.debug
85         conf.define('CONS_KEY', 'k6R1A0PPkmpRcThEdPF1Q')
86         conf.define('CONS_SEC', 'TKneXwqslxkbaR3RQGcvvvGU4Qk01qh8HAhRIMN74')
87         
88         # AUTHORS --> About dialog
89         f = open('AUTHORS', 'r')
90         data = f.read()
91         f.close()
92         import re
93         data = re.sub(r'\n', r'\\n', data)
94         conf.define('AUTHORS', data)
95         #end
96         
97         conf.write_config_header("config.h")
98         init_defs(conf.env.PREFIX)
99
100 def init_defs(prefix):
101         """
102         import re
103         data = re.sub(r'string PREFIX = \"(.*)\";', 'string PREFIX = "' + prefix + '";', data)
104         
105         f = open('src/defs.vala', 'w')
106         f.write(data)
107         f.close()
108         """
109
110 def build(bld):
111         bld.add_subdirs('src')
112         #bld.add_subdirs('liboauth-client')
113         bld.add_subdirs('templates')
114         bld.add_subdirs('po')
115         
116         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino.svg')
117         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino_fresh.svg')
118         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions.svg')
119         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions_fresh.svg')
120         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline.svg')
121         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline_fresh.svg')
122         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct.svg')
123         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_fresh.svg')
124         bld.install_files('${PREFIX}/share/pino/icons', 'img/progress.gif')
125         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_reply.png')
126         bld.install_files('${PREFIX}/share/pino/icons', 'img/favorite.png')
127         bld.install_files('${PREFIX}/share/pino/icons', 'img/favorite_no.png')
128         #bld.install_files('${PREFIX}/share/pino/icons', 'img/favorite_menu.svg')
129         bld.install_files('${PREFIX}/share/pino/icons', 'img/reply.png')
130         bld.install_files('${PREFIX}/share/pino/icons', 'img/re_tweet.png')
131         bld.install_files('${PREFIX}/share/pino/icons', 'img/delete_status.png')
132         bld.install_files('${PREFIX}/share/pino/icons', 'img/userpic.svg')
133         bld.install_files('${PREFIX}/share/applications', 'pino.desktop')
134         bld.install_files('${PREFIX}/share/doc/pino', 'COPYING README AUTHORS INSTALL')
135         bld.install_files('${PREFIX}/share/indicators/messages/applications', 'indicator/pino')
136
137         if bld.env['UBUNTUICONS']:
138                 bld.install_files('${PREFIX}/share/icons/ubuntu-mono-dark/apps/22', 'img/ubuntu-mono-dark/pino-tray-icon.svg')
139                 bld.install_files('${PREFIX}/share/icons/ubuntu-mono-dark/apps/22', 'img/ubuntu-mono-dark/pino-tray-icon-fresh.svg')
140                 bld.install_files('${PREFIX}/share/icons/ubuntu-mono-light/apps/22', 'img/ubuntu-mono-light/pino-tray-icon.svg')
141                 bld.install_files('${PREFIX}/share/icons/ubuntu-mono-light/apps/22', 'img/ubuntu-mono-light/pino-tray-icon-fresh.svg')
142         #import subprocess
143         #subprocess.Popen(['desktop-file-install', '--rebuild-mime-info-cache', bld.env.PREFIX + '/share/applications/pino.desktop'], stdout=subprocess.PIPE)
144
145 def shutdown(bld):
146         """
147         import UnitTest
148         unittest = UnitTest.unit_test()
149         unittest.want_to_see_test_output = True
150         unittest.want_to_see_test_error = True
151         unittest.run()
152         unittest.print_results()
153         """