summaryrefslogtreecommitdiff
path: root/meson.build
blob: 9dfee8b3760719d3a301fdc2f404e7f52720ea46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
project('libgweather', 'c',
  version: '40.0',
  meson_version: '>= 0.50.0',
)

# Add another 0, so that we can release without a suffix
libgweather_version = meson.project_version().split('.') + [0]

# We use libtool-version numbers because it's easier to understand.
# Before making a release, the libgweather_so_*
# numbers should be modified. The components are of the form C:R:A.
# a) If binary compatibility has been broken (eg removed or changed interfaces)
#    change to C+1:0:0.
# b) If interfaces have been changed or added, but binary compatibility has
#    been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
libgweather_lt_c=16
libgweather_lt_r=0
libgweather_lt_a=0

# convert to soname
libgweather_so_version = '@0@.@1@.@2@'.format((libgweather_lt_c - libgweather_lt_a),
                                            libgweather_lt_a, libgweather_lt_r)

current = libgweather_lt_c - libgweather_lt_a
interface_age = libgweather_lt_r
libgweather_darwin_versions = [current + 1, '@0@.@1@'.format(current + 1, interface_age)]

pkgconfig = import('pkgconfig')
gnome = import('gnome')
i18n = import('i18n')

prefix = get_option('prefix')

bindir = join_paths(prefix, get_option('bindir'))
datadir = join_paths(prefix, get_option('datadir'))
libdir = join_paths(prefix, get_option('libdir'))
includedir = join_paths(prefix, get_option('includedir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
pkgdatadir = join_paths(datadir, 'libgweather')
pkglibdir = join_paths(libdir, 'libgweather')

glib_req_version = '>= 2.44.0'
gtk_req_version = '>= 3.13.5'
libsoup_req_version = '>= 2.44.0'
libxml_req_version = '>= 2.6.0'

c_compiler = meson.get_compiler('c')
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
glib_dep = dependency('gio-2.0', version: glib_req_version)
gmodule_dep = dependency('gmodule-2.0', version: glib_req_version)
libsoup_dep = dependency('libsoup-2.4', version: libsoup_req_version)
libxml_dep = dependency('libxml-2.0', version: libxml_req_version)
geocode_glib_dep = dependency('geocode-glib-1.0')
math_dep = c_compiler.find_library('m', required : false)
deps_libgweather = [math_dep, gtk_dep, glib_dep, gmodule_dep, libsoup_dep, libxml_dep, geocode_glib_dep]

pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
pylint_flags = ['-d', 'C0111', '-d', 'W0511', '-d', 'F0401', '-d', 'C0326' ]

config_h = configuration_data()
GETTEXT_PACKAGE = 'libgweather-3.0'
config_h.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE)
config_h.set_quoted('LOCALEDIR', join_paths(datadir, 'locale'))
config_h.set_quoted('GNOMELOCALEDIR', join_paths(datadir, 'locale'))
config_h.set_quoted('G_LOG_DOMAIN', 'GWeather')
config_h.set_quoted('GWEATHER_BIN_LOCATION_DIR', pkglibdir)
config_h.set_quoted('LIBGWEATHER_VERSION', meson.project_version())

if c_compiler.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
  config_h.set('HAVE_TM_TM_GMOFF', 1)
endif

if c_compiler.has_header_symbol('time.h', 'timezone')
  config_h.set('HAVE_TIMEZONE', 1)
endif

if c_compiler.has_header_symbol('langinfo.h', '_NL_MEASUREMENT_MEASUREMENT')
  config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1)
endif

config_h.set_quoted('ZONEINFO_DIR', get_option('zoneinfo_dir'))
config_h.set_quoted('OWM_APIKEY', get_option('owm_apikey'))

configure_file(
  output: 'config.h',
  configuration: config_h,
)

if get_option('glade_catalog') == 'false'
  enable_glade_catalog = false
else
  glade_dep = dependency('gladeui-2.0', required: (get_option('glade_catalog') == 'true'))
  enable_glade_catalog = glade_dep.found()
  if enable_glade_catalog
    glade_catalogdir = join_paths(datadir, 'glade', 'catalogs')
  endif
endif

enable_vala = get_option('enable_vala')
if enable_vala == 'auto'
  enable_vala = find_program('vapigen', required: false).found()
else
  enable_vala = enable_vala != 'false'
endif

root_inc = include_directories('.')

subdir('data')
subdir('libgweather')
subdir('schemas')
if get_option('gtk_doc')
  subdir('doc')
endif
subdir('po')
subdir('po-locations')
meson.add_install_script('meson/meson_post_install.py')

pkgconfig.generate(
  filebase: 'gweather-3.0',
  name: 'GWeather',
  description: 'GWeather shared library',
  version: meson.project_version(),
  libraries: lib_libgweather,
  subdirs: 'libgweather-3.0',
  requires: [
    'gtk+-3.0',
  ],
  requires_private: [
    'gio-2.0',
    'libsoup-2.4',
    'libxml-2.0',
    'geocode-glib-1.0',
  ],
)