From 09c288a1fe51da886b217789844631ef788bae7c Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sat, 14 Oct 2017 00:13:03 +0200 Subject: [PATCH] Import newer scripts from upstream --- doc/docbook.sh | 18 +++++++++++++----- po/gettext.sh | 12 ++++++++---- tools/subst.sh | 8 +++++--- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/docbook.sh b/doc/docbook.sh index fda4e2d..115bc92 100755 --- a/doc/docbook.sh +++ b/doc/docbook.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2012-2014 Pierre Pronchery +#Copyright (c) 2012-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -42,7 +42,7 @@ XSLTPROC="xsltproc --nonet --xinclude" #debug _debug() { - echo "$@" 1>&2 + echo "$@" 1>&3 "$@" } @@ -114,7 +114,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 +123,9 @@ while getopts "ciuP:" name; do uninstall=0 install=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; u) install=0 uninstall=1 @@ -137,7 +140,7 @@ while getopts "ciuP:" name; do esac done shift $((OPTIND - 1)) -if [ $# -eq 0 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi @@ -151,6 +154,7 @@ fi [ -z "$DATADIR" ] && DATADIR="$PREFIX/share" [ -z "$MANDIR" ] && MANDIR="$DATADIR/man" +exec 3>&1 while [ $# -gt 0 ]; do target="$1" shift @@ -194,7 +198,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 diff --git a/po/gettext.sh b/po/gettext.sh index bf53b2b..5f07dc2 100755 --- a/po/gettext.sh +++ b/po/gettext.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2010-2015 Pierre Pronchery +#Copyright (c) 2010-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -45,7 +45,7 @@ XGETTEXT="xgettext --force-po" #debug _debug() { - echo "$@" 1>&2 + echo "$@" 1>&3 "$@" } @@ -112,7 +112,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 @@ -121,6 +121,9 @@ while getopts "ciuP:" name; do uninstall=0 install=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; u) install=0 uninstall=1 @@ -135,7 +138,7 @@ while getopts "ciuP:" name; do esac done shift $(($OPTIND - 1)) -if [ $# -eq 0 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi @@ -147,6 +150,7 @@ if [ -z "$PACKAGE" ]; then fi LOCALEDIR="$PREFIX/share/locale" +exec 3>&1 while [ $# -gt 0 ]; do target="$1" source="${target#$OBJDIR}" diff --git a/tools/subst.sh b/tools/subst.sh index 7fe7d1e..1389192 100755 --- a/tools/subst.sh +++ b/tools/subst.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2012-2016 Pierre Pronchery +#Copyright (c) 2012-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -70,7 +70,7 @@ _subst() LDSO="/libexec/ld-elf.so.1" ;; Linux) - LDSO="/lib/ld-linux-$(uname -p).so.2" + LDSO="/lib/ld-linux-$(uname -m | tr _ -).so.2" ;; *) LDSO="/libexec/ld.elf_so" @@ -112,6 +112,8 @@ _subst() #create source="${target#$OBJDIR}" source="${source}.in" + ([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \ + || return 2 $DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \ -e "s;@VERSION@;$VERSION;g" \ -e "s;@PREFIX@;$PREFIX;g" \ @@ -190,7 +192,7 @@ while getopts "ciuO:P:" name; do esac done shift $(($OPTIND - 1)) -if [ $# -eq 0 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi