From: Roland Hieber <rhi@pengutronix.de>
To: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [ptxdist-commit] 19/22: templates: add src-meson-prog template
Date: Wed, 5 Jun 2019 21:21:58 +0200 [thread overview]
Message-ID: <20190605192158.pnkkr5wlzrzyftku@pengutronix.de> (raw)
In-Reply-To: <E1hYZrE-0001Lp-TA@git.sokrates.pengutronix.de>
On Wed, Jun 05, 2019 at 07:38:10PM +0200, Michael Olbrich via Gitolite wrote:
> This is an automated email from the git hooks/post-receive script.
>
> pengutronix.michael.olbrich pushed a commit to branch master
> in repository ptxdist.
>
> commit 91749a01cd22dc2a7d72e841568a2dddb16200f7
> Author: Ulrich Ölmann <u.oelmann@pengutronix.de>
> AuthorDate: Wed Jun 5 01:16:54 2019 +0200
>
> templates: add src-meson-prog template
>
> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> doc/dev_manual.rst | 36 +++++++++---
> rules/templates/src-meson-prog/@name@.c | 12 ++++
> rules/templates/src-meson-prog/COPYING | 12 ++++
> rules/templates/src-meson-prog/config.h.in | 1 +
> rules/templates/src-meson-prog/meson.build | 13 +++++
> rules/templates/src-meson-prog/wizard.sh | 17 ++++++
> rules/templates/template-src-meson-prog-in | 8 +++
> rules/templates/template-src-meson-prog-make | 83 ++++++++++++++++++++++++++++
> scripts/lib/ptxd_lib_template.sh | 7 +++
> 9 files changed, 182 insertions(+), 7 deletions(-)
>
> diff --git a/doc/dev_manual.rst b/doc/dev_manual.rst
> index e17aa9b1bb58..dfadcb241891 100644
> --- a/doc/dev_manual.rst
> +++ b/doc/dev_manual.rst
> @@ -206,6 +206,14 @@ handle:
> and their settings. Creating such a package will also create a simple
> template project to be used as a starting point for development.
>
> +- **src-meson-prog**: This kind of package is built for the target.
> + It’s intended for developments based on the *meson* buildsystem.
> + Various projects are using *meson* today and can be built
> + with this package type. PTXdist will prepare it to compile sources in
> + accordance to the target libraries and their settings. Creating such
> + a package will also create a simple template project to be used as a
> + starting point for development.
> +
> - **font**: This package is a helper to add X font files to the root
> filesystem. This package does not create an additional IPKG, instead
> it adds the font to the existing font IPKG. This includes the
> @@ -1156,12 +1164,12 @@ So, in the rule file only the two variables ``FOO_MAKE_ENV`` and
> package’s buildsystem. If the package cannot be built in parallel, we
> can also add the ``FOO_MAKE_PAR := NO``. ``YES`` is the default.
>
> -Managing CMake / QMake Packages
> -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +Managing CMake/QMake/Meson Packages
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> -Building packages that use ``cmake`` or ``qmake`` is much like building
> -packages with an autotools based buildsystem. We need to specify the
> -configuration tool:
> +Building packages that use ``cmake``, ``qmake`` or ``meson`` is much like
> +building packages with an autotools based buildsystem. We need to specify
> +the configuration tool:
>
> .. code-block:: make
>
> @@ -1173,6 +1181,12 @@ or
>
> FOO_CONF_TOOL := qmake
>
> +or respectively
> +
> +.. code-block:: make
> +
> + FOO_CONF_TOOL := meson
> +
> And provide the correct configuration options. The syntax is different so
> PTXdist provides additional macros to simplify configurable features.
> For ``cmake`` the configuration options typically look like this:
> @@ -1192,8 +1206,16 @@ For ``qmake`` the configuration options typically look like this:
> $(CROSS_QMAKE_OPT) \
> PREFIX=/usr
>
> -Please note that currently only host and target ``cmake`` packages and only
> -target ``qmake`` packages are supported.
> +And for ``meson`` the configuration options typically look like this:
> +
> +.. code-block:: make
> +
> + FOO_CONF_OPT := \
> + $(CROSS_MESON_USR) \
> + -Dbar=$(call ptx/truefalse,PTXCONF_FOO_BAR)
> +
> +Please note that currently only host and target ``cmake``\/``meson`` packages
> +and only target ``qmake`` packages are supported.
>
> Managing Python Packages
> ^^^^^^^^^^^^^^^^^^^^^^^^
> diff --git a/rules/templates/src-meson-prog/@name@.c b/rules/templates/src-meson-prog/@name@.c
> new file mode 100644
> index 000000000000..061debf310bc
> --- /dev/null
> +++ b/rules/templates/src-meson-prog/@name@.c
> @@ -0,0 +1,12 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +#include "config.h"
> +
> +int main(int argc, char *argv[])
> +{
> + printf("Hello World, I'm @name@!\n");
> + printf("My license is " LICENSE_STR ".\n");
> +
> + exit(EXIT_SUCCESS);
> +}
> diff --git a/rules/templates/src-meson-prog/COPYING b/rules/templates/src-meson-prog/COPYING
> new file mode 100644
> index 000000000000..1844a019b31f
> --- /dev/null
> +++ b/rules/templates/src-meson-prog/COPYING
> @@ -0,0 +1,12 @@
> +Copyright (C) 2006 by Rob Landley <rob@landley.net>
That Rob Landley is surely a very productive person, according to all
the copyright lines he gets :) Maybe use "@YEAR@ by @AUTHOR@" here too?
- Roland
> +
> +Permission to use, copy, modify, and/or distribute this software for any purpose
> +with or without fee is hereby granted.
> +
> +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
> +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
> +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
> +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
> +THIS SOFTWARE.
> diff --git a/rules/templates/src-meson-prog/config.h.in b/rules/templates/src-meson-prog/config.h.in
> new file mode 100644
> index 000000000000..b0ee7ec65121
> --- /dev/null
> +++ b/rules/templates/src-meson-prog/config.h.in
> @@ -0,0 +1 @@
> +#define LICENSE_STR "@license@"
> diff --git a/rules/templates/src-meson-prog/meson.build b/rules/templates/src-meson-prog/meson.build
> new file mode 100644
> index 000000000000..946e1850cfd5
> --- /dev/null
> +++ b/rules/templates/src-meson-prog/meson.build
> @@ -0,0 +1,13 @@
> +project('@name@', 'c',
> + license : '0BSD',
> + default_options : ['warning_level=3'])
> +
> +conf_data = configuration_data()
> +conf_data.set('license', meson.project_license()[0])
> +configure_file(input : 'config.h.in',
> + output : 'config.h',
> + configuration : conf_data)
> +
> +executable('@name@',
> + '@name@.c',
> + install : true)
> diff --git a/rules/templates/src-meson-prog/wizard.sh b/rules/templates/src-meson-prog/wizard.sh
> new file mode 100644
> index 000000000000..305530b654d4
> --- /dev/null
> +++ b/rules/templates/src-meson-prog/wizard.sh
> @@ -0,0 +1,17 @@
> +#!/bin/bash
> +
> +NAME="${1}"
> +if [ -z "$NAME" ]; then
> + echo -n "project name: "
> + read NAME
> +fi
> +
> +mv "@name@.c" "${NAME}.c"
> +
> +for i in \
> + meson.build \
> + ${NAME}.c \
> +; do
> + sed -i -e "s/\@name\@/${NAME}/g" $i
> +done
> +
> diff --git a/rules/templates/template-src-meson-prog-in b/rules/templates/template-src-meson-prog-in
> new file mode 100644
> index 000000000000..34dc24f9fc56
> --- /dev/null
> +++ b/rules/templates/template-src-meson-prog-in
> @@ -0,0 +1,8 @@
> +## SECTION=@section@
> +
> +config @PACKAGE@
> + bool
> + prompt "@package@"
> + select HOST_MESON
> + help
> + FIXME
> diff --git a/rules/templates/template-src-meson-prog-make b/rules/templates/template-src-meson-prog-make
> new file mode 100644
> index 000000000000..394fb2516e6f
> --- /dev/null
> +++ b/rules/templates/template-src-meson-prog-make
> @@ -0,0 +1,83 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) @YEAR@ by @AUTHOR@
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_@PACKAGE@) += @package@
> +
> +#
> +# Paths and names
> +#
> +@PACKAGE@_VERSION := @VERSION@
> +@PACKAGE@ := @package@-$(@PACKAGE@_VERSION)
> +@PACKAGE@_URL := file://local_src/@package@
> +@PACKAGE@_DIR := $(BUILDDIR)/$(@PACKAGE@)
> +@PACKAGE@_LICENSE := 0BSD
> +@PACKAGE@_LICENSE_FILES := file://COPYING;md5=240269ccb62c2c66a81d8fdd094dd69f
> +
> +# ----------------------------------------------------------------------------
> +# Get
> +# ----------------------------------------------------------------------------
> +
> +#$(@PACKAGE@_SOURCE):
> +# @$(call targetinfo)
> +# @$(call get, @PACKAGE@)
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +#@PACKAGE@_CONF_ENV := $(CROSS_ENV)
> +
> +#
> +# meson
> +#
> +@PACKAGE@_CONF_TOOL := meson
> +#@PACKAGE@_CONF_OPT := $(CROSS_MESON_USR)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/@package@.targetinstall:
> + @$(call targetinfo)
> +
> + @$(call install_init, @package@)
> + @$(call install_fixup, @package@, PRIORITY, optional)
> + @$(call install_fixup, @package@, SECTION, base)
> + @$(call install_fixup, @package@, AUTHOR, "@AUTHOR@")
> + @$(call install_fixup, @package@, DESCRIPTION, missing)
> +
> +# #
> +# # example code:; copy all binaries
> +# #
> +
> + @for i in $(shell cd $(@PACKAGE@_PKGDIR) && find bin sbin usr/bin usr/sbin -type f); do \
> + $(call install_copy, @package@, 0, 0, 0755, -, /$$i); \
> + done
> +
> +# #
> +# # FIXME: add all necessary things here
> +# #
> +
> + @$(call install_finish, @package@)
> +
> + @$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Clean
> +# ----------------------------------------------------------------------------
> +
> +#$(STATEDIR)/@package@.clean:
> +# @$(call targetinfo)
> +# @$(call clean_pkg, @PACKAGE@)
> +
> +# vim: syntax=make
> diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
> index fe18aa6d5577..8ac3312dc775 100644
> --- a/scripts/lib/ptxd_lib_template.sh
> +++ b/scripts/lib/ptxd_lib_template.sh
> @@ -334,6 +334,13 @@ export -f ptxd_template_new_src_qmake_prog
> ptxd_template_help_list[${#ptxd_template_help_list[@]}]="src-qmake-prog"
> ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create qmake binary"
>
> +ptxd_template_new_src_meson_prog() {
> + ptxd_template_src_base
> +}
> +export -f ptxd_template_new_src_meson_prog
> +ptxd_template_help_list[${#ptxd_template_help_list[@]}]="src-meson-prog"
> +ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create meson binary"
> +
> ptxd_template_new_src_linux_driver() {
> ptxd_template_src_base
> }
>
> --
> To stop receiving notification emails like this one, please contact
> the administrator of this repository.
>
> _______________________________________________
> ptxdist-commit mailing list
> ptxdist-commit@pengutronix.de
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
parent reply other threads:[~2019-06-05 19:21 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <E1hYZrE-0001Lp-TA@git.sokrates.pengutronix.de>]
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=20190605192158.pnkkr5wlzrzyftku@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=ptxdist@pengutronix.de \
--cc=u.oelmann@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