mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template
@ 2019-06-04 23:16 Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable Ulrich Ölmann
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

The first three patches clean up some things I stumbled over while working on
the addition of the src-meson-prog template which is found in the last two
patches.

Ulrich Ölmann (5):
  templates: wizard.sh: remove unused variable
  templates: wizard.sh: use neat parameter expansion and prevent word
    splitting
  templates: wizard.sh: use only one sed process
  templates: add src-meson-prog template
  templates: src-meson-prog: introduce version into template project

 doc/dev_manual.rst                            | 36 ++++++--
 rules/templates/src-autoconf-lib/wizard.sh    | 20 ++---
 rules/templates/src-autoconf-prog/wizard.sh   | 16 ++--
 .../templates/src-autoconf-proglib/wizard.sh  | 22 +++--
 rules/templates/src-cmake-prog/wizard.sh      | 12 ++-
 rules/templates/src-linux-driver/wizard.sh    | 12 ++-
 rules/templates/src-make-prog/wizard.sh       | 12 ++-
 rules/templates/src-meson-prog/@name@.c       | 12 +++
 rules/templates/src-meson-prog/COPYING        | 12 +++
 rules/templates/src-meson-prog/config.h.in    |  2 +
 rules/templates/src-meson-prog/meson.build    | 15 ++++
 rules/templates/src-meson-prog/wizard.sh      | 24 ++++++
 rules/templates/src-qmake-prog/wizard.sh      | 14 ++--
 rules/templates/src-stellaris/wizard.sh       | 12 ++-
 rules/templates/template-src-meson-prog-in    |  8 ++
 rules/templates/template-src-meson-prog-make  | 83 +++++++++++++++++++
 scripts/lib/ptxd_lib_template.sh              |  9 +-
 17 files changed, 245 insertions(+), 76 deletions(-)
 create mode 100644 rules/templates/src-meson-prog/@name@.c
 create mode 100644 rules/templates/src-meson-prog/COPYING
 create mode 100644 rules/templates/src-meson-prog/config.h.in
 create mode 100644 rules/templates/src-meson-prog/meson.build
 create mode 100644 rules/templates/src-meson-prog/wizard.sh
 create mode 100644 rules/templates/template-src-meson-prog-in
 create mode 100644 rules/templates/template-src-meson-prog-make

-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable
  2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
@ 2019-06-04 23:16 ` Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 2/5] templates: wizard.sh: use neat parameter expansion and prevent word splitting Ulrich Ölmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 rules/templates/src-autoconf-lib/wizard.sh     | 2 --
 rules/templates/src-autoconf-prog/wizard.sh    | 2 --
 rules/templates/src-autoconf-proglib/wizard.sh | 2 --
 rules/templates/src-cmake-prog/wizard.sh       | 2 --
 rules/templates/src-linux-driver/wizard.sh     | 2 --
 rules/templates/src-make-prog/wizard.sh        | 2 --
 rules/templates/src-qmake-prog/wizard.sh       | 2 --
 rules/templates/src-stellaris/wizard.sh        | 2 --
 8 files changed, 16 deletions(-)

diff --git a/rules/templates/src-autoconf-lib/wizard.sh b/rules/templates/src-autoconf-lib/wizard.sh
index 2821bd246fcc..35ef467b033e 100644
--- a/rules/templates/src-autoconf-lib/wizard.sh
+++ b/rules/templates/src-autoconf-lib/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-autoconf-prog/wizard.sh b/rules/templates/src-autoconf-prog/wizard.sh
index 13b909bd52fc..de63547e5b84 100644
--- a/rules/templates/src-autoconf-prog/wizard.sh
+++ b/rules/templates/src-autoconf-prog/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-autoconf-proglib/wizard.sh b/rules/templates/src-autoconf-proglib/wizard.sh
index 3f8f4f595281..6951dcd5268c 100644
--- a/rules/templates/src-autoconf-proglib/wizard.sh
+++ b/rules/templates/src-autoconf-proglib/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-cmake-prog/wizard.sh b/rules/templates/src-cmake-prog/wizard.sh
index 2e5eb5cc523b..20c28f29d85f 100644
--- a/rules/templates/src-cmake-prog/wizard.sh
+++ b/rules/templates/src-cmake-prog/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-linux-driver/wizard.sh b/rules/templates/src-linux-driver/wizard.sh
index f37fe6b5199c..61d47c415a17 100644
--- a/rules/templates/src-linux-driver/wizard.sh
+++ b/rules/templates/src-linux-driver/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-make-prog/wizard.sh b/rules/templates/src-make-prog/wizard.sh
index f37fe6b5199c..61d47c415a17 100644
--- a/rules/templates/src-make-prog/wizard.sh
+++ b/rules/templates/src-make-prog/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-qmake-prog/wizard.sh b/rules/templates/src-qmake-prog/wizard.sh
index c6fe27fee327..1237a5065203 100644
--- a/rules/templates/src-qmake-prog/wizard.sh
+++ b/rules/templates/src-qmake-prog/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
diff --git a/rules/templates/src-stellaris/wizard.sh b/rules/templates/src-stellaris/wizard.sh
index 11eac084878f..3b28a15490c3 100644
--- a/rules/templates/src-stellaris/wizard.sh
+++ b/rules/templates/src-stellaris/wizard.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-HERE=$(pwd)
-
 NAME=$1
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 2/5] templates: wizard.sh: use neat parameter expansion and prevent word splitting
  2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable Ulrich Ölmann
@ 2019-06-04 23:16 ` Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 3/5] templates: wizard.sh: use only one sed process Ulrich Ölmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 rules/templates/src-autoconf-lib/wizard.sh     | 12 ++++++------
 rules/templates/src-autoconf-prog/wizard.sh    |  8 ++++----
 rules/templates/src-autoconf-proglib/wizard.sh | 14 +++++++-------
 rules/templates/src-cmake-prog/wizard.sh       |  6 +++---
 rules/templates/src-linux-driver/wizard.sh     |  6 +++---
 rules/templates/src-make-prog/wizard.sh        |  6 +++---
 rules/templates/src-qmake-prog/wizard.sh       |  8 ++++----
 rules/templates/src-stellaris/wizard.sh        |  6 +++---
 8 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/rules/templates/src-autoconf-lib/wizard.sh b/rules/templates/src-autoconf-lib/wizard.sh
