From 5f9f263ae291fbbb9fc86756911e4185aa059964 Mon Sep 17 00:00:00 2001 From: Konrad Dybcio Date: Tue, 9 Apr 2024 01:21:35 +0200 Subject: [PATCH] treewide: meson --- Makefile | 25 ------------------------- meson.build | 32 ++++++++++++++++++++++++++++++++ meson_options.txt | 4 ++++ tqftpserv.service.in | 2 +- 4 files changed, 37 insertions(+), 26 deletions(-) delete mode 100644 Makefile create mode 100644 meson.build create mode 100644 meson_options.txt diff --git a/Makefile b/Makefile deleted file mode 100644 index 3e7760e..0000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -TQFTPSERV := tqftpserv - -CFLAGS += -Wall -g -O2 -LDFLAGS += -lqrtr -prefix ?= /usr/local - -bindir := $(prefix)/bin -servicedir := $(prefix)/lib/systemd/system - -SRCS := tqftpserv.c translate.c - -OBJS := $(SRCS:.c=.o) - -$(TQFTPSERV): $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -tqftpserv.service: tqftpserv.service.in - @sed 's+TQFTPSERV_PATH+$(bindir)+g' $< > $@ - -install: $(TQFTPSERV) tqftpserv.service - @install -D -m 755 $(TQFTPSERV) $(DESTDIR)$(bindir)/$(TQFTPSERV) - @install -D -m 644 tqftpserv.service $(DESTDIR)$(servicedir)/tqftpserv.service - -clean: - rm -f $(TQFTPSERV) $(OBJS) tqftpserv.service diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..f991c48 --- /dev/null +++ b/meson.build @@ -0,0 +1,32 @@ +project('tqftpserv', + 'c', + default_options: [ + 'warning_level=1', + 'buildtype=release', + ]) + +prefix = get_option('prefix') +systemd = dependency('systemd') +systemd_system_unit_dir = get_option('systemd-unit-prefix') +if systemd_system_unit_dir == '' + systemd_system_unit_dir = systemd.get_variable( + pkgconfig : 'systemdsystemunitdir', + pkgconfig_define: ['prefix', prefix]) +endif + +qrtr_dep = dependency('qrtr') + +tqftpserv_srcs = ['translate.c', + 'tqftpserv.c'] +executable('tqftpserv', + tqftpserv_srcs, + dependencies : qrtr_dep, + install : true) + +systemd_unit_conf = configuration_data() +systemd_unit_conf.set('prefix', prefix) +configure_file( + input : 'tqftpserv.service.in', + output : 'tqftpserv.service', + configuration : systemd_unit_conf, + install_dir : systemd_system_unit_dir) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..3835395 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,4 @@ +option('systemd-unit-prefix', + type: 'string', + description: 'Directory for systemd system unit files' +) diff --git a/tqftpserv.service.in b/tqftpserv.service.in index 2cf828c..3333e02 100644 --- a/tqftpserv.service.in +++ b/tqftpserv.service.in @@ -4,7 +4,7 @@ Requires=qrtr-ns.service After=qrtr-ns.service [Service] -ExecStart=TQFTPSERV_PATH/tqftpserv +ExecStart=@prefix@/bin/tqftpserv Restart=always [Install]