mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
pkg.run is not evaluated on Debian, fix that. For now it's hacked into pkg.sh, which is bound to be replaced by Python. The limited hassle is still worth the detour. Signed-off-by: Jan Lindemann <jan@janware.com>
163 lines
3.4 KiB
Bash
163 lines
3.4 KiB
Bash
#!/bin/bash
|
|
|
|
_cat()
|
|
{
|
|
sed 's/^ *|//'
|
|
}
|
|
|
|
cfg_section()
|
|
{
|
|
ini_section "$inifile" $@
|
|
}
|
|
|
|
cfg_value()
|
|
{
|
|
ini_value "$inifile" $@
|
|
}
|
|
|
|
# -- here we go
|
|
|
|
echo "== running $0" "$@" >&2
|
|
|
|
export LANG=POSIX
|
|
dir=`dirname $0`
|
|
inifile="$1"
|
|
. $dir/ini-tools.sh
|
|
|
|
_cat <<- EOT
|
|
|format_depends()
|
|
|{
|
|
| echo "\$@" | sed 's/ */,/g; s/,\([><=]\+\),*/\1/g; s/, *,*/,/g; s/, *$//; s/^ *,//; s/\([><=]\+\)\([0-9.-]\+\)/ (\1\2) /g'
|
|
|}
|
|
|
|
|
|#changelog()
|
|
|#{
|
|
|# #dch -c /dev/stdout --create -v \$VERSION-\$RELEASE --package \$NAME
|
|
|#cat << EOF
|
|
|#\$NAME (\$VERSION-\$RELEASE) UNRELEASED; urgency=medium
|
|
|#
|
|
|# * Initial release. (Closes: #XXXXXX)
|
|
|#
|
|
|# -- Jan Lindemann <jan@janware.com> `date -R`
|
|
|#
|
|
|#EOF
|
|
|#}
|
|
|
|
|
|compat()
|
|
|{
|
|
| echo -n 9
|
|
|}
|
|
|
|
|
|control()
|
|
|{
|
|
|cat << EOF
|
|
|Source: \$NAME
|
|
|Maintainer: Jan Lindemann <jan@janware.com>
|
|
|Section: `cfg_value global.group`
|
|
|Priority: optional
|
|
|Standards-Version: 3.9.2
|
|
|Build-Depends: debhelper (>= 9)
|
|
EOT
|
|
|
|
cfg_value global.subpackages | grep -q run && _cat <<- EOT
|
|
|
|
|
|Package: \$NAME-run
|
|
|Architecture: any
|
|
|Depends: \`format_depends "\${shlibs:Depends}, \${misc:Depends}, \$REQUIRES_RUN"\`
|
|
|# untested:
|
|
|Conflicts: \`format_depends "\$CONFLICTS_RUN"\`
|
|
|Description: `cfg_value summary`
|
|
|`cfg_value description | sed 's/^/ /'`
|
|
EOT
|
|
|
|
cfg_value global.subpackages | grep -q devel && _cat <<- EOT
|
|
|
|
|
|Package: \$NAME-devel
|
|
|Architecture: any
|
|
|Depends: \`format_depends "\$NAME-run = \$VERSION-\$RELEASE, \$REQUIRES_DEVEL"\`
|
|
|# untested:
|
|
|Conflicts: \`format_depends "\$CONFLICTS_DEVEL"\`
|
|
|Description: \$NAME Development Package
|
|
| Development tools for \$NAME-run
|
|
EOT
|
|
|
|
_cat <<- EOT
|
|
|EOF
|
|
|}
|
|
|
|
|
|copyright()
|
|
|{
|
|
| echo -n "Copyright (c) `date +'%Y'`, janware GmbH"
|
|
|}
|
|
|
|
|
|format()
|
|
|{
|
|
| echo "3.0 (quilt)"
|
|
|}
|
|
|
|
|
|rules()
|
|
|{
|
|
|cat << "EOF"
|
|
|#!/usr/bin/make -f
|
|
|
|
|
|# tip from https://pkg-perl.alioth.debian.org/debhelper.html
|
|
|# PACKAGE = \$(firstword \$(shell dh_listpackages))
|
|
|# TMP = \$(CURDIR)/debian/\$(PACKAGE)
|
|
|
|
|
|NAME = \$(shell pwd | xargs basename | sed 's/-[0-9.-]\+//')
|
|
|DEB_DIR = \$\$(pwd)/debian
|
|
|ENV_PREFIX = \$\$(pwd)/debian/tmp/inst-root
|
|
|EOF
|
|
|
|
|
|echo INSTALL_LOG = \$INSTALL_LOG
|
|
|
|
|
|cat << "EOF"
|
|
|%:
|
|
|EOF
|
|
|echo -e "\tdh \$""@"
|
|
|cat << EOF
|
|
|
|
|
|override_dh_auto_test:
|
|
|
|
|
|override_dh_installdirs:
|
|
| @echo "running override_dh_installdirs ($@)"
|
|
| #dh_installdirs
|
|
|
|
|
|override_dh_auto_install:
|
|
| @echo "running override_dh_auto_install ($@)"
|
|
| mkdir -p \`dirname \$INSTALL_LOG\`
|
|
| > \$INSTALL_LOG
|
|
| \\\$(MAKE) ENV_PREFIX=\\\$(ENV_PREFIX) INSTALL_LOG=\\\$(INSTALL_LOG) install
|
|
| PATH=$JWB_SCRIPT_DIR:\\\$(PATH) /bin/bash pkg.sh -m $JWB_SCRIPT_DIR milk-install-log -p \\\$(ENV_PREFIX) -n \\\$(NAME) -t deb \$INSTALL_LOG \\\$(DEB_DIR)
|
|
| dh_installdirs
|
|
|
|
|
|override_dh_install:
|
|
| dh_install --sourcedir=./debian/tmp/inst-root
|
|
|
|
|
|override_dh_shlibdeps:
|
|
| LD_LIBRARY_PATH=lib:\\\$(LD_LIBRARY_PATH) dh_shlibdeps
|
|
|
|
|
|override_dh_auto_clean:
|
|
|
|
|
|override_dh_compress:
|
|
|
|
|
|EOF
|
|
|}
|
|
|
|
|
|mkdir -p debian
|
|
|#dch --create --empty
|
|
|cd debian
|
|
|
|
|
|for file in compat control copyright format rules; do
|
|
| test -e \$file && continue
|
|
| \$file > \$file
|
|
|done
|
|
|
|
|
|chmod 755 rules
|
|
|
|
|
|cd ..
|
|
|
|
|
|dch --create --newversion \$VERSION-\$RELEASE --controlmaint --package \$NAME --force-distribution --distribution \$DISTRIBUTION "Release built by $0"
|
|
|
|
|
|echo "Produced by $0, the output should be in the \"debian\" sub-directory."
|
|
EOT
|