From 4926541a493b375ae9769b2531def96abb2d8e83 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 19 Nov 2020 03:17:19 +0100 Subject: [PATCH] Import the newer scripts from DeforaOS configure --- po/gettext.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/po/gettext.sh b/po/gettext.sh index c3ae919..d1b91a2 100755 --- a/po/gettext.sh +++ b/po/gettext.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2010-2014 Pierre Pronchery +#Copyright (c) 2010-2020 Pierre Pronchery # #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}"