diff options
-rw-r--r-- | doc/dev_manual.rst | 36 | ||||
-rw-r--r-- | rules/templates/src-meson-prog/@name@.c | 12 | ||||
-rw-r--r-- | rules/templates/src-meson-prog/COPYING | 12 | ||||
-rw-r--r-- | rules/templates/src-meson-prog/config.h.in | 1 | ||||
-rw-r--r-- | rules/templates/src-meson-prog/meson.build | 13 | ||||
-rw-r--r-- | rules/templates/src-meson-prog/wizard.sh | 17 | ||||
-rw-r--r-- | rules/templates/template-src-meson-prog-in | 8 | ||||
-rw-r--r-- | rules/templates/template-src-meson-prog-make | 83 | ||||
-rw-r--r-- | 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 e17aa9b1b..dfadcb241 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 000000000..061debf31 --- /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 000000000..1844a019b --- /dev/null +++ b/rules/templates/src-meson-prog/COPYING @@ -0,0 +1,12 @@ +Copyright (C) 2006 by Rob Landley <rob@landley.net> + +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 000000000..b0ee7ec65 --- /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 000000000..946e1850c --- /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 000000000..305530b65 --- /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 000000000..34dc24f9f --- /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 000000000..394fb2516 --- /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 fe18aa6d5..8ac3312dc 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 } |