index 35ef467b033e..e75b96e404de 100644
--- a/rules/templates/src-autoconf-lib/wizard.sh
+++ b/rules/templates/src-autoconf-lib/wizard.sh
@@ -1,12 +1,12 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
 
 mv "@name@.c" "${NAME}.c"
 mv "lib@name@.h" "lib${NAME}.h"
@@ -22,9 +22,9 @@ mv m4/internal.h .
 for i in \
 	configure.ac \
 	Makefile.am \
-	${NAME}.c \
-	lib${NAME}.h \
-	lib${NAME}.pc.in \
+	"${NAME}.c" \
+	"lib${NAME}.h" \
+	"lib${NAME}.pc.in" \
 	INSTALL \
 	internal.h \
 ; do
diff --git a/rules/templates/src-autoconf-prog/wizard.sh b/rules/templates/src-autoconf-prog/wizard.sh
index de63547e5b84..4b36c5e1f6f0 100644
--- a/rules/templates/src-autoconf-prog/wizard.sh
+++ b/rules/templates/src-autoconf-prog/wizard.sh
@@ -1,14 +1,14 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.c" "${NAME}.c"
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
 
 # prepare and instantiate the M4 macros
 mkdir -v m4
@@ -20,7 +20,7 @@ mv m4/internal.h .
 for i in \
 	configure.ac \
 	Makefile.am \
-	${NAME}.c \
+	"${NAME}.c" \
 	INSTALL \
 	internal.h \
 ; do
diff --git a/rules/templates/src-autoconf-proglib/wizard.sh b/rules/templates/src-autoconf-proglib/wizard.sh
index 6951dcd5268c..7c10b35f856b 100644
--- a/rules/templates/src-autoconf-proglib/wizard.sh
+++ b/rules/templates/src-autoconf-proglib/wizard.sh
@@ -1,12 +1,12 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
-NAME_NODASH=$(echo $NAME | tr '-' '_')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
+NAME_NODASH="$(echo $NAME | tr '-' '_')"
 
 mv "@name@.c" "${NAME}.c"
 mv "lib@name@.c" "lib${NAME}.c"
@@ -23,10 +23,10 @@ mv m4/internal.h .
 for i in \
 	configure.ac \
 	Makefile.am \
-	${NAME}.c \
-	lib${NAME}.c \
-	lib${NAME}.h \
-	lib${NAME}.pc.in \
+	"${NAME}.c" \
+	"lib${NAME}.c" \
+	"lib${NAME}.h" \
+	"lib${NAME}.pc.in" \
 	INSTALL \
 	internal.h \
 ; do
