123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- Subject: Move build system to meson
- Origin: v7-2-gfed9020 <https://github.com/latchset/tang/commit/v7-2-gfed9020>
- Upstream-Author: Sergio Correia <scorreia@redhat.com>
- Date: Thu Dec 19 14:04:06 2019 -0300
- Also install asciidoc package in CI, so that it will build the
- man pages as well.
- --
- Some extra adjustment needed for pre-usrmerge.
- @@ -1,60 +0,0 @@
- -DISTCHECK_CONFIGURE_FLAGS = --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
- -BUILT_SOURCES=
- -CLEANFILES=
- -man1_MANS=
- -man8_MANS=
- -
- -AM_CFLAGS = @TANG_CFLAGS@ @jose_CFLAGS@
- -LDADD = @jose_LIBS@ @http_parser_LIBS@
- -
- -cachedir = $(localstatedir)/cache/$(PACKAGE_NAME)
- -jwkdir = $(localstatedir)/db/$(PACKAGE_NAME)
- -
- -nodist_systemdsystemunit_DATA = \
- - units/tangd@.service \
- - units/tangd.socket \
- - units/tangd-update.path \
- - units/tangd-update.service \
- - units/tangd-keygen.service
- -
- -dist_libexec_SCRIPTS = src/tangd-update src/tangd-keygen
- -dist_bin_SCRIPTS = src/tang-show-keys
- -libexec_PROGRAMS = src/tangd
- -
- -man_ADOC_FILES= \
- - doc/tang-show-keys.1.adoc \
- - doc/tang.8.adoc
- -
- -if HAVE_A2X
- -man_ROFF_FILES = $(man_ADOC_FILES:.adoc=.roff)
- -BUILT_SOURCES += $(man_ROFF_FILES)
- -CLEANFILES += $(man_ROFF_FILES) $(man_ROFF_FILES:.roff=)
- -
- -$(top_builddir)/%.roff: %.adoc
- - $(MKDIR_P) $$(dirname $@)
- - $(A2X) -f manpage $^ -D $(top_builddir)/$$(dirname $@)
- - $(INSTALL) -m 644 $(top_builddir)/$(@:.roff=) $(top_builddir)/$@
- -
- -man1_MANS += doc/tang-show-keys.1
- -man8_MANS += doc/tang.8
- -endif
- -
- -src_tangd_SOURCES = src/http.c src/http.h src/tangd.c
- -
- -%: %.in
- - $(AM_V_GEN)mkdir -p "`dirname "$@"`"
- - $(AM_V_GEN)$(SED) \
- - -e 's,@libexecdir\@,$(libexecdir),g' \
- - -e 's,@jwkdir\@,$(jwkdir),g' \
- - -e 's,@cachedir\@,$(cachedir),g' \
- - $(srcdir)/$@.in > $@
- -
- -AM_TESTS_ENVIRONMENT = SD_ACTIVATE="@SD_ACTIVATE@" PATH=$(srcdir)/src:$(builddir)/src:$(PATH)
- -TESTS = tests/adv tests/rec
- -
- -CLEANFILES += $(nodist_systemdsystemunit_DATA)
- -EXTRA_DIST = \
- - $(foreach unit,$(nodist_systemdsystemunit_DATA),$(unit).in) \
- - COPYING \
- - $(TESTS) \
- - $(man_ADOC_FILES)
- @@ -1,87 +0,0 @@
- -AC_PREREQ(2.59)
- -AC_INIT(tang, 7)
- -AC_CANONICAL_SYSTEM
- -AC_PROG_CC_C99
- -AC_PROG_SED
- -
- -AM_INIT_AUTOMAKE([subdir-objects foreign no-dist-gzip dist-bzip2 parallel-tests])
- -AM_SILENT_RULES([yes])
- -AM_PROG_CC_C_O
- -
- -PKG_PROG_PKG_CONFIG([0.25])
- -
- -AC_CHECK_LIB([dl], [dlopen], [AC_SUBST([dl_LIBS], [-ldl])],
- - [AC_CHECK_LIB([dl], [dlopen], [AC_SUBST([dl_LIBS], [-ldl])],
- - [AC_MSG_ERROR([unable to find dlopen])])])
- -
- -AC_CHECK_HEADER([http_parser.h], [],
- - [AC_MSG_ERROR([http-parser required!])], [
- -#include <http_parser.h>
- -#ifndef HTTP_STATUS_MAP
- -#error HTTP_STATUS_MAP not defined!
- -#endif
- -])
- -
- -AC_CHECK_LIB([http_parser], [http_parser_execute],
- - [AC_SUBST(http_parser_LIBS, [-lhttp_parser])],
- - [AC_MSG_ERROR([http-parser required!])])
- -
- -PKG_CHECK_MODULES([jose], [jose >= 8])
- -PKG_CHECK_MODULES([systemd], [systemd])
- -
- -AC_ARG_WITH([systemdsystemunitdir],
- - [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
- - [],
- - [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
- -
- -AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
- -
- -for ac_prog in systemd-socket-activate systemd-activate; do
- - AC_CHECK_PROG([SD_ACTIVATE], [$ac_prog], [$as_dir/$ac_prog], [],
- - [$PATH$PATH_SEPARATOR$($PKG_CONFIG --variable=systemdutildir systemd)])
- - test -n "$SD_ACTIVATE" && break
- -done
- -
- -test -n "$SD_ACTIVATE" || AC_MSG_ERROR([systemd-socket-activate required!])
- -
- -AC_MSG_CHECKING([systemd-socket-activate inetd flag])
- -if $SD_ACTIVATE --help | grep -q inetd; then
- - SD_ACTIVATE="$SD_ACTIVATE --inetd"
- - AC_MSG_RESULT([--inetd])
- -else
- - AC_MSG_RESULT([(default)])
- -fi
- -
- -AC_SUBST(SD_ACTIVATE)
- -
- -TANG_CFLAGS="\
- --Wall \
- --Wextra \
- --Werror \
- --Wstrict-aliasing \
- --Wchar-subscripts \
- --Wformat-security \
- --Wmissing-declarations \
- --Wmissing-prototypes \
- --Wnested-externs \
- --Wpointer-arith \
- --Wshadow \
- --Wsign-compare \
- --Wstrict-prototypes \
- --Wtype-limits \
- --Wunused-function \
- --Wno-missing-field-initializers \
- --Wno-unused-parameter \
- -"
- -AC_SUBST([TANG_CFLAGS])
- -
- -AC_CHECK_PROGS(A2X, [a2x])
- -
- -if test "x$A2X" = "x"; then
- - AC_MSG_WARN([asciidoc / a2x not found -- man pages will not be generated and installed])
- -fi
- -
- -AM_CONDITIONAL(HAVE_A2X, [test -n "$A2X"])
- -
- -AC_CONFIG_FILES([Makefile])
- -AC_OUTPUT
- @@ -0,0 +1,4 @@
- +mans += join_paths(meson.current_source_dir(), 'tang-show-keys.1')
- +mans += join_paths(meson.current_source_dir(), 'tang.8')
- +
- +# vim:set ts=2 sw=2 et:
- @@ -0,0 +1,85 @@
- +project('tang', 'c',
- + version: '7',
- + license: 'GPL3+',
- + default_options: [
- + 'c_std=c99',
- + 'prefix=/usr',
- + 'sysconfdir=/etc',
- + 'localstatedir=/var',
- + 'warning_level=3',
- + 'werror=true'
- + ]
- +)
- +
- +libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
- +sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
- +bindir = join_paths(get_option('prefix'), get_option('bindir'))
- +systemunitdir = join_paths(get_option('prefix'), '../lib/systemd/system')
- +licensedir = join_paths(get_option('prefix'), 'share', 'licenses', meson.project_name())
- +cachedir = join_paths(get_option('localstatedir'), 'cache', meson.project_name())
- +jwkdir = join_paths(get_option('localstatedir'), 'db', meson.project_name())
- +
- +data = configuration_data()
- +data.set('libexecdir', libexecdir)
- +data.set('sysconfdir', sysconfdir)
- +data.set('systemunitdir', systemunitdir)
- +data.set('cachedir', cachedir)
- +data.set('jwkdir', jwkdir)
- +
- +add_project_arguments(
- + '-D_POSIX_C_SOURCE=200809L',
- + '-Wstrict-aliasing',
- + '-Wchar-subscripts',
- + '-Wformat-security',
- + '-Wmissing-declarations',
- + '-Wmissing-prototypes',
- + '-Wnested-externs',
- + '-Wpointer-arith',
- + '-Wshadow',
- + '-Wsign-compare',
- + '-Wstrict-prototypes',
- + '-Wtype-limits',
- + '-Wunused-function',
- + '-Wno-missing-field-initializers',
- + '-Wno-unused-parameter',
- + '-Wno-pedantic',
- + language: 'c'
- +)
- +
- +jose = dependency('jose', version: '>=8')
- +a2x = find_program('a2x', required: false)
- +compiler = meson.get_compiler('c')
- +if not compiler.has_header('http_parser.h')
- + error('http-parser devel files not found.')
- +endif
- +http_parser = compiler.find_library('http_parser')
- +
- +licenses = ['COPYING']
- +libexecbins = []
- +bins = []
- +mans = []
- +units = []
- +
- +subdir('doc')
- +subdir('src')
- +subdir('units')
- +subdir('tests')
- +
- +install_data(libexecbins, install_dir: libexecdir)
- +install_data(bins, install_dir: bindir)
- +install_data(units, install_dir: systemunitdir)
- +install_data(licenses, install_dir: licensedir)
- +
- +if a2x.found()
- + foreach m : mans
- + custom_target(m.split('/')[-1], input: m + '.adoc', output: m.split('/')[-1],
- + command: [a2x, '-f', 'manpage', '-D', meson.current_build_dir(), '@INPUT@'],
- + install_dir: join_paths(get_option('mandir'), 'man' + m.split('.')[-1]),
- + install: true
- + )
- + endforeach
- +else
- + warning('Will not build man pages due to missing a2x (asciidoc) dependency!')
- +endif
- +
- +# vim:set ts=2 sw=2 et:
- @@ -0,0 +1,14 @@
- +tangd = executable('tangd',
- + 'http.h',
- + 'http.c',
- + 'tangd.c',
- + dependencies: [jose, http_parser],
- + install: true,
- + install_dir: libexecdir
- +)
- +
- +bins += join_paths(meson.current_source_dir(), 'tang-show-keys')
- +libexecbins += join_paths(meson.current_source_dir(), 'tangd-keygen')
- +libexecbins += join_paths(meson.current_source_dir(), 'tangd-update')
- +
- +# vim:set ts=2 sw=2 et:
- @@ -0,0 +1,22 @@
- +sd_activate = find_program(
- + 'systemd-socket-activate',
- + 'systemd-activate',
- + required: false
- +)
- +
- +if sd_activate.found()
- + env = environment()
- + env.prepend('PATH',
- + join_paths(meson.source_root(), 'src'),
- + join_paths(meson.build_root(), 'src'),
- + separator: ':'
- + )
- + env.set('SD_ACTIVATE', sd_activate.path() + ' --inetd')
- +
- + test('adv', find_program('adv'), env: env)
- + test('rec', find_program('rec'), env: env)
- +else
- + warning('Will not run the tests due to missing dependencies!')
- +endif
- +
- +# vim:set ts=2 sw=2 et:
- @@ -0,0 +1,31 @@
- +tangd_keygen_service = configure_file(
- + input: 'tangd-keygen.service.in',
- + output: 'tangd-keygen.service',
- + configuration: data
- +)
- +
- +tangd_service = configure_file(
- + input: 'tangd@.service.in',
- + output: 'tangd@.service',
- + configuration: data
- +)
- +
- +tangd_update_path = configure_file(
- + input: 'tangd-update.path.in',
- + output: 'tangd-update.path',
- + configuration: data
- +)
- +
- +tangd_update_service = configure_file(
- + input: 'tangd-update.service.in',
- + output: 'tangd-update.service',
- + configuration: data
- +)
- +
- +units += join_paths(meson.current_source_dir(), 'tangd.socket')
- +units += tangd_keygen_service
- +units += tangd_service
- +units += tangd_update_path
- +units += tangd_update_service
- +
- +# vim:set ts=2 sw=2 et:
- @@ -0,0 +1,14 @@
- +[Unit]
- +Description=Tang Server socket
- +Requires=tangd-keygen.service
- +Requires=tangd-update.service
- +Requires=tangd-update.path
- +After=tangd-keygen.service
- +After=tangd-update.service
- +
- +[Socket]
- +ListenStream=80
- +Accept=true
- +
- +[Install]
- +WantedBy=multi-user.target
- @@ -1,14 +0,0 @@
- -[Unit]
- -Description=Tang Server socket
- -Requires=tangd-keygen.service
- -Requires=tangd-update.service
- -Requires=tangd-update.path
- -After=tangd-keygen.service
- -After=tangd-update.service
- -
- -[Socket]
- -ListenStream=80
- -Accept=true
- -
- -[Install]
- -WantedBy=multi-user.target
|