forked from j0r1/EMIPLIB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builddist.sh
executable file
·53 lines (40 loc) · 1.26 KB
/
builddist.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/bash
VERSION_MAJOR=`cat CMakeLists.txt|grep VERSION_MAJOR | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"`
VERSION_MINOR=`cat CMakeLists.txt|grep VERSION_MINOR | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"`
VERSION_DEBUG=`cat CMakeLists.txt|grep VERSION_DEBUG | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"`
VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_DEBUG
LIBNAME=emiplib
TMPDIR=`tempfile`
CURDIR=`pwd`
rm -r $TMPDIR
if ! mkdir $TMPDIR ; then
echo "Couldn't create temporary directory"
exit -1
fi
cd $TMPDIR
TMPDIR=`pwd` # Get the full path
cd $CURDIR
if ! git archive --format tar --prefix=${LIBNAME}-${VERSION}/ HEAD | (cd $TMPDIR && tar xf -) ; then
echo "Couldn't archive repository"
exit -1
fi
cd $TMPDIR/${LIBNAME}-${VERSION}
rm -f `find . -name ".git*"`
rm -f builddist.sh
rm -rf sphinxdoc
rm -f TODO
rm -rf homepage
cd ..
if ! tar cfz ${LIBNAME}-${VERSION}.tar.gz ${LIBNAME}-${VERSION}/ ; then
echo "Couldn't create archive"
exit -1
fi
if ! tar cfj ${LIBNAME}-${VERSION}.tar.bz2 ${LIBNAME}-${VERSION}/ ; then
echo "Couldn't create archive"
exit -1
fi
if ! zip ${LIBNAME}-${VERSION}.zip `find ${LIBNAME}-${VERSION}/` ; then
echo "Couldn't create archive"
exit -1
fi
mv $TMPDIR $CURDIR/