can't offer in room without DivineMaster
[k8-i-v-a-n.git] / 0build.sh
blob1ab3eb273eafa834d3b8d8a3f603ddd144457349
1 #!/bin/sh
2 # WARNING! SHITTY CODE!
5 defines="-DSGAME_SHOTS_IPU -DWIZARD -DLOCAL_SAVES"
6 cflags="-Wno-narrowing -Isrc/felib"
7 lflags="-lm"
8 objects=""
9 have_package=""
12 find_package() {
13 if [ "z$2" != "z" ]; then
14 pkg-config --silence-errors $1 --atleast-version=$2
15 else
16 pkg-config --silence-errors $1
18 if [ "$?" = "0" ]; then
19 cflags="${cflags} `pkg-config $1 --cflags`"
20 lflags="${lflags} `pkg-config $1 --libs`"
21 #echo "MSG: package '$1' found"
22 have_package="tan"
23 else
24 #echo "MSG: no package '$1'"
25 have_package="ona"
30 # $1: srcdir
31 # $2: srcfile
32 # $3: use gcc if not empty
33 compile() {
34 local obj
36 obj=`basename $2 .cpp`
37 obj=`basename $obj .c`
38 obj="${obj}.o"
39 echo "CC $2"
40 obj="_build/${obj}"
41 objects="${objects} ${obj}"
42 gcc -pipe -c -O2 -Wall ${defines} ${cflags} -o ${obj} "$1/$2"
43 if [ "$?" != "0" ]; then
44 echo "FATAL: compilation failed!"
45 exit 1
50 link() {
51 echo "LINK ivan"
52 g++ -pipe -s -o ivan ${objects} ${lflags}
53 if [ "$?" != "0" ]; then
54 echo "FATAL: linking failed!"
55 exit 1
60 find_package sdl 1.2
61 if [ "$have_package" != "tan" ]; then
62 echo "FATAL: you need SDL development package installed, version 1.2 or above!"
63 exit 1
66 find_package SDL_mixer 1.2
67 if [ "$have_package" != "tan" ]; then
68 echo "MSG: no SDL_mixer package found, sound disabled"
69 defines="${defines} -DDISABLE_SOUND"
70 else
71 echo "MSG: sound support enabled"
74 find_package imlib2 1.4
75 if [ "$have_package" = "tan" ]; then
76 defines="${defines} -DHAVE_IMLIB2"
77 echo "MSG: imlib2 found"
80 find_package zlib 1.2
81 if [ "$have_package" = "tan" ]; then
82 defines="${defines} -DUSE_ZLIB"
83 echo "MSG: compressed saves enabled"
86 #find_package libpng 1.5
87 #if [ "$have_package" = "tan" ]; then
88 # defines="${defines} -DHAVE_LIBPNG"
89 #fi
92 mkdir _build 2>/dev/null
94 compile src/felib bitmap.cpp
95 compile src/felib config.cpp
96 compile src/felib error.cpp
97 compile src/felib feio.cpp
98 compile src/felib felist.cpp
99 compile src/felib femain.cpp
100 compile src/felib femath.cpp
101 compile src/felib festring.cpp
102 compile src/felib fetime.cpp
103 compile src/felib graphics.cpp
104 compile src/felib hscore.cpp
105 compile src/felib rawbit.cpp
106 compile src/felib fesave.cpp
107 compile src/felib whandler.cpp
108 compile src/felib regex.c
110 compile src/game actset.cpp
111 compile src/game areaset.cpp
112 compile src/game charset.cpp
113 compile src/game charsset.cpp
114 compile src/game command.cpp
115 compile src/game coreset.cpp
116 compile src/game dataset.cpp
117 compile src/game dungeon.cpp
118 compile src/game game.cpp
119 compile src/game godset.cpp
120 compile src/game iconf.cpp
121 compile src/game id.cpp
122 compile src/game igraph.cpp
123 compile src/game itemset.cpp
124 compile src/game levelset.cpp
125 compile src/game main.cpp
126 compile src/game materset.cpp
127 compile src/game message.cpp
128 compile src/game object.cpp
129 compile src/game roomset.cpp
130 compile src/game script.cpp
131 compile src/game slotset.cpp
132 compile src/game trapset.cpp
133 compile src/game wmapset.cpp
134 compile src/game wskill.cpp
136 link