2025-11-17 10:37:56 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
log()
|
|
|
|
|
{
|
2026-06-25 21:42:22 +02:00
|
|
|
printf '%s\n' "$*"
|
2025-11-17 10:37:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err()
|
|
|
|
|
{
|
2026-06-25 21:42:22 +02:00
|
|
|
log "$*"
|
2025-11-17 10:37:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fatal()
|
|
|
|
|
{
|
2026-06-25 21:42:22 +02:00
|
|
|
err "$*"
|
2025-11-17 10:37:56 +01:00
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
usage()
|
|
|
|
|
{
|
|
|
|
|
echo "$myname [-h] [-s summary] [-d description] [-g pkg-group] name"
|
|
|
|
|
[ "$1" ] && exit $1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_Makefile()
|
|
|
|
|
{
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
TOPDIR = .
|
|
|
|
|
|
|
|
|
|
include \$(TOPDIR)/make/proj.mk
|
|
|
|
|
include \$(JWBDIR)/make/topdir.mk
|
|
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_VERSION()
|
|
|
|
|
{
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
1.0.0-0-dev
|
|
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_make_Makefile()
|
|
|
|
|
{
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
TOPDIR = ..
|
|
|
|
|
|
|
|
|
|
include \$(TOPDIR)/make/proj.mk
|
|
|
|
|
include \$(JWBDIR)/make/make.mk
|
|
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_make_proj_mk()
|
|
|
|
|
{
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
# to be included from inside the project directory
|
|
|
|
|
|
|
|
|
|
DEV_PROJECTS_DIR ?= \$(TOPDIR)/..
|
|
|
|
|
ifeq (\$(TARGET),mingw)
|
|
|
|
|
FLAVOUR_PATH_PREFIX = win32/
|
|
|
|
|
endif
|
2025-11-26 17:48:01 +01:00
|
|
|
JWBDIR ?= \$(firstword \$(wildcard \$(DEV_PROJECTS_DIR)/jw-pkg \$(BUILD_TOOLS_PREFIX)/opt/\$(FLAVOUR_PATH_PREFIX)jw-pkg))
|
2025-11-17 10:37:56 +01:00
|
|
|
|
|
|
|
|
USE_PROJECT_LIB = false
|
|
|
|
|
HDRDIR_SCOPE_SUFFIX = \$(PROJECT)
|
|
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_make_project_conf()
|
|
|
|
|
{
|
|
|
|
|
local login=$JANWARE_USER
|
|
|
|
|
[ "$login" ] || login=`whoami`
|
|
|
|
|
|
|
|
|
|
local fullname=`getent passwd $login | cut -d: -f5`
|
|
|
|
|
[ "$fullname" ] || fullname=$JANWARE_USER
|
|
|
|
|
[ "$fullname" ] || fullname=`whoami | xargs getent passwd | cut -d: -f5`
|
|
|
|
|
[ "$fullname" ] || fullname=`whoami`
|
|
|
|
|
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
[summary]
|
|
|
|
|
$summary
|
|
|
|
|
|
|
|
|
|
[description]
|
|
|
|
|
$description
|
|
|
|
|
|
|
|
|
|
[global]
|
|
|
|
|
group = "$pkg_group"
|
|
|
|
|
subpackages = $subpackages
|
|
|
|
|
license = Copyright (c) $fullname, all rights reserved
|
|
|
|
|
jw-maintainer = $JANWARE_USER
|
|
|
|
|
|
|
|
|
|
[build]
|
|
|
|
|
libname = none
|
|
|
|
|
|
|
|
|
|
[pkg.requires.jw]
|
2025-11-26 17:48:01 +01:00
|
|
|
devel = $name-run = VERSION-REVISION, jw-pkg-devel = VERSION
|
|
|
|
|
build = jw-pkg-devel
|
2025-11-17 10:37:56 +01:00
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cat_gitignore()
|
|
|
|
|
{
|
|
|
|
|
cat <<-EOT
|
|
|
|
|
*.done
|
|
|
|
|
*.dist
|
|
|
|
|
*.dep.mk
|
cache.mk: Include from topdir.mk, not make.mk
During a topdir "make all", caching variables is currently not the
first thing that happens. Instead, variables are cached as soon as a
project recurses into the make subdirectory. That was necessary,
because some makefiles were regenerated in the make subdirectory by
autoconf, potentially contributing variables that needed to be
cached.
As of now, autoconf is long gone and this is no longer true. And for
some variables, the two step process becomes involved, notably for
PYTHONPATH, which coding agents would like to look at from the topdir
very early on.
This commit moves the .project-cache.mk creation to topdir.mk, and
.projects-cache.mk creation to jw-pkg/Makefile to address that.
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-09 07:44:35 +02:00
|
|
|
.cache-project.mk
|
2025-11-17 10:37:56 +01:00
|
|
|
*.o
|
|
|
|
|
*.so.*
|
|
|
|
|
*.so
|
|
|
|
|
*.a
|
|
|
|
|
*.rep
|
|
|
|
|
ld-*.conf
|
|
|
|
|
*.ldscript
|
|
|
|
|
*.pc
|
|
|
|
|
$name
|
|
|
|
|
*_generated_*
|
|
|
|
|
*.secret
|
|
|
|
|
local.mk
|
|
|
|
|
.gdb_history
|
|
|
|
|
dist
|
|
|
|
|
mkspec.sh
|
|
|
|
|
*.out
|
|
|
|
|
*.orig
|
|
|
|
|
*.old
|
|
|
|
|
.feedfs_history
|
|
|
|
|
.exrc
|
|
|
|
|
*.swp
|
|
|
|
|
*tmp*
|
|
|
|
|
__init__.py
|
|
|
|
|
__pycache__
|
2026-05-31 14:30:26 +02:00
|
|
|
pyproject.toml
|
2026-05-27 18:59:00 +02:00
|
|
|
pyrightconfig.json
|
2025-11-17 10:37:56 +01:00
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ---------------------- here we go
|
|
|
|
|
|
|
|
|
|
myname=`basename $0`
|
|
|
|
|
projdir=.
|
|
|
|
|
|
|
|
|
|
summary=
|
|
|
|
|
description=
|
|
|
|
|
subpackages="run"
|
|
|
|
|
|
|
|
|
|
eval set -- `getopt -- hd:s:p:g: "$@"`
|
|
|
|
|
|
|
|
|
|
while [ "$1" != -- ]; do
|
|
|
|
|
case $1 in
|
|
|
|
|
-d)
|
|
|
|
|
eval description=\"$2\"
|
|
|
|
|
shift;;
|
|
|
|
|
-s)
|
|
|
|
|
eval summary=\"$2\"
|
|
|
|
|
shift;;
|
|
|
|
|
-p)
|
|
|
|
|
eval subpackages=\"$2\"
|
|
|
|
|
shift;;
|
|
|
|
|
-g)
|
|
|
|
|
eval pkg_group=\"$2\"
|
|
|
|
|
shift;;
|
|
|
|
|
-h)
|
|
|
|
|
usage 0;;
|
|
|
|
|
*)
|
|
|
|
|
usage 1;;
|
|
|
|
|
esac
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
|
|
[ -z "$description" ] && description="$summary"
|
|
|
|
|
[ -z "$summary" ] && summary="$description"
|
|
|
|
|
[ -z "$pkg_group" ] && pkg_group="Amusements/Teaching/Other"
|
|
|
|
|
|
|
|
|
|
[ -f $projdir/Makefile ] || {
|
|
|
|
|
fatal "$projdir doesn't contain a Makefile"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
name="$1"
|
|
|
|
|
|
|
|
|
|
[ -d $projdir/$name ] && {
|
|
|
|
|
fatal "$projdir/$name already exists"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
mkdir -p $projdir
|
|
|
|
|
mkdir $name
|
|
|
|
|
cd $projdir/$name
|
|
|
|
|
|
|
|
|
|
mkdir make
|
|
|
|
|
cat_Makefile > Makefile
|
|
|
|
|
cat_make_Makefile > make/Makefile
|
|
|
|
|
cat_VERSION > VERSION
|
|
|
|
|
cat_make_proj_mk > make/proj.mk
|
|
|
|
|
cat_make_project_conf > make/project.conf
|
|
|
|
|
cat_gitignore > .gitignore
|
|
|
|
|
|
|
|
|
|
log Successfully created project template \"$name\".
|
|
|
|
|
|