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 #!/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}"