summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-12-13 16:12:03 -0500
committerPatrick Griffis <tingping@tingping.se>2017-06-13 23:54:51 -0400
commit628100c19f5d82747170acdf2917cba8c119ccbf (patch)
tree351a7e9714a1a58390ba349808df5703cef25c3e /src/fe-gtk
parent2edf50d4ddc61ce6f73bf02263c9bdd09632c66b (diff)
build: Replace Autotools with Meson
Quick rundown of benefits:

- Much faster:
  - Autotools (with autogen): 22 seconds
  - Meson: 7 seconds
  - Meson (with ccache): 2 seconds

- Simpler:
  - ~1000 lines smaller
  - Single simple language

- Potentially better Windows (Visual Studio) support

What is not done:

- Complete Windows support
- OSX support (easy)

Closes #2013
Closes #1937
Closes #1803
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/Makefile.am64
-rw-r--r--src/fe-gtk/meson.build79
2 files changed, 79 insertions, 64 deletions
diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am
deleted file mode 100644
index 269eaa55..00000000
--- a/src/fe-gtk/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@
-
-include $(top_srcdir)/m4/clang-analyze.am
-
-localedir = $(datadir)/locale
-
-bin_PROGRAMS = hexchat
-
-AM_CPPFLAGS = $(GUI_CFLAGS) -DLOCALEDIR=\"$(localedir)\"
-
-hexchat_LDADD = $(top_builddir)/src/common/libhexchatcommon.a $(GUI_LIBS)
-
-EXTRA_DIST = \
-	ascii.h banlist.h chanlist.h chanview.h chanview-tabs.c \
-	chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \
-	maingui.h menu.h notifygui.h  notifications palette.h pixmaps.h plugin-notification.h \
-	plugin-tray.h plugingui.c plugingui.h rawlog.h servlistgui.h setup.h sexy-iso-codes.h \
-	sexy-spell-entry.h textgui.h urlgrab.h userlistgui.h xtext.h
-
-BUILT_SOURCES = resources.h resources.c
-
-CLEANFILES = $(BUILT_SOURCES)
-
-if DO_PLUGIN
-plugingui_c = plugingui.c
-endif
-
-if HAVE_ISO_CODES
-iso_codes_c = sexy-iso-codes.c
-endif
-
-if USE_LIBNOTIFY
-notify_c = notifications/notification-libnotify.c
-else
-if HAVE_GTK_MAC
-notify_c = notifications/notification-osx.m
-hexchat_LDFLAGS = -framework Foundation
-else
-notify_c = notifications/notification-dummy.c
-endif
-endif
-
-nodist_hexchat_SOURCES = resources.h resources.c
-hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \
-	dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \
-	maingui.c notifygui.c $(notify_c) palette.c pixmaps.c plugin-tray.c $(plugingui_c) \
-	plugin-notification.c rawlog.c servlistgui.c setup.c $(iso_codes_c) \
-	sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c
-hexchat_CPPFLAGS = -I$(top_builddir)/src/common $(AM_CPPFLAGS)
-
-resources_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/data --generate-dependencies $(top_srcdir)/data/hexchat.gresource.xml)
-
-resources.h: $(top_srcdir)/data/hexchat.gresource.xml $(resources_files)
-	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-header --manual-register $<
-
-resources.c: $(top_srcdir)/data/hexchat.gresource.xml $(resources_files)
-	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-source --manual-register $<
-
-EXTRA_DIST += $(resources_files)
-
-if DO_STATIC_ANALYSIS
-analyze_plists = $(hexchat_SOURCES:%.c=%.plist)
-all-local: $(analyze_plists)
-MOSTLYCLEANFILES = $(analyze_plists)
-endif
diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build
new file mode 100644
index 00000000..731709b1
--- /dev/null
+++ b/src/fe-gtk/meson.build
@@ -0,0 +1,79 @@
+hexchat_gtk_sources = [
+  'ascii.c',
+  'banlist.c',
+  'chanlist.c',
+  'chanview.c',
+  'custom-list.c',
+  'dccgui.c',
+  'editlist.c',
+  'fe-gtk.c',
+  'fkeys.c',
+  'gtkutil.c',
+  'ignoregui.c',
+  'joind.c',
+  'menu.c',
+  'maingui.c',
+  'notifygui.c',
+  'palette.c',
+  'pixmaps.c',
+  'plugin-tray.c',
+  'plugin-notification.c',
+  'rawlog.c',
+  'servlistgui.c',
+  'setup.c',
+  'sexy-spell-entry.c',
+  'textgui.c',
+  'urlgrab.c',
+  'userlistgui.c',
+  'xtext.c'
+]
+
+hexchat_gtk_deps = [
+  hexchat_common_dep,
+  libgmodule_dep, # used by libsexy
+  dependency('gtk+-2.0', version: '>= 2.24.0')
+]
+
+hexchat_gtk_cflags = [
+  '-fPIE'
+]
+
+hexchat_gtk_ldflags = [
+  '-pie'
+]
+
+if get_option('with-libnotify')
+  hexchat_gtk_sources += 'notifications/notification-libnotify.c'
+  hexchat_gtk_deps += dependency('libnotify')
+elif false # TODO HAVE_GTK_MAC
+else
+  hexchat_gtk_sources += 'notifications/notification-dummy.c'
+endif
+
+iso_codes = dependency('iso-codes', required: false)
+if iso_codes.found()
+  hexchat_gtk_sources += 'sexy-iso-codes.c'
+  iso_codes_prefix = iso_codes.get_pkgconfig_variable('prefix')
+  hexchat_gtk_cflags += '-DISO_CODES_PREFIX="@0@"'.format(iso_codes_prefix)
+  hexchat_gtk_cflags += '-DISO_CODES_LOCALEDIR="@0@"'.format(
+                        join_paths(iso_codes_prefix, 'share/locale'))
+endif
+
+if get_option('with-plugin')
+  hexchat_gtk_sources += 'plugingui.c'
+endif
+
+resources = gnome.compile_resources('resources',
+  '../../data/hexchat.gresource.xml',
+  source_dir: '../../data', # TODO: Fix upstream
+  c_name: 'hexchat',
+  extra_args: ['--manual-register']
+)
+
+executable('hexchat',
+  sources:  resources + hexchat_gtk_sources,
+  dependencies: hexchat_gtk_deps,
+  c_args: hexchat_gtk_cflags,
+  link_args: hexchat_gtk_ldflags,
+  install: true
+)