mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] systemd-netlogd: add new package
Date: Fri, 5 Mar 2021 11:58:39 +0100	[thread overview]
Message-ID: <20210305105838.GB29021@pengutronix.de> (raw)
In-Reply-To: <20210305095249.31503-1-m.felsch@pengutronix.de>

On Fri, Mar 05, 2021 at 10:52:50AM +0100, Marco Felsch wrote:
> The systemd-netlogd can be used to stream the syslog to a remote device.
> For more information see: https://github.com/systemd/systemd-netlogd.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  .../0001-meson-fix-gettid-detection.patch     | 29 +++++++++
>  ...n-to-disable-the-documentation-build.patch | 38 ++++++++++++
>  .../0003-meson-fix-prefix-usage.patch         | 52 ++++++++++++++++
>  .../systemd-netlogd-2021-02-24-g0b5a39/series |  6 ++
>  rules/systemd-netlogd.in                      | 12 ++++
>  rules/systemd-netlogd.make                    | 60 +++++++++++++++++++
>  6 files changed, 197 insertions(+)
>  create mode 100644 patches/systemd-netlogd-2021-02-24-g0b5a39/0001-meson-fix-gettid-detection.patch
>  create mode 100644 patches/systemd-netlogd-2021-02-24-g0b5a39/0002-meson-add-option-to-disable-the-documentation-build.patch
>  create mode 100644 patches/systemd-netlogd-2021-02-24-g0b5a39/0003-meson-fix-prefix-usage.patch
>  create mode 100644 patches/systemd-netlogd-2021-02-24-g0b5a39/series
>  create mode 100644 rules/systemd-netlogd.in
>  create mode 100644 rules/systemd-netlogd.make
> 
> diff --git a/patches/systemd-netlogd-2021-02-24-g0b5a39/0001-meson-fix-gettid-detection.patch b/patches/systemd-netlogd-2021-02-24-g0b5a39/0001-meson-fix-gettid-detection.patch
> new file mode 100644
> index 000000000..81828176a
> --- /dev/null
> +++ b/patches/systemd-netlogd-2021-02-24-g0b5a39/0001-meson-fix-gettid-detection.patch
> @@ -0,0 +1,29 @@
> +From: Marco Felsch <m.felsch@pengutronix.de>
> +Date: Thu, 25 Feb 2021 09:12:15 +0100
> +Subject: [PATCH] meson: fix gettid detection
> +
> +The gettid() call is a linux specific syscall so we need to define it
> +as _GNU_SOURCE else the test will fail which causes the later compile
> +stage to fail. Since for the sources we define _GNU_SOURCE and gettid()
> +is found but the code assumes that we don't have gettid() support
> +(HAVE_GETTID is not defined) and redefines the function.
> +
> +Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> +---
> + meson.build | 3 ++-
> + 1 file changed, 2 insertions(+), 1 deletion(-)
> +
> +diff --git a/meson.build b/meson.build
> +index d07987f061fb..707322bcc95d 100644
> +--- a/meson.build
> ++++ b/meson.build
> +@@ -84,7 +84,8 @@ conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
> + conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
> + 
> + foreach ident : [
> +-        ['gettid',            '''#include <sys/types.h>
> ++        ['gettid',            '''#define _GNU_SOURCE
> ++                                 #include <sys/types.h>
> +                                  #include <unistd.h>'''],
> + ]
> +         have = cc.has_function(ident[0], prefix : ident[1])
> diff --git a/patches/systemd-netlogd-2021-02-24-g0b5a39/0002-meson-add-option-to-disable-the-documentation-build.patch b/patches/systemd-netlogd-2021-02-24-g0b5a39/0002-meson-add-option-to-disable-the-documentation-build.patch
> new file mode 100644
> index 000000000..3dfd33ba6
> --- /dev/null
> +++ b/patches/systemd-netlogd-2021-02-24-g0b5a39/0002-meson-add-option-to-disable-the-documentation-build.patch
> @@ -0,0 +1,38 @@
> +From: Marco Felsch <m.felsch@pengutronix.de>
> +Date: Thu, 25 Feb 2021 09:20:03 +0100
> +Subject: [PATCH] meson: add option to disable the documentation build
> +
> +On embedded devices docs are most the time not deployed. So the doc
> +build only adds more build dependencies. Make the doc optional so the
> +user can skip it.
> +
> +Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> +---
> + meson.build       | 5 ++++-
> + meson_options.txt | 1 +
> + 2 files changed, 5 insertions(+), 1 deletion(-)
> + create mode 100644 meson_options.txt
> +
> +diff --git a/meson.build b/meson.build
> +index 707322bcc95d..38dc7fdb2d7f 100644
> +--- a/meson.build
> ++++ b/meson.build
> +@@ -138,7 +138,10 @@ includes = include_directories('src/share',
> +                                'src/netlog')
> + 
> + subdir('units')
> +-subdir('doc')
> ++
> ++if get_option('doc').enabled()
> ++        subdir('doc')
> ++endif
> + 
> + ############################################################
> + 
> +diff --git a/meson_options.txt b/meson_options.txt
> +new file mode 100644
> +index 000000000000..91489ab27970
> +--- /dev/null
> ++++ b/meson_options.txt
> +@@ -0,0 +1 @@
> ++option('doc', type : 'feature', value : 'enabled')
> diff --git a/patches/systemd-netlogd-2021-02-24-g0b5a39/0003-meson-fix-prefix-usage.patch b/patches/systemd-netlogd-2021-02-24-g0b5a39/0003-meson-fix-prefix-usage.patch
> new file mode 100644
> index 000000000..1d87b16f8
> --- /dev/null
> +++ b/patches/systemd-netlogd-2021-02-24-g0b5a39/0003-meson-fix-prefix-usage.patch
> @@ -0,0 +1,52 @@
> +From: Marco Felsch <m.felsch@pengutronix.de>
> +Date: Thu, 25 Feb 2021 10:03:04 +0100
> +Subject: [PATCH] meson: fix prefix usage
> +
> +The GNU standard directory variables [1] defines prefix as /usr/local.
> +Here prefix is a bit misused to build the systemd service path. Fix this
> +by defining the correct prefix and introducing a systemdservicepath
> +option which can be overriden by the application. By default we are
> +installing the service now into: /usr/local/lib/systemd/system which is
> +okay according systemd.unit(5). Now if the user space uses usrmerge we
> +can specify the /usr prefix and everything should endup in the correct
> +directories.
> +
> +[1] https://www.gnu.org/software/automake/manual/html_node/Standard-Directory-Variables.html
> +
> +Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> +---
> + meson.build       | 2 +-
> + meson_options.txt | 1 +
> + units/meson.build | 2 +-
> + 3 files changed, 3 insertions(+), 2 deletions(-)
> +
> +diff --git a/meson.build b/meson.build
> +index 38dc7fdb2d7f..3e0da8162914 100644
> +--- a/meson.build
> ++++ b/meson.build
> +@@ -3,7 +3,7 @@ project('systemd-netlogd', 'c',
> +         license : 'LGPLv2+',
> +         default_options: [
> +                 'c_std=gnu99',
> +-                'prefix=/lib/systemd/',
> ++                'prefix=/usr/local',
> +                 'sysconfdir=/etc/systemd',
> +                 'localstatedir=/var',
> +         ],
> +diff --git a/meson_options.txt b/meson_options.txt
> +index 91489ab27970..f5467c000185 100644
> +--- a/meson_options.txt
> ++++ b/meson_options.txt
> +@@ -1 +1,2 @@
> + option('doc', type : 'feature', value : 'enabled')
> ++option('systemdsystemunitdir', type: 'string', value: '/lib/systemd/system', description: 'Directory for systemd service files')
> +diff --git a/units/meson.build b/units/meson.build
> +index bfc107e31a08..509ff992a493 100644
> +--- a/units/meson.build
> ++++ b/units/meson.build
> +@@ -3,4 +3,4 @@ systemd_netlogd_conf = configure_file(
> +                        output : 'systemd-netlogd.service',
> +                        configuration : substs)
> +                        install_data(systemd_netlogd_conf,
> +-                       install_dir : get_option('prefix') / 'system')
> ++                       install_dir : get_option('prefix') + get_option('systemdsystemunitdir'))

This looks wrong. In general, if packages hava a systemdsystemunitdir
option, then it specifies the full absolute path.

And if you need systemd as a built-time dependency, then the default should
be to query the pkg-config file.

Michael

> diff --git a/patches/systemd-netlogd-2021-02-24-g0b5a39/series b/patches/systemd-netlogd-2021-02-24-g0b5a39/series
> new file mode 100644
> index 000000000..1021a6c6f
> --- /dev/null
> +++ b/patches/systemd-netlogd-2021-02-24-g0b5a39/series
> @@ -0,0 +1,6 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-meson-fix-gettid-detection.patch
> +0002-meson-add-option-to-disable-the-documentation-build.patch
> +0003-meson-fix-prefix-usage.patch
> +# 734536a53287fe0018e74b011c8db131  - git-ptx-patches magic
> diff --git a/rules/systemd-netlogd.in b/rules/systemd-netlogd.in
> new file mode 100644
> index 000000000..fab119a0a
> --- /dev/null
> +++ b/rules/systemd-netlogd.in
> @@ -0,0 +1,12 @@
> +## SECTION=shell_and_console
> +
> +config SYSTEMD_NETLOGD
> +	tristate
> +	select SYSTEMD
> +	select HOST_MESON
> +	prompt "systemd-netlogd"
> +	help
> +	  Forwards messages from the journal to other hosts over the network using
> +	  the Syslog Protocol (RFC 5424).
> +
> +	  For more information check: https://github.com/systemd/systemd-netlogd.
> diff --git a/rules/systemd-netlogd.make b/rules/systemd-netlogd.make
> new file mode 100644
> index 000000000..f55020654
> --- /dev/null
> +++ b/rules/systemd-netlogd.make
> @@ -0,0 +1,60 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Marco Felsch <m.felsch@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_SYSTEMD_NETLOGD) += systemd-netlogd
> +
> +#
> +# Paths and names
> +#
> +SYSTEMD_NETLOGD_VERSION		:= 2021-02-24-g0b5a39
> +SYSTEMD_NETLOGD			:= systemd-netlogd-$(SYSTEMD_NETLOGD_VERSION)
> +SYSTEMD_NETLOGD_MD5		:= 0ed8be59b7a4e2a12de0b9266e0709ce
> +SYSTEMD_NETLOGD_SUFFIX		:= tar.gz
> +SYSTEMD_NETLOGD_URL		:= \
> +	https://github.com/systemd/systemd-netlogd/archive/$(SYSTEMD_NETLOGD_VERSION).$(SYSTEMD_NETLOGD_SUFFIX)
> +SYSTEMD_NETLOGD_SOURCE		:= $(SRCDIR)/$(SYSTEMD_NETLOGD).$(SYSTEMD_NETLOGD_SUFFIX)
> +SYSTEMD_NETLOGD_DIR		:= $(BUILDDIR)/$(SYSTEMD_NETLOGD)
> +SYSTEMD_NETLOGD_LICENSE		:= GPL-2.0-only AND LGPL-2.1-only
> +SYSTEMD_NETLOGD_LICENSE_FILES	:= \
> +	file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
> +	file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +SYSTEMD_NETLOGD_CONF_TOOL	:= meson
> +SYSTEMD_NETLOGD_CONF_OPT	:= \
> +	$(CROSS_MESON_USR)	\
> +	-Ddoc=disabled
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/systemd-netlogd.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, systemd-netlogd)
> +	@$(call install_fixup, systemd-netlogd, PRIORITY, optional)
> +	@$(call install_fixup, systemd-netlogd, SECTION, base)
> +	@$(call install_fixup, systemd-netlogd, AUTHOR, "Marco Felsch <m.felsch@pengutronix.de>")
> +	@$(call install_fixup, systemd-netlogd, DESCRIPTION, "systemd-netlogd")
> +
> +	@$(call install_alternative, systemd-netlogd, 0, 0, 0644, \
> +		/usr/lib/systemd/system/systemd-netlogd.service)
> +	@$(call install_link, systemd-netlogd, ../systemd-netlogd.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/systemd-netlogd.service)
> +	@$(call install_alternative, systemd-netlogd, 0, 0, 0644, /etc/systemd/systemd-netlogd.conf)
> +	@$(call install_alternative, systemd-netlogd, 0, 0, 0755, /lib/systemd/systemd-netlogd)
> +
> +	@$(call install_finish, systemd-netlogd)
> +
> +	@$(call touch)
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

      reply	other threads:[~2021-03-05 10:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  9:52 Marco Felsch
2021-03-05 10:58 ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305105838.GB29021@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox