2020-05-09 12:01:28 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-12-03 16:46:18 +01:00
|
|
|
cflags+="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -Ilib/font_renderer"
|
2020-06-18 15:53:31 +02:00
|
|
|
cflags+=" $(pkg-config --cflags lua5.2) $(sdl2-config --cflags)"
|
2020-06-17 23:51:52 +02:00
|
|
|
lflags="-static-libgcc -static-libstdc++"
|
2021-05-28 18:14:40 +02:00
|
|
|
for package in libagg freetype2 lua5.2 x11 libpcre2-8 reproc; do
|
2020-06-17 23:11:39 +02:00
|
|
|
lflags+=" $(pkg-config --libs $package)"
|
|
|
|
done
|
|
|
|
lflags+=" $(sdl2-config --libs) -lm"
|
2020-05-09 12:01:28 +02:00
|
|
|
|
|
|
|
if [[ $* == *windows* ]]; then
|
2020-06-17 23:11:39 +02:00
|
|
|
echo "cross compiling for windows is not yet supported"
|
|
|
|
exit 1
|
2020-05-09 12:01:28 +02:00
|
|
|
else
|
|
|
|
outfile="lite"
|
|
|
|
compiler="gcc"
|
2020-06-17 23:11:39 +02:00
|
|
|
cxxcompiler="g++"
|
2020-05-09 12:01:28 +02:00
|
|
|
fi
|
|
|
|
|
2020-06-18 15:53:31 +02:00
|
|
|
lib/font_renderer/build.sh || exit 1
|
|
|
|
libs=libfontrenderer.a
|
2020-06-17 23:11:39 +02:00
|
|
|
|
2020-06-18 15:53:31 +02:00
|
|
|
echo "compiling lite..."
|
|
|
|
for f in `find src -name "*.c"`; do
|
|
|
|
$compiler -c $cflags $f -o "${f//\//_}.o"
|
2020-05-09 12:01:28 +02:00
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
got_error=true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ! $got_error ]]; then
|
|
|
|
echo "linking..."
|
2020-06-18 15:53:31 +02:00
|
|
|
$cxxcompiler -o $outfile *.o $libs $lflags
|
2020-05-09 12:01:28 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "cleaning up..."
|
2020-06-18 15:53:31 +02:00
|
|
|
rm *.o *.a
|
2020-05-09 12:01:28 +02:00
|
|
|
echo "done"
|
2020-06-17 23:11:39 +02:00
|
|
|
|