1#!/bin/sh
2# makepkg-release
3# Copyright (c) 2000, 2003, 2009 Kriang Lerdsuwanakij
4# email:	lerdsuwa@users.sourceforge.net
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20. scripts/version
21LANG=en_US.UTF-8; export LANG
22BUILD_DIR="/tmp/kcd-build-$USER"; export BUILD_DIR
23BASE_NAME=kcd-$VER; export BASE_NAME
24TREE_DIR=$BUILD_DIR/$BASE_NAME; export TREE_DIR
25RPCP_FILE=$BUILD_DIR/rpcp.replace; export RPCP_FILE
26RPCP_LSM_FILE=$BUILD_DIR/rpcp.replacelsm; export RPCP_LSM_FILE
27
28PKGS_DIR=../pkgs; export PKGS_DIR
29FROM_MAKEPKG=makepkg; export FROM_MAKEPKG
30
31scripts/dircheck || exit 0
32
33# Regenerate HTML files
34make html
35
36# Prepare directories
37rm -rf $BUILD_DIR || exit 0
38mkdir -p $BUILD_DIR
39mkdir -p $TREE_DIR
40
41# Location for final .tar.gz and other files
42if test ! -e $PKGS_DIR; then
43	mkdir -p $PKGS_DIR
44fi
45
46echo "%VERSION% $VER" > $RPCP_FILE
47echo "%RELDATE% `date +"%b %_d, %Y"`" >> $RPCP_FILE
48echo "%RELMONTH% `date +"%-m"`" >> $RPCP_FILE
49echo "%RELDAY% `date +"%-d"`" >> $RPCP_FILE
50echo "%RELYEAR% `date +"%Y"`" >> $RPCP_FILE
51echo "!VERSION! $VER" >> $RPCP_FILE
52echo "!RELDATE! `date +"%b %_d, %Y"`" >> $RPCP_FILE
53echo "%LSMDATE% `date +"%d%b%y"`" | tr a-z A-Z >> $RPCP_FILE
54echo "//#define #define" >> $RPCP_FILE
55
56# Commit all changes
57scripts/commit || exit 0
58
59# Make package
60scripts/makepkg-real
61
62# Tag CVS
63cvs diff && cvs tag ver-`echo $VER|tr . _`
64
65# Cleanup
66rm -rf $BUILD_DIR
67