Fix and improve build script
This commit is contained in:
parent
ccc354bd22
commit
0e04030131
|
@ -1,2 +1,2 @@
|
||||||
build*
|
.build*
|
||||||
|
|
||||||
|
|
24
build.sh
24
build.sh
|
@ -1,36 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -Ilib/font_renderer"
|
cflags="-Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -Ilib/font_renderer"
|
||||||
cxxflags="-Wall -O3 -g -std=c++03 -fno-exceptions -fno-rtti -Isrc -Ilib/font_renderer"
|
cflags+=" $(pkg-config --cflags lua5.2) $(sdl2-config --cflags)"
|
||||||
libcflags=
|
|
||||||
lflags="-static-libgcc -static-libstdc++"
|
lflags="-static-libgcc -static-libstdc++"
|
||||||
for package in libagg freetype2 lua5.2; do
|
for package in libagg freetype2 lua5.2; do
|
||||||
libcflags+=" $(pkg-config --cflags $package)"
|
|
||||||
lflags+=" $(pkg-config --libs $package)"
|
lflags+=" $(pkg-config --libs $package)"
|
||||||
done
|
done
|
||||||
libcflags+=" $(sdl2-config --cflags)"
|
|
||||||
lflags+=" $(sdl2-config --libs) -lm"
|
lflags+=" $(sdl2-config --libs) -lm"
|
||||||
|
|
||||||
if [[ $* == *windows* ]]; then
|
if [[ $* == *windows* ]]; then
|
||||||
echo "cross compiling for windows is not yet supported"
|
echo "cross compiling for windows is not yet supported"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
platform="unix"
|
|
||||||
outfile="lite"
|
outfile="lite"
|
||||||
compiler="gcc"
|
compiler="gcc"
|
||||||
cxxcompiler="g++"
|
cxxcompiler="g++"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "compiling ($platform)..."
|
lib/font_renderer/build.sh || exit 1
|
||||||
for f in `find src -name "*.c"`; do
|
libs=libfontrenderer.a
|
||||||
$compiler -c $cflags $f -o "${f//\//_}.o" $libcflags
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
got_error=true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in `find lib -name "*.cpp"`; do
|
echo "compiling lite..."
|
||||||
$cxxcompiler -c $cxxflags $f -o "${f//\//_}.o" $libcflags
|
for f in `find src -name "*.c"`; do
|
||||||
|
$compiler -c $cflags $f -o "${f//\//_}.o"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
got_error=true
|
got_error=true
|
||||||
fi
|
fi
|
||||||
|
@ -38,10 +30,10 @@ done
|
||||||
|
|
||||||
if [[ ! $got_error ]]; then
|
if [[ ! $got_error ]]; then
|
||||||
echo "linking..."
|
echo "linking..."
|
||||||
$cxxcompiler -o $outfile *.o $lflags
|
$cxxcompiler -o $outfile *.o $libs $lflags
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "cleaning up..."
|
echo "cleaning up..."
|
||||||
rm *.o
|
rm *.o *.a
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cxxcompiler="g++"
|
||||||
|
cxxflags="-Wall -O3 -g -std=c++03 -fno-exceptions -fno-rtti -Isrc -Ilib/font_renderer"
|
||||||
|
cxxflags+=" -DFONT_RENDERER_HEIGHT_HACK"
|
||||||
|
for package in libagg freetype2; do
|
||||||
|
cxxflags+=" $(pkg-config --cflags $package)"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "compiling font renderer library..."
|
||||||
|
|
||||||
|
for f in `find lib -name "*.cpp"`; do
|
||||||
|
$cxxcompiler -c $cxxflags $f -o "${f//\//_}.o"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
got_error=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $got_error ]]; then
|
||||||
|
rm -f *.o
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ar -rcs libfontrenderer.a *.o
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
echo "font renderer library created"
|
Loading…
Reference in New Issue