Import the newer scripts from DeforaOS configure

This commit is contained in:
Pierre Pronchery 2020-11-19 03:15:25 +01:00
parent 882f4659d0
commit 37225dd841
2 changed files with 31 additions and 14 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,8 +25,8 @@
#variables
CONFIGSH="${0%/docbook.sh}/../config.sh"
PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
PROGNAME="docbook.sh"
#executables
DEBUG="_debug"
@ -37,12 +37,14 @@ RM="rm -f"
XMLLINT="xmllint"
XSLTPROC="xsltproc --nonet --xinclude"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#debug
_debug()
{
echo "$@" 1>&2
echo "$@" 1>&3
"$@"
}
@ -114,7 +116,7 @@ _usage()
clean=0
install=0
uninstall=0
while getopts "ciuP:" name; do
while getopts "ciO:uP:" name; do
case "$name" in
c)
clean=1
@ -123,6 +125,9 @@ while getopts "ciuP:" name; do
uninstall=0
install=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u)
install=0
uninstall=1
@ -137,7 +142,7 @@ while getopts "ciuP:" name; do
esac
done
shift $((OPTIND - 1))
if [ $# -eq 0 ]; then
if [ $# -lt 1 ]; then
_usage
exit $?
fi
@ -151,6 +156,7 @@ fi
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
shift
@ -166,7 +172,7 @@ while [ $# -gt 0 ]; do
xpath="string(/refentry/refmeta/manvolnum)"
section=$($XMLLINT --xpath "$xpath" "$source")
if [ $? -eq 0 -a -n "$section" ]; then
instdir="$DATADIR/man/html$section"
instdir="$MANDIR/html$section"
fi
;;
pdf)
@ -194,7 +200,11 @@ while [ $# -gt 0 ]; do
#install
if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$instdir" || exit 2
dirname=
if [ "${source%/*}" != "$source" ]; then
dirname="/${source%/*}"
fi
$DEBUG $MKDIR -- "$instdir$dirname" || exit 2
$DEBUG $INSTALL "$target" "$instdir/$source" || exit 2
continue
fi

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2010-2014 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,10 +25,11 @@
#variables
CONFIGSH="${0%/gettext.sh}/../config.sh"
PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
LOCALEDIR="$PREFIX/share/locale"
POTFILES="POTFILES"
PROGNAME="gettext.sh"
#executables
DEBUG="_debug"
INSTALL="install -m 0644"
@ -39,12 +40,14 @@ MSGMERGE="msgmerge"
RM="rm -f"
XGETTEXT="xgettext --force-po"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#debug
_debug()
{
echo "$@" 1>&2
echo "$@" 1>&3
"$@"
}
@ -52,7 +55,7 @@ _debug()
#error
_error()
{
echo "gettext.sh: $@" 1>&2
echo "$PROGNAME: $@" 1>&2
return 2
}
@ -60,7 +63,7 @@ _error()
#usage
_usage()
{
echo "Usage: gettext.sh [-c|-i|-u][-P prefix] target..." 1>&2
echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
return 1
}
@ -111,7 +114,7 @@ _gettext_pot()
clean=0
install=0
uninstall=0
while getopts "ciuP:" name; do
while getopts "ciO:uP:" name; do
case "$name" in
c)
clean=1
@ -120,6 +123,9 @@ while getopts "ciuP:" name; do
uninstall=0
install=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u)
install=0
uninstall=1
@ -134,7 +140,7 @@ while getopts "ciuP:" name; do
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
if [ $# -lt 1 ]; then
_usage
exit $?
fi
@ -146,6 +152,7 @@ if [ -z "$PACKAGE" ]; then
fi
LOCALEDIR="$PREFIX/share/locale"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
source="${target#$OBJDIR}"