grim/guifications2

move to meson
draft
2021-04-07, Gary Kramlich
4fa307ed7dcd
Parents 1d3ea2c38497
Children 5a4e68fcaf32
move to meson
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson.build Wed Apr 07 02:03:29 2021 -0500
@@ -0,0 +1,88 @@
+###############################################################################
+# Project Info
+###############################################################################
+project('guifications', 'c',
+ license : 'GPL-2.0-or-later',
+ version : '2.17.0-dev',
+ meson_version : '>=0.52.0',
+ default_options : ['c_std=c99'])
+
+parts = meson.project_version().split('-')
+if parts.length() > 1
+ extra = parts[1]
+else
+ extra = ''
+endif
+
+parts = parts[0].split('.')
+
+version_conf = configuration_data()
+version_conf.set('GUIFICATIONS_MAJOR_VERSION', parts[0])
+version_conf.set('GUIFICATIONS_MINOR_VERSION', parts[1])
+version_conf.set('GUIFICATIONS_MICRO_VERSION', parts[2])
+version_conf.set('GUIFICATIONS_EXTRA_VERSION', extra)
+version_conf.set('GUIFICATIONS_VERSION', meson.project_version())
+
+###############################################################################
+# Dependencies
+###############################################################################
+pkgconfig = import('pkgconfig')
+
+GLIB = dependency('glib-2.0', version : '>=2.14.0')
+GTK2 = dependency('gtk+-2.0', version : '>=2.14.0')
+CAIRO = dependency('cairo')
+FREETYPE2 = dependency('freetype2')
+PANGOFT2 = dependency('pangoft2', version : '>=1.1.0')
+
+PURPLE = dependency('purple')
+PIDGIN = dependency('pidgin')
+
+###############################################################################
+# NLS
+###############################################################################
+GETTEXT_PACKAGE = 'guifications'
+LOCALE_DIR = get_option('prefix') / get_option('localedir')
+
+add_project_arguments('-DLOCALEDIR="@0@"'.format(LOCALE_DIR), language : 'c')
+add_project_arguments('-DGETTEXT_PACKAGE="@0@"'.format(GETTEXT_PACKAGE),
+ language : 'c')
+
+if get_option('nls')
+ i18n = import('i18n')
+endif
+
+###############################################################################
+# Build Info
+###############################################################################
+compiler = meson.get_compiler('c')
+
+add_project_arguments(
+ '-DDATADIR="@0@"'.format(get_option('datadir')),
+ '-DGF_WEBSITE="https://keep.imfreedom.org/grim/guifications2"',
+ '-DLIBDIR="@0@"'.format(get_option('libdir')),
+ '-DPREFIX="@0@"'.format(get_option('prefix')),
+ '-DVERSION="@0"'.format(meson.project_version()),
+ language : 'c'
+)
+
+if compiler.has_argument('-Wformat')
+ add_project_arguments('-Wformat', language : 'c')
+ if compiler.has_multi_arguments(['-Wformat', '-Werror=format-security'])
+ add_project_arguments('-Werror=format-security', language : 'c')
+ endif
+endif
+
+toplevel_inc = include_directories('.')
+
+###############################################################################
+# Subdirectories
+###############################################################################
+subdir('src')
+subdir('po')
+
+###############################################################################
+# Install stuff
+###############################################################################
+install_data('ChangeLog', 'INSTALL', 'NEWS', 'README',
+ install_dir : get_option('datadir') / 'doc' / 'guifications2')
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson_options.txt Wed Apr 07 02:03:29 2021 -0500
@@ -0,0 +1,6 @@
+option(
+ 'nls',
+ type : 'boolean', value : true,
+ description : 'Install translation files'
+)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/po/meson.build Wed Apr 07 02:03:29 2021 -0500
@@ -0,0 +1,3 @@
+if get_option('nls')
+ i18n.gettext(GETTEXT_PACKAGE)
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/meson.build Wed Apr 07 02:03:29 2021 -0500
@@ -0,0 +1,61 @@
+HEADERS = [
+ 'gf_action.h',
+ 'gf_blist.h',
+ 'gf_display.h',
+ 'gf_event.h',
+ 'gf_event_info.h',
+ 'gf_file.h',
+ 'gf_gtk_utils.h',
+ 'gf_internal.h',
+ 'gf_item.h',
+ 'gf_item_icon.h',
+ 'gf_item_image.h',
+ 'gf_item_offset.h',
+ 'gf_item_text.h',
+ 'gf_menu.h',
+ 'gf_notification.h',
+ 'gf_preferences.h',
+ 'gf_stock.h',
+ 'gf_theme.h',
+ 'gf_theme_editor.h',
+ 'gf_theme_info.h',
+ 'gf_theme_ops.h',
+ 'gf_utils.h',
+]
+
+SOURCES = [
+ 'gf_action.c',
+ 'gf_blist.c',
+ 'gf_display.c',
+ 'gf_event.c',
+ 'gf_event_info.c',
+ 'gf_file.c',
+ 'gf_gtk_utils.c',
+ 'gf_item.c',
+ 'gf_item_icon.c',
+ 'gf_item_image.c',
+ 'gf_item_offset.c',
+ 'gf_item_text.c',
+ 'gf_menu.c',
+ 'gf_notification.c',
+ 'gf_preferences.c',
+ 'gf_stock.c',
+ 'gf_theme.c',
+ 'gf_theme_editor.c',
+ 'gf_theme_info.c',
+ 'gf_theme_ops.c',
+ 'gf_utils.c',
+ 'guifications.c',
+]
+
+if target_machine.system() == 'windows'
+ SOURCES += 'gf_win32_display.c'
+else
+ SOURCES += 'gf_x11_display.c'
+endif
+
+guifications2 = shared_module('guifications2',
+ SOURCES, HEADERS,
+ dependencies: [FREETYPE2, GLIB, GTK2, PANGOFT2, PURPLE, PIDGIN],
+)
+