~ctwm/ctwm/trunk

516.1.4 by Matthew Fuller
Make a sh script to do the translation of version numbers into
1
#!/bin/sh
2
# This spits to stdout; we expect to be redirected.
3
4
src=$1
5
6
# This turns the soruce version.c.in into a version.c.in with the version
7
# numbers from VERSION sub'd in.  The destination is still a .in because
8
# it [potentially] gets VCS info sub'd in as well.
9
546.1.8 by Matthew Fuller
Look for VERSION file above this script, rather than in the source
10
# Assume VERSION is in the dir above us
11
vfile="$(dirname ${0})/../VERSION"
516.1.4 by Matthew Fuller
Make a sh script to do the translation of version numbers into
12
13
# Split the version bits out
14
vstr=`sed -E -e 's/([0-9]+)\.([0-9]+)\.([0-9]+)(.*)/\1 \2 \3 \4/' ${vfile}`
15
set -- junk $vstr
16
shift
17
18
maj=$1
19
min=$2
20
pat=$3
21
add=$4
22
23
24
# And sub
25
sed \
26
	-e "s/@ctwm_version_major@/$maj/" \
27
	-e "s/@ctwm_version_minor@/$min/" \
28
	-e "s/@ctwm_version_patch@/$pat/" \
29
	-e "s/@ctwm_version_addl@/$add/" \
30
	${src}