-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.sh
executable file
·51 lines (39 loc) · 1.03 KB
/
archive.sh
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
#!/bin/sh
set -e
set -u
VERSION="$(grep '\s*VERSION=' OMakefile | sed -r 's#.*=([^\s]+)#\1#')"
NAME="$(grep '\s*PROJNAME=' OMakefile | sed -r 's#.*=([^\s]+)#\1#')"
pkg="${NAME}-${VERSION}"
curdir="$(readlink -f "$0")"
curdir="$(dirname "$curdir")"
cd "$curdir"
omake distclean
mtmpf="$(mktemp -d)"
trap "rm -rf \"${mtmpf}\"" EXIT
if which gtar >/dev/null 2>&1 ; then
tar=gtar
else
tar=tar
fi
stash="$(git stash create)"
git archive --format=tar ${stash:-HEAD} | ( cd "$mtmpf" ; tar -xf- )
cd src
autoreconf -fi
cp -p config.h.in configure "${mtmpf}/src"
cd ..
omake _oasis
oasis setup
cp -p setup.ml _oasis "$mtmpf"
if which gfind >/dev/null 2>&1 ; then
find=gfind
else
find=find
fi
cd "$mtmpf"
$find . -type f ! -executable ! -perm 644 -exec chmod 644 {} \+
$find . -type f -executable ! -perm 755 -exec chmod 755 {} \+
$find . -type d ! -perm 755 -exec chmod 755 {} \+
$tar --transform "s|^.|${pkg}|" --format=ustar --numeric-owner -cf- . | \
gzip -9 > "${curdir}/${pkg}.tar.gz"
omake all >/dev/null 2>&1
omake quick-test