Move *BSD compatibility layer to extra file.
[darkstat] / release.sh
1 #!/bin/sh
2 #
3 # release.sh: script to roll a release tarball of darkstat.
4 # copyright (c) 2006-2011 Emil Mikulic.
5 #
6 # This is for developer use only and lives in the repo but
7 # shouldn't end up in a tarball.
8 #
9 if [ $# -ne 1 ]; then
10 echo "usage: $0 3.0.0rc0" >&2
11 exit 1
12 fi
13
14 NAME=darkstat
15 VERSION="$1"
16
17 files="\
18 AUTHORS \
19 ChangeLog \
20 COPYING.GPL \
21 INSTALL \
22 LICENSE \
23 Makefile.in \
24 NEWS \
25 README \
26 acct.c \
27 acct.h \
28 addr.c \
29 addr.h \
30 bsd.c \
31 bsd.h \
32 cap.c \
33 cap.h \
34 cdefs.h \
35 contrib \
36 conv.c \
37 conv.h \
38 darkstat.8.in \
39 darkstat.c \
40 daylog.c \
41 daylog.h \
42 db.c \
43 db.h \
44 decode.c \
45 decode.h \
46 dns.c \
47 dns.h \
48 err.c \
49 err.h \
50 export-format.txt \
51 graph_db.c \
52 graph_db.h \
53 graphjs.h \
54 hosts_db.c \
55 hosts_db.h \
56 hosts_sort.c \
57 html.c \
58 html.h \
59 http.c \
60 http.h \
61 install-sh \
62 localip.c \
63 localip.h \
64 ncache.c \
65 ncache.h \
66 now.h \
67 opt.h \
68 pidfile.c \
69 pidfile.h \
70 queue.h \
71 static \
72 str.c \
73 str.h \
74 stylecss.h \
75 tree.h \
76 "
77 # end packing list
78
79 say() {
80 echo ==\> "$@" >&2
81 }
82
83 run() {
84 say "$@"
85 "$@" || { say ERROR!; exit 1; }
86 }
87
88 PKG=$NAME-$VERSION
89 say releasing $PKG
90 run make depend
91 run make graphjs.h stylecss.h
92 run autoconf
93 run autoheader
94 run ./config.status
95 run ./test_headers.sh
96 if git status --porcelain | egrep -v '^\?\?' -q; then
97 say ERROR: uncommitted changes:
98 git status
99 exit 1
100 fi
101 run mkdir $PKG
102 run cp -r $files $PKG/.
103 run sed -e "/AC_INIT/s/darkstat, [^,)]*/darkstat, $VERSION/" configure.ac > $PKG/configure.ac
104 say set version: `grep '^AC_INIT' $PKG/configure.ac`
105 (cd $PKG
106 run autoconf
107 run autoheader
108 run rm -r autom4te.cache
109 ) || exit 1
110
111 # package it up
112 run tar chof $PKG.tar $PKG
113 run bzip2 -9vv $PKG.tar
114 say output:
115 ls -l $PKG.tar.bz2
116 say FINISHED!