-
Notifications
You must be signed in to change notification settings - Fork 3
/
mktarball
executable file
·77 lines (68 loc) · 2.05 KB
/
mktarball
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
set_timestamps () {
local dir="$1"
local tag="$2"
local projver="$3"
(cd $projver && find * -type f -print) |
while IFS= read -r file
do
touch -t $(cd $dir && git rev-list --format=format:%ai -n1 $tag -- $file |
sed '/^commit/d;s/ [-+].*$//;s/[- :]//g;s/\(..\)$/.\1/') $projver/$file
done
}
dir=$1
tag=$2
tarsuffix=$3
projver=${dir##*/}-$tag
htscodecs_version=""
case $dir in
*/htslib)
if [ -e "$dir/.git/modules/htscodecs" ] ; then
cat > "$dir/.git/modules/htscodecs/info/attributes" <<'EOF'
/.* export-ignore
/javascript export-ignore
/m4 export-ignore
/README.md export-ignore
*Makefile.am export-ignore
configure* export-ignore
EOF
description=$(cd $dir/htscodecs && git describe --match 'v[0-9].[0-9]*' --dirty --always)
htscodecs_version=${description##v}
fi
;;
esac
rm -rf $projver
(cd $dir && git archive --prefix=$projver/ $tag) | tar -x
set_timestamps $dir $tag $projver
(cd $dir && git ls-tree $tag) |
while read -r mode objtype hash item
do
if test "$objtype" = "commit" ; then
(cd "$dir/$item" && git archive --prefix="$projver/$item/" "$hash" ) |
tar -x
set_timestamps "$dir/$item" "$hash" "$projver/$item"
fi
done
case $dir in
*/htslib)
if [ "x$htscodecs_version" != "x" -a -e "$projver/htscodecs/htscodecs" ] ; then
echo '#define HTSCODECS_VERSION_TEXT "'"$htscodecs_version"'"' > "$projver/htscodecs/htscodecs/version.h"
fi
;;
esac
if test -f $projver/configure.ac
then
(cd $projver
touch config.mk
unset MAKEFLAGS MAKELEVEL MAKEOVERRIDES MFLAGS
# grep -q AX_ configure.ac && (grep -q m4_include configure.ac || aclocal)
# test -e config.h.in || autoheader
# autoconf --warnings=all
autoreconf -i --warnings=all
rm -rf autom4te.cache config.mk)
# Look for unexpanded autoconf macros
egrep '^[^#]*\<A[A-Z]_[A-Z_]*' $projver/configure && exit 1
fi
rm -f $projver$tarsuffix.tar.bz2
tar --mode=ug=rwX --mode=o=rX --owner=0 --group=0 -cjf $projver$tarsuffix.tar.bz2 $projver
rm -r $projver