diff --git a/rules/templates/src-cmake-prog/wizard.sh b/rules/templates/src-cmake-prog/wizard.sh
index 20c28f29d85f..6cd7ccbbfb1f 100644
--- a/rules/templates/src-cmake-prog/wizard.sh
+++ b/rules/templates/src-cmake-prog/wizard.sh
@@ -1,17 +1,17 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.cpp" "${NAME}.cpp"
 
 for i in \
 	CMakeLists.txt \
-	${NAME}.cpp \
+	"${NAME}.cpp" \
 ; do
 	sed -i -e "s/\@name\@/${NAME}/g" $i
 	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-linux-driver/wizard.sh b/rules/templates/src-linux-driver/wizard.sh
index 61d47c415a17..61b31a845823 100644
--- a/rules/templates/src-linux-driver/wizard.sh
+++ b/rules/templates/src-linux-driver/wizard.sh
@@ -1,17 +1,17 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.c" "${NAME}.c"
 
 for i in \
 	Makefile \
-	${NAME}.c \
+	"${NAME}.c" \
 ; do
 	sed -i -e "s/\@name\@/${NAME}/g" $i
 	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-make-prog/wizard.sh b/rules/templates/src-make-prog/wizard.sh
index 61d47c415a17..61b31a845823 100644
--- a/rules/templates/src-make-prog/wizard.sh
+++ b/rules/templates/src-make-prog/wizard.sh
@@ -1,17 +1,17 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.c" "${NAME}.c"
 
 for i in \
 	Makefile \
-	${NAME}.c \
+	"${NAME}.c" \
 ; do
 	sed -i -e "s/\@name\@/${NAME}/g" $i
 	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-qmake-prog/wizard.sh b/rules/templates/src-qmake-prog/wizard.sh
index 1237a5065203..497706e2caf5 100644
--- a/rules/templates/src-qmake-prog/wizard.sh
+++ b/rules/templates/src-qmake-prog/wizard.sh
@@ -1,18 +1,18 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.cpp" "${NAME}.cpp"
 mv "@name@.pro" "${NAME}.pro"
 
 for i in \
-	${NAME}.pro \
-	${NAME}.cpp \
+	"${NAME}.pro" \
+	"${NAME}.cpp" \
 ; do
 	sed -i -e "s/\@name\@/${NAME}/g" $i
 	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
diff --git a/rules/templates/src-stellaris/wizard.sh b/rules/templates/src-stellaris/wizard.sh
index 3b28a15490c3..8ebce80c08b2 100644
--- a/rules/templates/src-stellaris/wizard.sh
+++ b/rules/templates/src-stellaris/wizard.sh
@@ -1,11 +1,11 @@
 #!/bin/bash
 
-NAME=$1
+NAME="${1}"
 if [ -z "$NAME" ]; then
 	echo -n "project name: "
 	read NAME
 fi
-NAME_UP=$(echo $NAME | tr '[a-z-]' '[A-Z_]')
+NAME_UP="$(echo $NAME | tr '[a-z-]' '[A-Z_]')"
 
 mv "@name@.c" "${NAME}.c"
 
@@ -13,7 +13,7 @@ for i in \
 	configure.ac \
 	link.ld \
 	Makefile.in \
-	${NAME}.c \
+	"${NAME}.c" \
 ; do
 	sed -i -e "s/\@name\@/${NAME}/g" $i
 	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 3/5] templates: wizard.sh: use only one sed process
  2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 2/5] templates: wizard.sh: use neat parameter expansion and prevent word splitting Ulrich Ölmann
