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

View File

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