mkvers.sh: Reformatting for better readability

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2016-03-30 17:06:50 +02:00
parent 4eca5e6a3f
commit c8022ae3f0

View File

@ -21,34 +21,36 @@ windres="$1"; shift
iflags= iflags=
# Find header file locations # Find header file locations
while [ -n "$*" ]; do while [ -n "$*" ]; do
case "$1" in case "$1" in
-I*) -I*)
iflags="$iflags $1" iflags="$iflags $1"
;; ;;
-idirafter) -idirafter)
shift
iflags="$iflags -I$1"
;;
esac
shift shift
iflags="$iflags -I$1"
;;
esac
shift
done done
[ -r $incfile ] || { [ -r $incfile ] || {
echo "**** Couldn't open file '$incfile'. Aborting." echo "**** Couldn't open file '$incfile'. Aborting."
} }
function parse_preproc_flags() { function parse_preproc_flags() {
# Since we're manually specifying the preprocessor, pass the default flags normally defined. # Since we're manually specifying the preprocessor, pass the default flags
ccflags="--preprocessor=$1 --preprocessor-arg=-E --preprocessor-arg=-xc-header --define=RC_INVOKED " # normally defined.
ccflags="--preprocessor=$1 --preprocessor-arg=-E \
--preprocessor-arg=-xc-header --define=RC_INVOKED "
shift shift
while [ -n "$*" ]; do while [ -n "$*" ]; do
case "$1" in case "$1" in
# We need to be able to find the just-built cc1 binary. # We need to be able to find the just-built cc1 binary.
-B*) -B*)
ccflags="$ccflags --preprocessor-arg=$1" ccflags="$ccflags --preprocessor-arg=$1"
;; ;;
esac esac
shift shift
done done
} }
@ -87,15 +89,15 @@ EOF
# #
# Split version file into dir and filename components # Split version file into dir and filename components
# #
dir=`dirname $incfile` dir=$(dirname $incfile)
fn=`basename $incfile` fn=$(basename $incfile)
# #
# Look in the include file CVS directory for a CVS Tag file. This file, # Look in the include file CVS directory for a CVS Tag file. This file,
# if it exists, will contain the name of the sticky tag associated with # if it exists, will contain the name of the sticky tag associated with
# the current build. Save that for output later. # the current build. Save that for output later.
# #
cvs_tag="`sed -e '/dontuse/d' -e 's%^.\(.*\)%\1%' $dir/CVS/Tag 2>/dev/null`" cvs_tag="$(sed -e '/dontuse/d' -e 's%^.\(.*\)%\1%' $dir/CVS/Tag 2>/dev/null)"
wv_cvs_tag="$cvs_tag" wv_cvs_tag="$cvs_tag"
[ -n "$cvs_tag" ] && cvs_tag=" CVS tag"' [ -n "$cvs_tag" ] && cvs_tag=" CVS tag"'
@ -104,14 +106,14 @@ wv_cvs_tag="$cvs_tag"
# #
# Look in the source directory containing the include/cygwin/version.h # Look in the source directory containing the include/cygwin/version.h
# and set dir accordingly. # and set dir accordingly.
dir=`echo $dir | sed -e 's%/include/cygwin.*$%%' -e 's%include/cygwin.*$%.%'` dir=$(echo $dir | sed -e 's%/include/cygwin.*$%%' -e 's%include/cygwin.*$%.%')
# Look in $dir for a a ".snapshot-date" file. If one is found then this # Look in $dir for a a ".snapshot-date" file. If one is found then this
# information will be saved for output to the DLL. # information will be saved for output to the DLL.
# #
if [ -r "$dir/.snapshot-date" ]; then if [ -r "$dir/.snapshot-date" ]; then
read snapshotdate < "$dir/.snapshot-date" read snapshotdate < "$dir/.snapshot-date"
snapshot="snapshot date snapshot="snapshot date
$snapshotdate" $snapshotdate"
fi fi
@ -124,11 +126,13 @@ fi
# These strings are strictly for use by a user to scan the DLL for # These strings are strictly for use by a user to scan the DLL for
# interesting information. # interesting information.
# #
(sed -n -e 's%#define CYGWIN_INFO_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\ (
sed -n -e 's%#define CYGWIN_INFO_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\
\2%p' -e 's%#define CYGWIN_VERSION_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\ \2%p' -e 's%#define CYGWIN_VERSION_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\
\2%p' $incfile | sed -e 's/["\\]//g' -e '/^_/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz /'; \2%p' $incfile | sed -e 's/["\\]//g' -e '/^_/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz /';
echo ' build date'; echo $build_date; [ -n "$cvs_tag" ] && echo "$cvs_tag";\ echo ' build date'; echo $build_date;
[ -n "$snapshot" ] && echo "$snapshot" [ -n "$cvs_tag" ] && echo "$cvs_tag";
[ -n "$snapshot" ] && echo "$snapshot"
) | while read var; do ) | while read var; do
read val read val
cat <<EOF cat <<EOF
@ -139,7 +143,7 @@ done | tee /tmp/mkvers.$$ 1>&9
trap "rm -f /tmp/mkvers.$$" 0 1 2 15 trap "rm -f /tmp/mkvers.$$" 0 1 2 15
if [ -n "$snapshotdate" ]; then if [ -n "$snapshotdate" ]; then
usedate="`echo $snapshotdate | sed 's/-\\(..:..[^-]*\\).*$/ \1SNP/'`" usedate="$(echo $snapshotdate | sed 's/-\\(..:..[^-]*\\).*$/ \1SNP/')"
else else
usedate="$builddate" usedate="$builddate"
fi fi
@ -174,15 +178,21 @@ EOF
# Generate winver.o using cygwin/version.h information. # Generate winver.o using cygwin/version.h information.
# Turn the cygwin major number from some large number to something like 1.1.0. # Turn the cygwin major number from some large number to something like 1.1.0.
# #
eval `sed -n 's/^.*dll \(m[ai][jn]or\): \([0-9]*\)[^0-9]*$/\1=\2/p' /tmp/mkvers.$$` eval $(sed -n 's/^.*dll \(m[ai][jn]or\): \([0-9]*\)[^0-9]*$/\1=\2/p' /tmp/mkvers.$$)
cygverhigh=`expr $major / 1000` cygverhigh=$(expr $major / 1000)
cygverlow=`expr $major % 1000` cygverlow=$(expr $major % 1000)
cygwin_ver="$cygverhigh.$cygverlow.$minor" cygwin_ver="$cygverhigh.$cygverlow.$minor"
if [ -n "$cvs_tag" ]; then if [ -n "$cvs_tag" ]
cvs_tag="`echo $wv_cvs_tag | sed -e 's/-branch.*//'`" then
cygwin_ver="$cygwin_ver-$cvs_tag" cvs_tag="$(echo $wv_cvs_tag | sed -e 's/-branch.*//')"
cygwin_ver="$cygwin_ver-$cvs_tag"
fi fi
echo "Version $cygwin_ver" echo "Version $cygwin_ver"
set -$- $builddate set -$- $builddate
$windres $iflags $ccflags --define CYGWIN_BUILD_DATE="$1" --define CYGWIN_BUILD_TIME="$2" --define CYGWIN_BUILD_YEAR=$y --define CYGWIN_VERSION='"'"$cygwin_ver"'"' $rcfile winver.o $windres $iflags $ccflags \
--define CYGWIN_BUILD_DATE="$1" \
--define CYGWIN_BUILD_TIME="$2" \
--define CYGWIN_BUILD_YEAR=$y \
--define CYGWIN_VERSION='"'"$cygwin_ver"'"' \
$rcfile winver.o