@ 2019-06-04 23:16 ` Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 4/5] templates: add src-meson-prog template Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 5/5] templates: src-meson-prog: introduce version into template project Ulrich Ölmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 rules/templates/src-autoconf-lib/wizard.sh     | 6 +++---
 rules/templates/src-autoconf-prog/wizard.sh    | 6 +++---
 rules/templates/src-autoconf-proglib/wizard.sh | 6 +++---
 rules/templates/src-cmake-prog/wizard.sh       | 4 ++--
 rules/templates/src-linux-driver/wizard.sh     | 4 ++--
 rules/templates/src-make-prog/wizard.sh        | 4 ++--
 rules/templates/src-qmake-prog/wizard.sh       | 4 ++--
 rules/templates/src-stellaris/wizard.sh        | 4 ++--
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/rules/templates/src-autoconf-lib/wizard.sh b/rules/templates/src-autoconf-lib/wizard.sh
index e75b96e404de..a451b4f71e49 100644
--- a/rules/templates/src-autoconf-lib/wizard.sh
+++ b/rules/templates/src-autoconf-lib/wizard.sh
@@ -28,8 +28,8 @@ for i in \
 	INSTALL \
 	internal.h \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@namenodash\@/${NAME_NODASH}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@namenodash\@/${NAME_NODASH}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-autoconf-prog/wizard.sh b/rules/templates/src-autoconf-prog/wizard.sh
index 4b36c5e1f6f0..b2d78f5d592d 100644
--- a/rules/templates/src-autoconf-prog/wizard.sh
+++ b/rules/templates/src-autoconf-prog/wizard.sh
@@ -24,8 +24,8 @@ for i in \
 	INSTALL \
 	internal.h \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@namenodash\@/${NAME_NODASH}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@namenodash\@/${NAME_NODASH}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-autoconf-proglib/wizard.sh b/rules/templates/src-autoconf-proglib/wizard.sh
index 7c10b35f856b..f84ca8da8a12 100644
--- a/rules/templates/src-autoconf-proglib/wizard.sh
+++ b/rules/templates/src-autoconf-proglib/wizard.sh
@@ -30,7 +30,7 @@ for i in \
 	INSTALL \
 	internal.h \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@namenodash\@/${NAME_NODASH}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	          "s/\@namenodash\@/${NAME_NODASH}/g" \
+	          "s/\@NAME\@/${NAME_UP}/g" $i
 done
diff --git a/rules/templates/src-cmake-prog/wizard.sh b/rules/templates/src-cmake-prog/wizard.sh
index 6cd7ccbbfb1f..253eedca9cce 100644
--- a/rules/templates/src-cmake-prog/wizard.sh
+++ b/rules/templates/src-cmake-prog/wizard.sh
@@ -13,7 +13,7 @@ for i in \
 	CMakeLists.txt \
 	"${NAME}.cpp" \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-linux-driver/wizard.sh b/rules/templates/src-linux-driver/wizard.sh
index 61b31a845823..20c8df88a38c 100644
--- a/rules/templates/src-linux-driver/wizard.sh
+++ b/rules/templates/src-linux-driver/wizard.sh
@@ -13,7 +13,7 @@ for i in \
 	Makefile \
 	"${NAME}.c" \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-make-prog/wizard.sh b/rules/templates/src-make-prog/wizard.sh
index 61b31a845823..20c8df88a38c 100644
--- a/rules/templates/src-make-prog/wizard.sh
+++ b/rules/templates/src-make-prog/wizard.sh
@@ -13,7 +13,7 @@ for i in \
 	Makefile \
 	"${NAME}.c" \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-qmake-prog/wizard.sh b/rules/templates/src-qmake-prog/wizard.sh
index 497706e2caf5..cd0b94f4cdc8 100644
--- a/rules/templates/src-qmake-prog/wizard.sh
+++ b/rules/templates/src-qmake-prog/wizard.sh
@@ -14,7 +14,7 @@ for i in \
 	"${NAME}.pro" \
 	"${NAME}.cpp" \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
diff --git a/rules/templates/src-stellaris/wizard.sh b/rules/templates/src-stellaris/wizard.sh
index 8ebce80c08b2..8350fc40e4d5 100644
--- a/rules/templates/src-stellaris/wizard.sh
+++ b/rules/templates/src-stellaris/wizard.sh
@@ -15,7 +15,7 @@ for i in \
 	Makefile.in \
 	"${NAME}.c" \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
-	sed -i -e "s/\@NAME\@/${NAME_UP}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@NAME\@/${NAME_UP}/g" $i
 done
 
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 4/5] templates: add src-meson-prog template
  2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
                   ` (2 preceding siblings ...)
  2019-06-04 23:16 ` [ptxdist] [PATCH 3/5] templates: wizard.sh: use only one sed process Ulrich Ölmann
@ 2019-06-04 23:16 ` Ulrich Ölmann
  2019-06-04 23:16 ` [ptxdist] [PATCH 5/5] templates: src-meson-prog: introduce version into template project Ulrich Ölmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

Signed-off-by: Ulrich Ölmann <u.oelmann@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(-)
 create mode 100644 rules/templates/src-meson-prog/@name@.c
 create mode 100644 rules/templates/src-meson-prog/COPYING
 create mode 100644 rules/templates/src-meson-prog/config.h.in
 create mode 100644 rules/templates/src-meson-prog/meson.build
 create mode 100644 rules/templates/src-meson-prog/wizard.sh
 create mode 100644 rules/templates/template-src-meson-prog-in
 create mode 100644 rules/templates/template-src-meson-prog-make

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>
+
+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
 }
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH 5/5] templates: src-meson-prog: introduce version into template project
  2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
                   ` (3 preceding siblings ...)
  2019-06-04 23:16 ` [ptxdist] [PATCH 4/5] templates: add src-meson-prog template Ulrich Ölmann
@ 2019-06-04 23:16 ` Ulrich Ölmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ulrich Ölmann @ 2019-06-04 23:16 UTC (permalink / raw)
  To: PTXdist Development Mailing List; +Cc: Ulrich Ölmann

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 rules/templates/src-meson-prog/@name@.c    | 2 +-
 rules/templates/src-meson-prog/config.h.in | 1 +
 rules/templates/src-meson-prog/meson.build | 2 ++
 rules/templates/src-meson-prog/wizard.sh   | 9 ++++++++-
 scripts/lib/ptxd_lib_template.sh           | 2 +-
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/rules/templates/src-meson-prog/@name@.c b/rules/templates/src-meson-prog/@name@.c
index 061debf310bc..1911e620d09d 100644
--- a/rules/templates/src-meson-prog/@name@.c
+++ b/rules/templates/src-meson-prog/@name@.c
@@ -5,7 +5,7 @@
 
 int main(int argc, char *argv[])
 {
-	printf("Hello World, I'm @name@!\n");
+	printf("Hello World, I'm version " VERSION_STR " of @name@!\n");
 	printf("My license is " LICENSE_STR ".\n");
 
 	exit(EXIT_SUCCESS);
diff --git a/rules/templates/src-meson-prog/config.h.in b/rules/templates/src-meson-prog/config.h.in
index b0ee7ec65121..4d90c2e66ea8 100644
--- a/rules/templates/src-meson-prog/config.h.in
+++ b/rules/templates/src-meson-prog/config.h.in
@@ -1 +1,2 @@
+#define VERSION_STR "@version@"
 #define LICENSE_STR "@license@"
diff --git a/rules/templates/src-meson-prog/meson.build b/rules/templates/src-meson-prog/meson.build
index 946e1850cfd5..de559eb72693 100644
--- a/rules/templates/src-meson-prog/meson.build
+++ b/rules/templates/src-meson-prog/meson.build
@@ -1,8 +1,10 @@
 project('@name@', 'c',
+  version : '@version@',
   license : '0BSD',
   default_options : ['warning_level=3'])
 
 conf_data = configuration_data()
+conf_data.set('version', meson.project_version())
 conf_data.set('license', meson.project_license()[0])
 configure_file(input : 'config.h.in',
                output : 'config.h',
diff --git a/rules/templates/src-meson-prog/wizard.sh b/rules/templates/src-meson-prog/wizard.sh
index 305530b654d4..3753d8d0e67d 100644
--- a/rules/templates/src-meson-prog/wizard.sh
+++ b/rules/templates/src-meson-prog/wizard.sh
@@ -6,12 +6,19 @@ if [ -z "$NAME" ]; then
 	read NAME
 fi
 
+VERSION="${3}"
+if [ -z "$VERSION" ]; then
+	echo -n "project version: "
+	read VERSION
+fi
+
 mv "@name@.c" "${NAME}.c"
 
 for i in \
 	meson.build \
 	${NAME}.c \
 ; do
-	sed -i -e "s/\@name\@/${NAME}/g" $i
+	sed -i -e "s/\@name\@/${NAME}/g" \
+	       -e "s/\@version\@/${VERSION}/g" $i
 done
 
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index 8ac3312dc775..b437c52f24ed 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -211,7 +211,7 @@ ptxd_template_write_src() {
 	return
     fi &&
     template_dir=$(dirname "${template_src}") &&
-    ( cd "${dst}" && bash wizard.sh "${package}" "${template_dir}") &&
+    ( cd "${dst}" && bash wizard.sh "${package}" "${template_dir}" "${VERSION}") &&
     rm -f "${dst}/wizard.sh"
 }
 export -f ptxd_template_write_src
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-04 23:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 23:16 [ptxdist] [PATCH 0/5] Clean up templates and add src-meson-prog template Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 1/5] templates: wizard.sh: remove unused variable Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 2/5] templates: wizard.sh: use neat parameter expansion and prevent word splitting Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 3/5] templates: wizard.sh: use only one sed process Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 4/5] templates: add src-meson-prog template Ulrich Ölmann
2019-06-04 23:16 ` [ptxdist] [PATCH 5/5] templates: src-meson-prog: introduce version into template project Ulrich Ölmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox