test
リビジョン | 2fad644e37de093aae1f3f10c2027a2b7228eb04 (tree) |
---|---|
日時 | 2010-03-22 20:12:01 |
作者 | TATEISHI Katsuyuki <kt@whee...> |
コミッター | TATEISHI Katsuyuki |
Merge branch 'autogenversion'
@@ -6,6 +6,8 @@ Makefile.in | ||
6 | 6 | *.la |
7 | 7 | *.so |
8 | 8 | *~ |
9 | +*.gz | |
10 | +/VERSION | |
9 | 11 | /aclocal.m4 |
10 | 12 | /autom4te.cache |
11 | 13 | /autoscan-*log |
@@ -25,3 +27,4 @@ Makefile.in | ||
25 | 27 | /config.sub |
26 | 28 | /libtool |
27 | 29 | /ltmain.sh |
30 | +/ktsandbox.spec |
@@ -1,8 +1,20 @@ | ||
1 | 1 | SUBDIRS = lib src |
2 | 2 | |
3 | 3 | EXTRA_DIST = \ |
4 | + VERSION \ | |
4 | 5 | ktsandbox.spec \ |
5 | - ktsandbox.spec.in | |
6 | + ktsandbox.spec.in \ | |
7 | + genvers.sh | |
8 | + | |
9 | +VERSION: | |
10 | + (cd $(top_srcdir) ;\ | |
11 | + echo `./genvers.sh` $< > $@.new ;\ | |
12 | + mv -f $@.new $@ ;) | |
13 | + | |
14 | +release: | |
15 | + (rm -f $(top_srcdir)/VERSION ;\ | |
16 | + autoreconf -ifv $(top_srcdir) ;\ | |
17 | + $(MAKE) distcheck ;) | |
6 | 18 | |
7 | 19 | rpm: distcheck |
8 | 20 | rpmbuild -ta $(DIST_ARCHIVES) |
@@ -1,8 +1,10 @@ | ||
1 | 1 | # -*- Autoconf -*- |
2 | 2 | # Process this file with autoconf to produce a configure script. |
3 | 3 | |
4 | +define([ktsandbox_ver], esyscmd([./genvers.sh])) | |
5 | + | |
4 | 6 | AC_PREREQ(2.59) |
5 | -AC_INIT(ktsandbox, 0.0.3, kt@wheel.jp) | |
7 | +AC_INIT([ktsandbox], ktsandbox_ver, [kt@wheel.jp]) | |
6 | 8 | AC_CONFIG_SRCDIR([config.h.in]) |
7 | 9 | AC_CONFIG_HEADERS([config.h]) |
8 | 10 | AM_INIT_AUTOMAKE([foreign]) |
@@ -0,0 +1,117 @@ | ||
1 | +#!/bin/sh | |
2 | +# | |
3 | +# Copyright (c) 2010 TATEISHI Katsuyuki <kt@wheel.jp> | |
4 | +# All rights reserved. | |
5 | +# | |
6 | +# Redistribution and use in source and binary forms, with or without | |
7 | +# modification, are permitted provided that the following conditions | |
8 | +# are met: | |
9 | +# 1. Redistributions of source code must retain the above copyright | |
10 | +# notice, this list of conditions and the following disclaimer. | |
11 | +# 2. Redistributions in binary form must reproduce the above copyright | |
12 | +# notice, this list of conditions and the following disclaimer in the | |
13 | +# documentation and/or other materials provided with the distribution. | |
14 | +# | |
15 | +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
16 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
19 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
21 | +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
22 | +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
23 | +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
24 | +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
25 | +# SUCH DAMAGE. | |
26 | +# | |
27 | +# | |
28 | +# NAME | |
29 | +# genvers.sh | |
30 | +# | |
31 | +# SYNOPSIS | |
32 | +# genvers.sh [_file_] | |
33 | +# | |
34 | +# DESCRIPTION | |
35 | +# genvers.sh is a script to generate a version number from the result of | |
36 | +# "git describe" and output to stdout and the _file_. If _file_ is not | |
37 | +# given, 'VERSION' is used instead. | |
38 | +# | |
39 | +# This script requires git command and the project managed with git. It | |
40 | +# also requires that the project already have at least one annotation tag | |
41 | +# to run this script properly. If the 'VERSION' file is already existed, | |
42 | +# it works even in non-git managed environment(ex. released tarball | |
43 | +# user's environment). | |
44 | +# | |
45 | +# EXAMPLES | |
46 | +# To generate version number automatically when autoreconf -if, put the | |
47 | +# following code into your configure.ac: | |
48 | +# ---------------------------------------------------------------- | |
49 | +# define([foobar_ver], esyscmd([./genvers.sh])) | |
50 | +# | |
51 | +# AC_PREREQ([2.xx]) | |
52 | +# AC_INIT([foobar], foobar_ver, [you@example.org]) | |
53 | +# ---------------------------------------------------------------- | |
54 | +# | |
55 | +# And to use generated version number for "make distcheck", put the | |
56 | +# following code into your Makefile.am on $(top_srcdir): | |
57 | +# ---------------------------------------------------------------- | |
58 | +# EXTRA_DIST = VERSION genvers.sh | |
59 | +# | |
60 | +# VERSION: | |
61 | +# (cd $(top_srcdir) ;\ | |
62 | +# echo `./genvers.sh` $< > $@.new ;\ | |
63 | +# mv -f $@.new $@ ;) | |
64 | +# | |
65 | +# release: | |
66 | +# (rm -f $(top_srcdir)/VERSION ;\ | |
67 | +# autoreconf -ifv $(top_srcdir) ;\ | |
68 | +# $(MAKE) distcheck ;) | |
69 | +# ---------------------------------------------------------------- | |
70 | +# Be sure to do "autoreconf -if" before "make distcheck". | |
71 | +# | |
72 | +# You can make a new release archive with the new version number: | |
73 | +# | |
74 | +# % git tag -a 1.0.0 -m "Release 1.0.0" | |
75 | +# % autoreconf -if | |
76 | +# % make distcheck | |
77 | +# | |
78 | +# Then, you'll see the new release file as "foobar-1.0.0.tar.gz". | |
79 | +# (Of course you must make 'make distcheck' worked before this step.) | |
80 | +# | |
81 | + | |
82 | +if test -n "$1"; then | |
83 | + VERSION_FILE=$1 | |
84 | +else | |
85 | + VERSION_FILE=VERSION | |
86 | +fi | |
87 | + | |
88 | +if test -f $VERSION_FILE; then | |
89 | + VERSION=`cat $VERSION_FILE` | |
90 | +fi | |
91 | + | |
92 | +DESC=`git describe 2>/dev/null | grep '^v[0-9]*' | sed -e 's/^v//; s/-/./g;'` | |
93 | +if test -z "$DESC"; then | |
94 | + # You must be an user | |
95 | + if test -n "$VERSION"; then | |
96 | + echo -n $VERSION | |
97 | + else | |
98 | + echo -n noversionfound | |
99 | + echo " Maybe $VERSION_FILE is missing" >&2 | |
100 | + fi | |
101 | + exit 0 | |
102 | +fi | |
103 | + | |
104 | +# dirty check | |
105 | +DIRTY=`git status |grep -E '^# Change(s to be committed|d but not updated):'` | |
106 | +if test -n "$DIRTY"; then | |
107 | + DIRTY=".dirty" | |
108 | +fi | |
109 | + | |
110 | +VERSION_NEW=$DESC$DIRTY | |
111 | +if test "x$VERSION" != "x$VERSION_NEW"; then | |
112 | + VERSION=$VERSION_NEW | |
113 | + echo $VERSION > $VERSION_FILE.new | |
114 | + mv $VERSION_FILE.new $VERSION_FILE | |
115 | +fi | |
116 | + | |
117 | +echo -n $VERSION |