Import the newer scripts from DeforaOS configure

This commit is contained in:
Pierre Pronchery 2020-11-19 03:17:19 +01:00
parent 8037cfdbf0
commit 4926541a49

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}"