irc/packmod.sh

70 lines
1.5 KiB
Bash
Raw Normal View History

2012-12-01 04:06:15 +01:00
#! /bin/sh
echo "Detecting directories...";
if [ -f "CMakeLists.txt" ]; then
srcdir=".";
bindir="Build";
elif [ -f "../CMakeLists.txt" ]; then
srcdir="..";
bindir=".";
else
echo "Error: Couldn't find CMakeLists.txt." >&2;
exit 1;
fi
if [ -e "$bindir/src/luasocket/libluasocket.dll" ]; then
2012-12-01 20:52:11 +01:00
lib="$bindir/src/luasocket/libluasocket.dll";
2012-12-01 04:06:15 +01:00
elif [ -e "$bindir/src/luasocket/libluasocket.so" ]; then
2012-12-01 20:52:11 +01:00
lib="$bindir/src/luasocket/libluasocket.so";
2012-12-01 04:06:15 +01:00
else
echo "Error: Couldn't find luasocket lib." >&2;
echo " Did you compile before running this script?" >&2;
exit 1;
fi
version="`cat "$srcdir/CMakeLists.txt" \
| grep 'MINETEST_IRC_VERSION' \
2012-12-01 20:52:11 +01:00
| sed -e 's/^set(MINETEST_IRC_VERSION \([^)]*\))/\1/'`";
2012-12-01 04:06:15 +01:00
mkdir "$srcdir/irc-$version";
files_luairc="\
$srcdir/src/luairc/irc.lua
2012-12-01 20:52:11 +01:00
$srcdir/src/luairc/irc
$srcdir/doc/LICENSE-LuaIRC.txt
2012-12-01 04:06:15 +01:00
";
files_luasocket="\
$srcdir/src/luasocket/ftp.lua
$srcdir/src/luasocket/http.lua
$srcdir/src/luasocket/ltn12.lua
$srcdir/src/luasocket/mime.lua
$srcdir/src/luasocket/smtp.lua
$srcdir/src/luasocket/socket.lua
$srcdir/src/luasocket/tp.lua
$srcdir/src/luasocket/url.lua
2012-12-01 20:52:11 +01:00
$srcdir/doc/LICENSE-luasocket.txt
2012-12-01 04:06:15 +01:00
$lib
";
files="\
$srcdir/src/init.lua
2012-12-01 20:52:11 +01:00
$srcdir/README.txt
$srcdir/doc/LICENSE.txt
2012-12-01 04:06:15 +01:00
$files_luairc
$files_luasocket
";
oIFS="$IFS";
IFS='
';
echo "Copying files...";
for file in $files; do
IFS="$oIFS";
2012-12-01 20:52:11 +01:00
cp -fr "$file" "$srcdir/irc-$version/";
2012-12-01 04:06:15 +01:00
done
echo "Operation completed successfully!";
exit 0;