meson.build 3.62 KB
Newer Older
1
project('girara', 'c',
2
  version: '0.2.8',
3
  meson_version: '>=0.43',
4
  default_options: 'c_std=c11',
5 6
)

7 8
version = meson.project_version()
version_array = version.split('.')
9

10 11 12 13 14 15 16
# Rules for so_major and so_minor:
# Before a release perform the following checks against the last release:
# * If a function has been removed or the paramaters of a function have changed
#   bump SOMAJOR and set SOMINOR to 0.
# * If any of the exported datastructures have changed in a incompatible way
#   bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR.
17 18 19 20 21
so_major = '3'
so_minor = '0'
so_version = '@0@.@1@'.format(so_major, so_minor)

conf_data = configuration_data()
22 23 24
conf_data.set('GVMAJOR', version_array[0])
conf_data.set('GVMINOR', version_array[1])
conf_data.set('GVREV', version_array[2])
25 26 27 28 29 30 31
conf_data.set('version', version)

cc = meson.get_compiler('c', required: false)

prefix = get_option('prefix')
localedir = get_option('localedir')

Sebastian Ramacher's avatar
Sebastian Ramacher committed
32
# required dependencies
33 34 35 36 37 38 39
libm = cc.find_library('libm')
glib = dependency('glib-2.0', version: '>=2.50')
gtk3 = dependency('gtk+-3.0', version: '>=3.20')

build_dependencies = [libm, glib, gtk3]
pc_requires = ['glib-2.0', 'gtk+-3.0']

Sebastian Ramacher's avatar
Sebastian Ramacher committed
40
# defines
41 42
defines = [
  '-DGETTEXT_PACKAGE="libgirara-gtk3-@0@"'.format(so_major),
Sebastian Ramacher's avatar
Sebastian Ramacher committed
43 44
  '-DLOCALEDIR="@0@"'.format(join_paths(prefix, localedir)),
  '-D_DEFAULT_SOURCE',
45 46
]

Sebastian Ramacher's avatar
Sebastian Ramacher committed
47
# compile flags
48 49 50 51 52
flags = [
  '-Wall',
  '-Wextra',
  '-pedantic',
  '-Wmissing-declarations',
Sebastian Ramacher's avatar
Sebastian Ramacher committed
53 54
  '-Werror=implicit-function-declaration',
  '-Werror=vla'
55 56 57
]
flags = cc.get_supported_arguments(flags)

Sebastian Ramacher's avatar
Sebastian Ramacher committed
58 59
# optional dependencies
pc_requires_private = []
60 61
libnotify = dependency('libnotify', version: '>=0.7.0', required: false)
jsonc = dependency('json-c', required: false)
Sebastian Ramacher's avatar
Sebastian Ramacher committed
62

63 64 65 66
if get_option('enable-notify') and libnotify.found()
  build_dependencies += libnotify
  defines += '-DWITH_LIBNOTIFY'
  pc_requires_private += 'libnotify'
67 68
endif

69 70
if get_option('enable-json') and jsonc.found()
  build_dependencies += jsonc
71
  defines += '-DWITH_JSON'
72
  pc_requires_private += 'json-c'
73 74
endif

Sebastian Ramacher's avatar
Sebastian Ramacher committed
75
# generate version header file
76 77
version_header = configure_file(
  input: 'girara/version.h.in',
78
  output: 'girara-version.h',
79 80 81 82 83 84 85 86 87
  configuration: conf_data
)
include_directories = [
  include_directories('.')
]

subdir('data')
subdir('po')

Sebastian Ramacher's avatar
Sebastian Ramacher committed
88
# source files
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
sources = files(
  'girara/callbacks.c',
  'girara/completion.c',
  'girara/entry.c',
  'girara/input-history-io.c',
  'girara/session.c',
  'girara/shortcuts.c',
  'girara/template.c',
  'girara/commands.c',
  'girara/config.c',
  'girara/datastructures.c',
  'girara/input-history.c',
  'girara/log.c',
  'girara/settings.c',
  'girara/statusbar.c',
  'girara/utils.c'
)
sources += girara_css

Sebastian Ramacher's avatar
Sebastian Ramacher committed
108
# header files to install
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
headers = files(
  'girara/callbacks.h',
  'girara/commands.h',
  'girara/completion.h',
  'girara/config.h',
  'girara/datastructures.h',
  'girara/entry.h',
  'girara/girara.h',
  'girara/input-history.h',
  'girara/log.h',
  'girara/macros.h',
  'girara/session.h',
  'girara/settings.h',
  'girara/shortcuts.h',
  'girara/statusbar.h',
  'girara/template.h',
  'girara/types.h',
  'girara/utils.h'
)
headers += version_header

Sebastian Ramacher's avatar
Sebastian Ramacher committed
130
# girara library
131 132 133 134 135 136 137 138 139 140 141
girara = library(
  'girara-gtk3',
  sources,
  dependencies: build_dependencies,
  soversion: so_version,
  install: true,
  include_directories: include_directories,
  c_args: defines + flags
)
install_headers(headers, subdir: 'girara')

Sebastian Ramacher's avatar
Sebastian Ramacher committed
142
# pkg-config file
143 144 145 146 147 148 149
pkg = import('pkgconfig')
pkg.generate(
  name: 'girara-gtk3',
  description: 'User interface library',
  url: 'https://pwmt.org/projects/girara',
  version: version,
  libraries: girara,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
150 151
  requires: pc_requires,
  requires_private: pc_requires_private,
152 153
)

154
subdir('doc')
155
subdir('tests')