DEADSOFTWARE

map: move map loading to separate file
[flatwaifu.git] / doom2d_deb_maker
1 #!/bin/bash
2 #
3 # Copyright (C) Andriy Shinkarchuck <adriano32.gnu@gmail.com> 2011
4 #
5 # This file is part of the Doom2D:Rembo project.
6 #
7 # Doom2D:Rembo is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
10 #
11 # Doom2D:Rembo is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <http://www.gnu.org/licenses/> or
18 # write to the Free Software Foundation, Inc.,
19 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #
21 set -e
22 echo "Usage: doom2d_deb_maker <SOURCE_DIR> <DEST_DIR> <PACKAGE_NAME> <VERSION> <ARCH>"
23 echo "<SOURCE_DIR> and <DEST_DIR> should be absolute pathes"
24 WORK_DIR=`pwd`
25 if [ $# -ne 5 ]; then
26 echo "Error: Not enough actual parametres.";
27 echo "Usage: doom2d_deb_maker <SOURCE_DIR> <DEST_DIR> <PACKAGE_NAME> <VERSION> <ARCH>"
28 exit 1
29 else
30 SOURCE_DIR=$1
31 DEST_DIR=$2
32 PACKAGE_NAME=$3
33 VERSION=$4
34 ARCH=$5
35 if [ -d $DEST_DIR ]; then
36 echo $DEST_DIR" is already created. mkdir skipping"
37 else
38 mkdir $DEST_DIR
39 chmod -fR 755 $DEST_DIR
40 echo "mkdir "$DEST_DIR" success"
41 fi
42 if [ "$(ls -A $DEST_DIR)" ]; then
43 echo "Error: "$DEST_DIR" is not empty. Please, check it content and delete if it is unnecesary before starting"
44 exit 1
45 fi
46 if [ -d $SOURCE_DIR ]; then
47 if [ -d $SOURCE_DIR/src ]; then
48 if [ -d $SOURCE_DIR/music ]; then
49 if [ -d $SOURCE_DIR/src/build ]; then
50 rm -rf $SOURCE_DIR/src/build
51 echo "Cleaning "$SOURCE_DIR"/src/build after previous build"
52 fi
53 cd $SOURCE_DIR/src
54 mkdir $SOURCE_DIR/src/build
55 cd $SOURCE_DIR/src/build
56 echo "Compilation of "$PACKAGE_NAME" started"
57 cmake ..
58 make
59 echo "Compilation of "$PACKAGE_NAME" finished succesfully"
60 else
61 echo "Error: Your source tree in "$SOURCE_DIR" is damaged. Check your sources tarball consistency"
62 exit 1
63 fi
64 else
65 echo "Error: Your source tree in "$SOURCE_DIR" is damaged. Check your sources tarball consistency"
66 exit 1
67 fi
68 else
69 echo "Error: "$SOURCE_DIR" not found. Please, check parametres"
70 exit 1
71 fi
72 echo "mkdir debian package folder structure in "$DEST_DIR
73 mkdir $DEST_DIR/DEBIAN
74 mkdir $DEST_DIR/usr
75 mkdir $DEST_DIR/usr/bin
76 mkdir $DEST_DIR/usr/share
77 mkdir $DEST_DIR/usr/share/doom2d-rembo
78 chmod -fR 755 $DEST_DIR/
79 echo "Done"
80 echo "Copying binary and data files"
81 cp -fR $SOURCE_DIR/music $DEST_DIR/usr/share/doom2d-rembo/
82 cp -f $SOURCE_DIR/src/*.wad $DEST_DIR/usr/share/doom2d-rembo/
83 cp -f $SOURCE_DIR/src/*.cfg $DEST_DIR/usr/share/doom2d-rembo/
84 cp -f $SOURCE_DIR/src/build/doom2d $DEST_DIR/usr/bin
85 echo "Done"
86 touch $DEST_DIR/DEBIAN/control
87 echo "control file generating"
88 echo "Package: "$PACKAGE_NAME >> $DEST_DIR/DEBIAN/control
89 echo "Version: "$VERSION >> $DEST_DIR/DEBIAN/control
90 echo "Architecture: "$ARCH >> $DEST_DIR/DEBIAN/control
91 echo "Maintainer: Rembo <arembo@gmail.com>" >> $DEST_DIR/DEBIAN/control
92 echo "Installed-Size: "`du -ks $DEST_DIR/usr/ | grep -o \[0-9\]*` >> $DEST_DIR/DEBIAN/control
93 echo "Depends: libc6 (>= 2.3), libsdl-mixer1.2 (>= 1.2.6), libsdl1.2debian (>= 1.2.10-1)" >> $DEST_DIR/DEBIAN/control
94 echo "Section: games" >> $DEST_DIR/DEBIAN/control
95 echo "Priority: optional" >> $DEST_DIR/DEBIAN/control
96 echo "Homepage: http://code.google.com/p/doom2d-rembo/" >> $DEST_DIR/DEBIAN/control
97 echo "Description: Doom2D:Rembo is a Linux port of Doom2D game," >> $DEST_DIR/DEBIAN/control
98 echo " free DOS two-dimensional arcade created by" >> $DEST_DIR/DEBIAN/control
99 echo " Russian video game company \"Prikol Software\"" >> $DEST_DIR/DEBIAN/control
100 echo " in early 1996 being inspired by original DOOM game by id Software." >> $DEST_DIR/DEBIAN/control
101 echo "Done"
102 ARCHIVE_NAME=$PACKAGE_NAME"_"$VERSION"_"$ARCH.deb
103 fakeroot dpkg-deb --build $DEST_DIR $ARCHIVE_NAME
104 echo $ARCHIVE_NAME" was created succesfully at "$SOURCE_DIR"/src/build/"
105 fi