annotate version.sh @ 16896:5a9251e955df

changed KEY_PREVIOUS to KEY_PREV, cause the first undefined
author ptt
date Thu, 03 Nov 2005 10:50:43 +0000
parents 8fc10647e146
children ff09faee7c14
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
420
980bafac238f write cvs date+version into version.h
arpi_esp
parents:
diff changeset
1 #!/bin/sh
980bafac238f write cvs date+version into version.h
arpi_esp
parents:
diff changeset
2
8687
93694559178c better BSD/OS support by Steven Schultz <sms@2bsd.com>
alex
parents: 7448
diff changeset
3 OS=`uname -s`
93694559178c better BSD/OS support by Steven Schultz <sms@2bsd.com>
alex
parents: 7448
diff changeset
4 case "$OS" in
15668
8fc10647e146 MinGW support
diego
parents: 15666
diff changeset
5 CYGWIN*|Linux|MINGW*)
15650
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
6 last_cvs_update=`date -r CVS/Entries +%y%m%d-%H:%M 2>/dev/null`
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
7 ;;
15666
5fa1221fb597 BSD/OS works same as the other BSDs, tested by Steven M. Schultz.
diego
parents: 15650
diff changeset
8 Darwin|*BSD*)
15650
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
9 # BSD 'date -r' does not print modification time
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
10 # LC_ALL=C sets month/day order and English language in the date string
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
11 # The if in the awk call works around wrong day/month order.
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
12 last_cvs_update=`LC_ALL=C ls -lT CVS/Entries | \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
13 awk '{ \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
14 day=$7; \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
15 month=index(" JanFebMarAprMayJunJulAugSepOctNovDec", $6); \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
16 if(month==0) { \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
17 day=$6; \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
18 month=index(" JanFebMarAprMayJunJulAugSepOctNovDec",$7); } \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
19 printf("%s%.02d%.02d-%s", \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
20 substr($9, 3, 2), (month+1)/3, day, substr($8, 0, 5)); \
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
21 }'`
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
22 ;;
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
23 *)
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
24 last_cvs_update=`date +%y%m%d-%H:%M`
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
25 ;;
8687
93694559178c better BSD/OS support by Steven Schultz <sms@2bsd.com>
alex
parents: 7448
diff changeset
26 esac
3292
7fa3a928631a not it looks like this 'MPlayer CVS-011203-19:47-gcc-2.95.3'
jaf
parents: 1621
diff changeset
27
7447
a49219323787 moved to to avoid CVS-XXYYZZ- versions (if no given) - altought this comment is bigger than the patch :)
alex
parents: 5949
diff changeset
28 extra=""
7448
b464616d40b5 Should be: if test ; then - D Richard Felker III <dalias@aerifal.cx>
alex
parents: 7447
diff changeset
29 if test "$1" ; then
15650
5c5219508907 tabs --> spaces indentation cosmetics
diego
parents: 15649
diff changeset
30 extra="-$1"
7447
a49219323787 moved to to avoid CVS-XXYYZZ- versions (if no given) - altought this comment is bigger than the patch :)
alex
parents: 5949
diff changeset
31 fi
10421
b522f0f85387 the trailing space isn't needed anymore
alex
parents: 9374
diff changeset
32 echo "#define VERSION \"dev-CVS-${last_cvs_update}${extra}\"" >version.h