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
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
if DO_LUA
|
||||
lua = lua
|
||||
endif
|
||||
|
||||
if DO_PYTHON
|
||||
pythondir = python
|
||||
endif
|
||||
|
||||
if DO_PERL
|
||||
perldir = perl
|
||||
endif
|
||||
|
||||
if DO_FISHLIM
|
||||
fishlimdir = fishlim
|
||||
endif
|
||||
|
||||
if DO_CHECKSUM
|
||||
checksumdir = checksum
|
||||
endif
|
||||
|
||||
if DO_SYSINFO
|
||||
sysinfodir = sysinfo
|
||||
endif
|
||||
|
||||
SUBDIRS = $(lua) $(pythondir) $(perldir) $(checksumdir) $(fishlimdir) $(sysinfodir)
|
@ -1,8 +0,0 @@
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
lib_LTLIBRARIES = checksum.la
|
||||
checksum_la_SOURCES = checksum.c
|
||||
checksum_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
checksum_la_LIBADD = $(GLIB_LIBS)
|
||||
checksum_la_CPPFLAGS = -I$(top_srcdir)/src/common
|
||||
checksum_la_CFLAGS = $(GLIB_CFLAGS)
|
6
plugins/checksum/meson.build
Normal file
6
plugins/checksum/meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
shared_module('checksum', 'checksum.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
5
plugins/exec/meson.build
Normal file
5
plugins/exec/meson.build
Normal file
@ -0,0 +1,5 @@
|
||||
shared_module('exec', 'exec.c',
|
||||
dependencies: hexchat_plugin_dep,
|
||||
install: true,
|
||||
install_dir: plugindir
|
||||
)
|
@ -1,10 +0,0 @@
|
||||
EXTRA_DIST = LICENSE fish.h irc.h keystore.h plugin_hexchat.h dh1080.h
|
||||
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
lib_LTLIBRARIES = fishlim.la
|
||||
fishlim_la_SOURCES = fish.c irc.c keystore.c plugin_hexchat.c dh1080.c
|
||||
fishlim_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
fishlim_la_LIBADD = $(GLIB_LIBS) $(OPENSSL_LIBS)
|
||||
fishlim_la_CPPFLAGS = -I$(top_srcdir)/src/common
|
||||
fishlim_la_CFLAGS = $(GLIB_CFLAGS) $(OPENSSL_CFLAGS)
|
18
plugins/fishlim/meson.build
Normal file
18
plugins/fishlim/meson.build
Normal file
@ -0,0 +1,18 @@
|
||||
if not libssl_dep.found()
|
||||
error('fish plugin requires openssl')
|
||||
endif
|
||||
|
||||
fishlim_sources = [
|
||||
'dh1080.c',
|
||||
'fish.c',
|
||||
'irc.c',
|
||||
'keystore.c',
|
||||
'plugin_hexchat.c'
|
||||
]
|
||||
|
||||
shared_module('fishlim', fishlim_sources,
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, libssl_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
lib_LTLIBRARIES = lua.la
|
||||
lua_la_SOURCES = lua.c
|
||||
lua_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
lua_la_LIBADD = $(LUA_LIBS) $(GLIB_LIBS)
|
||||
lua_la_CPPFLAGS = -I$(top_srcdir)/src/common
|
||||
lua_la_CFLAGS = $(GLIB_CFLAGS) $(LUA_CFLAGS)
|
||||
|
12
plugins/lua/meson.build
Normal file
12
plugins/lua/meson.build
Normal file
@ -0,0 +1,12 @@
|
||||
if cc.get_id() == 'msvc'
|
||||
lua_dep = cc.find_library('lua51')
|
||||
else
|
||||
lua_dep = dependency(get_option('with-lua'))
|
||||
endif
|
||||
|
||||
shared_module('lua', 'lua.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, lua_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
39
plugins/meson.build
Normal file
39
plugins/meson.build
Normal file
@ -0,0 +1,39 @@
|
||||
plugindir = join_paths(get_option('libdir'), 'hexchat/plugins')
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
if get_option('with-exec')
|
||||
subdir('exec')
|
||||
endif
|
||||
|
||||
if get_option('with-upd')
|
||||
subdir('upd')
|
||||
endif
|
||||
|
||||
if get_option('with-winamp')
|
||||
subdir('winamp')
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('with-checksum')
|
||||
subdir('checksum')
|
||||
endif
|
||||
|
||||
if get_option('with-fishlim')
|
||||
subdir('fishlim')
|
||||
endif
|
||||
|
||||
if get_option('with-lua') != 'false'
|
||||
subdir('lua')
|
||||
endif
|
||||
|
||||
if get_option('with-perl')
|
||||
subdir('perl')
|
||||
endif
|
||||
|
||||
if get_option('with-python') != 'false'
|
||||
subdir('python')
|
||||
endif
|
||||
|
||||
if get_option('with-sysinfo')
|
||||
subdir('sysinfo')
|
||||
endif
|
@ -1,20 +0,0 @@
|
||||
|
||||
EXTRA_DIST=generate_header lib/HexChat.pm lib/Xchat.pm lib/HexChat/Embed.pm lib/HexChat/List/Network.pm \
|
||||
lib/HexChat/List/Network/Entry.pm lib/HexChat/List/Network/AutoJoin.pm lib/IRC.pm
|
||||
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
lib_LTLIBRARIES = perl.la
|
||||
perl_la_SOURCES = perl.c
|
||||
perl_la_LDFLAGS = $(PERL_LDFLAGS) $(PLUGIN_LDFLAGS) -module
|
||||
perl_la_LIBADD = $(GLIB_LIBS)
|
||||
perl_la_CPPFLAGS = -I$(top_srcdir)/src/common
|
||||
perl_la_CFLAGS = $(PERL_CFLAGS) $(GLIB_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = hexchat.pm.h irc.pm.h
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
hexchat.pm.h irc.pm.h: lib/HexChat.pm lib/Xchat.pm lib/HexChat/Embed.pm \
|
||||
lib/HexChat/List/Network.pm lib/HexChat/List/Network/Entry.pm \
|
||||
lib/HexChat/List/Network/AutoJoin.pm lib/IRC.pm
|
||||
cd $(srcdir); perl generate_header
|
29
plugins/perl/generate_header.py
Executable file
29
plugins/perl/generate_header.py
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from os.path import basename
|
||||
|
||||
out_file = sys.argv[1]
|
||||
in_files = sys.argv[2:]
|
||||
|
||||
|
||||
def escape_perl(file):
|
||||
ret = ''
|
||||
for line in file:
|
||||
# Escape " and \, strip empty space, shove in C strings.
|
||||
ret += '"' + line.strip().replace('\\', '\\\\').replace('"', '\\"') + '\\n"\n'
|
||||
return ret
|
||||
|
||||
|
||||
with open(out_file, 'w') as o:
|
||||
o.write('"BEGIN {\\n"\n')
|
||||
for in_file in in_files:
|
||||
o.write("\"$INC{{'{}'}} = 'Compiled into the plugin.';\\n\"\n".format(basename(in_file)))
|
||||
o.write('"}\\n"\n')
|
||||
|
||||
for in_file in in_files:
|
||||
o.write('"{\\n"\n')
|
||||
o.write('"#line 1 \\"{}\\"\\n"\n'.format(basename(in_file)))
|
||||
with open(in_file) as i:
|
||||
o.write(escape_perl(i))
|
||||
o.write('"}\\n"\n')
|
73
plugins/perl/meson.build
Normal file
73
plugins/perl/meson.build
Normal file
@ -0,0 +1,73 @@
|
||||
generate_perl_header = find_program('generate_header.py')
|
||||
|
||||
hexchat_perl_module = custom_target('hexchat-perl-header',
|
||||
input: [
|
||||
'lib/HexChat.pm',
|
||||
'lib/Xchat.pm',
|
||||
'lib/HexChat/Embed.pm',
|
||||
'lib/HexChat/List/Network.pm',
|
||||
'lib/HexChat/List/Network/Entry.pm',
|
||||
'lib/HexChat/List/Network/AutoJoin.pm',
|
||||
],
|
||||
output: 'hexchat.pm.h',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
irc_perl_module = custom_target('irc-perl-header',
|
||||
input: 'lib/IRC.pm',
|
||||
output: 'irc.pm.h',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
perl = find_program('perl')
|
||||
|
||||
ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ccopts'])
|
||||
if ret.returncode() != 0
|
||||
error('perl: Failed to get cflags')
|
||||
endif
|
||||
perl_cflags = []
|
||||
foreach flag : ret.stdout().strip().split(' ')
|
||||
if flag.startswith('-I') or flag.startswith('-D')
|
||||
perl_cflags += flag
|
||||
endif
|
||||
endforeach
|
||||
|
||||
ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ldopts'])
|
||||
if ret.returncode() != 0
|
||||
error('perl: Failed to get ldflags')
|
||||
endif
|
||||
perl_ldflags = []
|
||||
foreach flag : ret.stdout().strip().split(' ')
|
||||
if flag.startswith('-L') or flag.startswith('-l')
|
||||
perl_ldflags += flag
|
||||
endif
|
||||
endforeach
|
||||
|
||||
perl_cflags += [
|
||||
# Perl has its own 'config.h' that we must override
|
||||
# TODO: Just rename ours to something more unique.
|
||||
'-include', meson.build_root() + '/config.h'
|
||||
]
|
||||
|
||||
if not cc.links('''
|
||||
#define PERL_NO_INLINE_FUNCTIONS
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
|
||||
int main(void) {
|
||||
PerlInterpreter *my_perl = perl_alloc();
|
||||
return 0;
|
||||
}
|
||||
''', args: perl_cflags + perl_ldflags)
|
||||
error('found perl not suitable for plugin')
|
||||
endif
|
||||
|
||||
shared_module('perl',
|
||||
sources: ['perl.c', hexchat_perl_module, irc_perl_module],
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
c_args: perl_cflags,
|
||||
link_args: perl_ldflags,
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
lib_LTLIBRARIES = python.la
|
||||
python_la_SOURCES = python.c
|
||||
python_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
python_la_LIBADD = $(PYTHON_LIBS) $(GLIB_LIBS)
|
||||
python_la_CPPFLAGS = -I$(top_srcdir)/src/common $(PYTHON_CPPFLAGS)
|
||||
python_la_CFLAGS = $(GLIB_CFLAGS)
|
||||
|
13
plugins/python/meson.build
Normal file
13
plugins/python/meson.build
Normal file
@ -0,0 +1,13 @@
|
||||
python_opt = get_option('with-python')
|
||||
if python_opt.startswith('python3')
|
||||
python_dep = dependency(python_opt, version: '>= 3.3')
|
||||
else
|
||||
python_dep = dependency(python_opt, version: '>= 2.7')
|
||||
endif
|
||||
|
||||
shared_module('python', 'python.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, python_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
@ -69,6 +69,8 @@
|
||||
#include "hexchat-plugin.h"
|
||||
#undef _POSIX_C_SOURCE /* Avoid warnings from /usr/include/features.h */
|
||||
#undef _XOPEN_SOURCE
|
||||
#undef HAVE_MEMRCHR /* Avoid redefinition in Python.h */
|
||||
#undef HAVE_STRINGS_H
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
#include <pythread.h>
|
||||
|
@ -1,17 +0,0 @@
|
||||
libdir = $(hexchatlibdir)
|
||||
|
||||
sources = sysinfo.c format.c shared/df.c
|
||||
|
||||
if PLATFORM_OSX
|
||||
sources += osx/backend.m
|
||||
else
|
||||
sources += unix/backend.c unix/match.c unix/parse.c unix/pci.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = osx unix win32 shared format.h sysinfo.h sysinfo-backend.h
|
||||
|
||||
lib_LTLIBRARIES = sysinfo.la
|
||||
sysinfo_la_SOURCES = $(sources)
|
||||
sysinfo_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
|
||||
sysinfo_la_LIBADD = $(LIBPCI_LIBS) $(GLIB_LIBS)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/common -I$(srcdir)/shared $(LIBPCI_CFLAGS) $(GLIB_CFLAGS)
|
46
plugins/sysinfo/meson.build
Normal file
46
plugins/sysinfo/meson.build
Normal file
@ -0,0 +1,46 @@
|
||||
sysinfo_sources = [
|
||||
'format.c',
|
||||
'sysinfo.c',
|
||||
]
|
||||
|
||||
sysinfo_deps = [
|
||||
libgio_dep,
|
||||
hexchat_plugin_dep
|
||||
]
|
||||
|
||||
sysinfo_includes = []
|
||||
|
||||
system = host_machine.system()
|
||||
if system == 'linux' or system == 'darwin'
|
||||
sysinfo_includes += 'shared'
|
||||
sysinfo_sources += [
|
||||
'shared/df.c'
|
||||
]
|
||||
|
||||
if system == 'linux'
|
||||
sysinfo_deps += dependency('libpci')
|
||||
sysinfo_includes += 'unix'
|
||||
sysinfo_sources += [
|
||||
'unix/backend.c',
|
||||
'unix/match.c',
|
||||
'unix/parse.c',
|
||||
'unix/pci.c',
|
||||
]
|
||||
elif system == 'darwin'
|
||||
add_languages('objc')
|
||||
sysinfo_sources += 'osx/backend.m'
|
||||
endif
|
||||
|
||||
elif system == 'windows'
|
||||
sysinfo_sources += 'win32/backend.c'
|
||||
else
|
||||
error('sysinfo: Unknown system?')
|
||||
endif
|
||||
|
||||
shared_module('sysinfo', sysinfo_sources,
|
||||
dependencies: sysinfo_deps,
|
||||
include_directories: include_directories(sysinfo_includes),
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
8
plugins/upd/meson.build
Normal file
8
plugins/upd/meson.build
Normal file
@ -0,0 +1,8 @@
|
||||
winsparkle_dep = cc.find_library('WinSparkle')
|
||||
|
||||
shared_module('upd', 'upd.c',
|
||||
dependencies: [winsparkle_dep, hexchat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
6
plugins/winamp/meson.build
Normal file
6
plugins/winamp/meson.build
Normal file
@ -0,0 +1,6 @@
|
||||
shared_module('winamp', 'winamp.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
)
|
Reference in New Issue
Block a user