Add a script for building always.php to include DB version also.

This commit is contained in:
Andrew McMillan 2009-10-27 09:17:07 +13:00
parent 06b1cdbe68
commit e6507ee01f
2 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/make -f
#
#
package=davical
version=$(shell cat VERSION)
@ -17,24 +17,24 @@ built-po: built-docs inc/always.php scripts/po/rebuild-translations.sh scripts/p
#
# Insert the current version number into always.php
#
inc/always.php: VERSION inc/always.php.in
sed -e "/^ *.c->version_string *= *'[^']*' *;/ s/^ *.c->version_string *= *'[^']*' *;/\$$c->version_string = '`head -n1 VERSION`';/" <inc/always.php.in >inc/always.php
inc/always.php: scripts/build-always.sh VERSION dba/davical.sql inc/always.php.in
scripts/build-always.sh <inc/always.php.in >inc/always.php
#
# Build a release .tar.gz file in the directory above us
#
release: built-docs
release: built-docs VERSION
-ln -s . $(package)-$(version)
tar czf ../$(package)-$(version).tar.gz \
--no-recursion --dereference $(package)-$(version) \
$(shell git ls-files |grep -v '.git'|sed -e s:^:$(package)-$(version)/:) \
$(shell find $(package)-$(version)/docs/api/ ! -name "phpdoc.ini" )
rm $(package)-$(version)
clean:
rm -f built-docs built-po
-find . -name "*~" -delete
clean-all: clean
-find docs/api/* ! -name "phpdoc.ini" ! -name ".gitignore" -delete

10
scripts/build-always.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
#
# Apply the current version numbers into always.php from always.php.in
#
DAVICAL_VERSION="`head -n1 VERSION`"
DB_VERSION="`grep 'SELECT new_db_revision' dba/davical.sql | cut -f2 -d'(' | cut -f1-3 -d,`"
sed -e "/^ *.c->version_string *= *'[^']*' *;/ s/^ *.c->version_string *= *'[^']*' *;/\$c->version_string = '${DAVICAL_VERSION}';/" \
-e "/^ *.c->want_dbversion *=.*$/ s/^ *.c->want_dbversion *=.*$/\$c->want_dbversion = array(${DB_VERSION});/"