mirror of
https://github.com/mpv-player/mpv
synced 2024-12-14 02:45:43 +00:00
33bb00a680
more reliable operation in diverse environments. Tested on OpenBSD, NetBSD, FreeBSD, Darwin 10.2 and Darwin 10.1. Darwin 10.4 should work as well, 10.3 does not due to broken ls. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15537 b3059339-0415-0410-9bf9-f77b7e298cf2
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
OS=`uname -s`
|
|
case "$OS" in
|
|
CYGWIN*|Linux)
|
|
last_cvs_update=`date -r CVS/Entries +%y%m%d-%H:%M 2>/dev/null`
|
|
;;
|
|
BSD/OS)
|
|
LS=`ls -lT CVS/Entries`
|
|
month=`echo $LS | awk -F" " '{print $6}'`
|
|
day=`echo $LS | awk -F" " '{print $7}'`
|
|
hms=`echo $LS | awk -F" " '{print $8}'`
|
|
hour=`echo $hms | awk -F":" '{print $1}'`
|
|
minute=`echo $hms | awk -F":" '{print $2}'`
|
|
year=`echo $LS | awk -F" " '{print $9}'`
|
|
last_cvs_update="${year}${month}${day}-${hour}:${minute}"
|
|
;;
|
|
Darwin|*BSD)
|
|
# BSD 'date -r' does not print modification time
|
|
# LANG=C sets month/day order and English language in the date string
|
|
LS=`LANG=C ls -lT CVS/Entries`
|
|
year=`echo $LS | cut -d' ' -f9 | cut -c 3-4`
|
|
month=`echo $LS | awk -F" " '{printf "%.2d", \
|
|
(index("JanFebMarAprMayJunJulAugSepOctNovDec",$6)+2)/3}'`
|
|
day=`echo $LS | cut -d' ' -f7`
|
|
hour=`echo $LS | cut -d' ' -f8 | cut -d: -f1`
|
|
minute=`echo $LS | cut -d' ' -f8 | cut -d: -f2`
|
|
last_cvs_update="${year}${month}${day}-${hour}:${minute}"
|
|
;;
|
|
*)
|
|
last_cvs_update=`date +%y%m%d-%H:%M`
|
|
;;
|
|
esac
|
|
|
|
extra=""
|
|
if test "$1" ; then
|
|
extra="-$1"
|
|
fi
|
|
echo "#define VERSION \"dev-CVS-${last_cvs_update}${extra}\"" >version.h
|