aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/bin/dist
blob: 43c6ef930611fa59c8b1cb7f83f8f341bb6c78e3 (plain)
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
#!/bin/sh

if test ! -f config.dist ; then
	echo "dist: config.dist missing!"
fi

# defaults!

distdir=$1
config="config.dist config.pkg build"
exclude="*.o *.a config.cc config.cache config *.tar.gz *~ core Makefile"
exclude_exe="true"
exclude_files=".EXCLUDE"

. ./config.dist

root=`pwd`
dist=$package'-'$version
cd ..

if test ! $dist = $root ; then
	rm -f $dist
	ln -s $root $dist
fi

xlist=$dist/.EXCLUDE
echo -n >$xlist
for file in $exclude_files ; do
	echo $dist/$file >>$xlist
done

flist=""

for cfg in $include $config ; do
	flist=$flist' '$dist/$cfg
done

for dir in $examine ; do
	flist=$flist' '$dist/$dir
	if test $exclude_exe = "true" ; then
		find $dist/$dir -perm +1 -type f -follow -print >>$xlist
	fi
	for deny in $exclude ; do
		find $dist/$dir -follow -name $deny -print >>$xlist
	done
done

target=$dist/$dist.tar.gz
if test -d $distdir ; then
	rm -f $distdir/${package}*.tar.gz
	target=$distdir/$dist.tar.gz
	if test -f $dist/$package'.lsm' ; then
		cp -f $dist/$package'.lsm' $distdir
	fi
fi

tar -X $xlist -cvhzf $target $flist

if [ ! $dist = $root ] ; then
	rm $dist
fi