summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-04 23:03:47 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-23 21:47:26 -0400
commit5c23128daba7236a6080383b2a5649033cfef85c (patch)
tree3ca8af1a386cb490d20fc344ddbf3026bada6af9 /src/journal
parent521e7c3aea7cfc478380acb9857beb938855f00f (diff)
meson: build systemd using meson
It's crucial that we can build systemd using VS2010! ... er, wait, no, that's not the official reason. We need to shed old systems by requring python 3! Oh, no, it's something else. Maybe we need to throw out 345 years of knowlege accumulated in autotools? Whatever, this new thing is cool and shiny, let's use it. This is not complete, I'm throwing it out here for your amusement and critique. - rules for sd-boot are missing. Those might be quite complicated. - rules for tests are missing too. Those are probably quite simple and repetitive, but there's lots of them. - it's likely that I didn't get all the conditions right, I only tested "full" compilation where most deps are provided and nothing is disabled. - busname.target and all .busname units are skipped on purpose. Otherwise, installation into $DESTDIR has the same list of files and the autoconf install, except for .la files. It'd be great if people had a careful look at all the library linking options. I added stuff until things compiled, and in the end there's much less linking then in the old system. But it seems that there's still a lot of unnecessary deps. meson has a `shared_module` statement, which sounds like something appropriate for our nss and pam modules. Unfortunately, I couldn't get it to work. For the nss modules, we need an .so version of '2', but `shared_module` disallows the version argument. For the pam module, it also didn't work, I forgot the reason. The handling of .m4 and .in and .m4.in files is rather awkward. It's likely that this could be simplified. If make support is ever dropped, I think it'd make sense to switch to a different templating system so that two different languages and not required, which would make everything simpler yet. v2: - use get_pkgconfig_variable - use sh not bash - use add_project_arguments v3: - drop required:true and fix progs/prog typo v4: - use find_library('bz2') - add TTY_GID definition - define __SANE_USERSPACE_TYPES__ - use join_paths(prefix, ...) is used on all paths to make them all absolute v5: - replace all declare_dependency's with [] - add more conf.get guards around optional components v6: - drop -pipe, -Wall which are the default in meson - use compiler.has_function() and compiler.has_header_symbol instead of the hand-rolled checks. - fix duplication in 'liblibsystemd' library name - use the right .sym file for pam_systemd - rename 'compiler' to 'cc': shorter, and more idiomatic. v7: - use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D - rename prefix to prefixdir, rootprefix to rootprefixdir ("prefix" is too common of a name and too easy to overwrite by mistake) - wrap more stuff with conf.get('ENABLE...') == 1 - use rootprefix=='/' and rootbindir as install_dir, to fix paths under split-usr==true. v8: - use .split() also for src/coredump. Now everything is consistent ;) - add rootlibdir option and use it on the libraries that require it v9: - indentation v10: - fix check for qrencode and libaudit v11: - unify handling of executable paths, provide options for all progs This makes the meson build behave slightly differently than the autoconf-based one, because we always first try to find the executable in the filesystem, and fall back to the default. I think different handling of loadkeys, setfont, and telinit was just a historical accident. In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs. In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin), but in Debian, those directories are not included in the path. C.f. https://github.com/mesonbuild/meson/issues/1576. - call all the options 'xxx-path' for clarity. - sort man/rules/meson.build properly so it's stable
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/audit_type-to-name.awk5
-rw-r--r--src/journal/generate-audit_type-list.sh10
-rw-r--r--src/journal/meson.build104
3 files changed, 119 insertions, 0 deletions
diff --git a/src/journal/audit_type-to-name.awk b/src/journal/audit_type-to-name.awk
new file mode 100644
index 0000000000..38a4b05321
--- /dev/null
+++ b/src/journal/audit_type-to-name.awk
@@ -0,0 +1,5 @@
+BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" }
+{
+ printf " case AUDIT_%s: return \"%s\";\n", $1, $1
+}
+END{ print " default: return NULL;\n\t}\n}\n" }
diff --git a/src/journal/generate-audit_type-list.sh b/src/journal/generate-audit_type-list.sh
new file mode 100644
index 0000000000..a8befbfea2
--- /dev/null
+++ b/src/journal/generate-audit_type-list.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+includes=""
+for i in "$@"; do
+ includes="$includes -include $i"
+done
+cpp -dM $includes - </dev/null | \
+ grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
+ sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
+ sort -k2
diff --git a/src/journal/meson.build b/src/journal/meson.build
new file mode 100644
index 0000000000..b05db85a43
--- /dev/null
+++ b/src/journal/meson.build
@@ -0,0 +1,104 @@
+# -*- mode: meson -*-
+
+libsystemd_journal_internal_sources = files('''
+ audit-type.c
+ audit-type.h
+ catalog.c
+ catalog.h
+ compress.c
+ compress.h
+ journal-def.h
+ journal-file.c
+ journal-file.h
+ journal-send.c
+ journal-vacuum.c
+ journal-vacuum.h
+ journal-verify.c
+ journal-verify.h
+ lookup3.c
+ lookup3.h
+ mmap-cache.c
+ mmap-cache.h
+ sd-journal.c
+'''.split())
+
+############################################################
+
+audit_type_includes = [config_h,
+ missing_h,
+ 'linux/audit.h']
+if conf.get('HAVE_AUDIT', 0) == 1
+ audit_type_includes += 'libaudit.h'
+endif
+
+generate_audit_type_list = find_program('generate-audit_type-list.sh')
+audit_type_list_txt = custom_target(
+ 'audit_type-list.txt',
+ output : 'audit_type-list.txt',
+ command : [generate_audit_type_list] + audit_type_includes,
+ capture : true)
+
+audit_type_to_name = custom_target(
+ 'audit_type-to-name.h',
+ input : ['audit_type-to-name.awk', audit_type_list_txt],
+ output : 'audit_type-to-name.h',
+ command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
+ capture : true)
+
+############################################################
+
+libsystemd_journal_internal = static_library(
+ 'systemd-journal-internal',
+ libsystemd_journal_internal_sources,
+ audit_type_to_name,
+ gcrypt_util_sources,
+ install : false,
+ include_directories : includes,
+ link_with : libbasic,
+ dependencies : [libaudit,
+ ])
+
+libjournal_core_sources = files('''
+ journald-kmsg.c
+ journald-kmsg.h
+ journald-syslog.c
+ journald-syslog.h
+ journald-stream.c
+ journald-stream.h
+ journald-server.c
+ journald-server.h
+ journald-console.c
+ journald-console.h
+ journald-wall.c
+ journald-wall.h
+ journald-native.c
+ journald-native.h
+ journald-audit.c
+ journald-audit.h
+ journald-rate-limit.c
+ journald-rate-limit.h
+ journal-internal.h
+'''.split())
+
+systemd_journald_sources = files('''
+ journald.c
+ journald-server.h
+'''.split())
+
+journald_gperf_c = custom_target(
+ 'journald-gperf.c',
+ input : 'journald-gperf.gperf',
+ output : 'journald-gperf.c',
+ command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+systemd_cat_sources = files('cat.c')
+
+journalctl_sources = files('journalctl.c')
+
+if conf.get('HAVE_QRENCODE', 0) == 1
+ journalctl_sources += files('journal-qrcode.c',
+ 'journal-qrcode.h')
+endif
+
+install_data('journald.conf',
+ install_dir : pkgsysconfdir)