comparison libposix/mk-tarball @ 14112:aa63a2324d15

add script to make libposix distribution
author Bruce Korb <bkorb@gnu.org>
date Wed, 17 Nov 2010 13:02:52 -0800
parents
children a852b7d09546
comparison
equal deleted inserted replaced
14111:bd4da34974de 14112:aa63a2324d15
1 #! /bin/sh
2 # -*- Mode: Shell-script -*-
3
4 # Copyright (C) 2002-2010 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
18
19 case "$0" in
20 */* ) progdir=`echo "$0" | sed 's@/[^/]*$@@'`
21 cd ${progdir}
22 progdir=`pwd`
23 prognam=`echo "$0" | sed 's@.*/@@'`
24 ;;
25
26 * ) progdir=`pwd`
27 prognam="$0"
28 ;;
29 esac
30
31 # kill the patriarch process. If we are not the patriarch,
32 # then exit 1 too.
33 #
34 func_die()
35 {
36 echo "${prognam} failure: $*" >&2
37 kill -${SIGTERM} ${progpid}
38 exit 1
39 }
40
41 func_init()
42 {
43 progpid=$$
44 glibdir=`cd .. >/dev/null ; pwd`
45 SIGTERM=15
46
47 git --version >/dev/null 2>&1 \
48 || func_die "git is not operational"
49
50 case "$*" in
51 *'--clean'* )
52 git clean -f -x -d .
53 ;;
54 esac
55 }
56
57 func_mkver()
58 {
59 {
60 echo '/*'
61 sed '1,/^$/d;s/^#/ */;/http:\/\/www\.gnu\.org/q' ${prognam}
62 echo ' */'
63
64 gv=`../build-aux/git-version-gen .tarball-version | \
65 sed 's/-dirty/-modified/'`
66 sedcmd='/^2[01][0-9][0-9]-[0-1][0-9]-[0-3][0-9] /{
67 s/ .*//
68 s/-/./gp
69 q
70 }'
71 dv=`sed -n "${sedcmd}" ${glibdir}/ChangeLog`
72 cat <<-_EOF_
73 #ifndef LIBPOSIX_GIT_VERSION
74 #define LIBPOSIX_GIT_VERSION "$gv"
75 #define LIBPOSIX_VERSION "$dv"
76
77 extern char const libposix_git_version[];
78 extern char const libposix_version[];
79 #endif /* LIBPOSIX_GIT_VERSION */
80 _EOF_
81 } > lib/version.h
82
83 {
84 sed -n '1,/^ \*\/$/p' lib/version.h
85
86 cat <<-_EOF_
87 #include "version.h"
88
89 char const libposix_git_version[] = LIBPOSIX_GIT_VERSION;
90 char const libposix_version[] = LIBPOSIX_VERSION;
91 _EOF_
92
93 } > lib/version.c
94 }
95
96 func_bootstrap()
97 {
98 /bin/sh ./bootstrap \
99 || func_die bootstrap failure
100 }
101
102 func_mkdistro()
103 {
104 mkdir _b || die mkdir _b
105 cd _b
106 ../configure || die configure
107 make || die make
108 make distcheck || die make distcheck
109 mv libposix*.tar.gz .. || die cannot move tarball
110 }
111
112 func_init ${1+"$@"}
113 func_mkver
114 func_bootstrap
115 func_mkdistro
116
117 :