forked from luarocks/luarocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedist
executable file
·75 lines (65 loc) · 1.46 KB
/
makedist
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
#!/bin/sh
if ! [ "$1" ]
then
echo "usage: $0 <version>"
exit 1
fi
if ! [ -d ".git" ]
then
echo "Should be run inside a git repo dir."
exit 1
fi
make clean || exit 1
grep -q "\"$1\"" rockspec || {
echo
echo "Version in rockspec is incorrect. Please fix it."
exit 1
}
grep -q "program_version = \"$1\"" src/luarocks/cfg.lua || {
echo
echo "Version in src/luarocks/cfg.lua is incorrect. Please fix it."
exit 1
}
out="luarocks-$1"
rm -rf "$out"
mkdir "$out"
rm -f "missing_ref"
git ls-files | while read i
do
if [ -f "$i" ]
then
dir=`dirname $i`
mkdir -p "$out/$dir"
cp "$i" "$out/$dir"
if echo "$i" | grep -v "/bin/" | grep -q "^src/"
then
grep -qw `basename "$i"` Makefile || {
echo "Missing ref in makefile: $i"
touch "missing_ref"
exit 1
}
fi
fi
done
if [ -e "missing_ref" ]
then
rm -f "missing_ref"
exit 1
fi
rm -rf "release-unix" "release-windows" "$out.tar.gz" "$out-win32.zip"
mkdir "release-unix"
cp -a "$out" "release-unix"
mkdir "release-windows"
mv "$out" "release-windows/$out-win32"
cd "release-unix/$out"
rm -rf makedist install.bat COPYING_lua COPYING_7z COPYING_win win32 lfw .travis.yml .gitignore
cd ..
tar czvpf ../"$out.tar.gz" "$out"
cd ..
rm -rf "release-unix"
cd "release-windows/$out-win32"
rm -rf makedist Makefile configure lfw .travis.yml .gitignore
cd ..
zip -r ../"$out-win32.zip" "$out-win32"
cd ..
rm -rf "release-windows"