diff --git a/simple-build/simple-build.sh b/simple-build/simple-build.sh index 94b634d..6bcc9d5 100755 --- a/simple-build/simple-build.sh +++ b/simple-build/simple-build.sh @@ -2,19 +2,21 @@ set -e +# build options DEPS="sdl2 SDL2_mixer SDL2_image freetype2" CFLAGS="$CFLAGS -DNDEBUG -fPIC -O3 `pkg-config --cflags $DEPS`" LDFLAGS="$LDFLAGS -lm -lGL `pkg-config --libs $DEPS`" +BUILDDIR="$PWD" +# just helping function function echodo() { echo "$@" "$@" } -BUILDDIR="$PWD" - +# compile files mkdir -p src cd .. for file in src/*.c src/*.S; do @@ -22,13 +24,21 @@ for file in src/*.c src/*.S; do done cd "$BUILDDIR" + +# make static library +echodo ar rcs libhelianthus.a src/*.o + + +# make shader library echodo ld src/*.o $LDFLAGS -shared -o libhelianthus.so.0.1.0 echodo ln -s libhelianthus.so.0.1.0 libhelianthus.so.0 echodo ln -s libhelianthus.so.0.1.0 libhelianthus.so -echodo ar rcs libhelianthus.a src/*.o + +# build demo (this ste is not required) echodo ln -sf ../src helianthus echodo ln -sf ../demo/data echodo cc $CFLAGS -I. -I./helianthus ../demo/src/*.c $LDFLAGS "$BUILDDIR/libhelianthus.so" -o demo + echo "done" \ No newline at end of file diff --git a/simple-build/simple-install.sh b/simple-build/simple-install.sh index 1a0a1b1..90f757c 100755 --- a/simple-build/simple-install.sh +++ b/simple-build/simple-install.sh @@ -3,31 +3,33 @@ set -e +# just helping function function echodo() { echo "$@" "$@" } +# take prefix from argument, environment or default (/usr/local) if [ ! -z "$1" ]; then PREFIX="$1" fi - if [ -z "$PREFIX" ]; then PREFIX="/usr/local" fi - echo "install to: $PREFIX" + +# make install dir and determine its absolute path BUILDDIR="$PWD" echodo mkdir -p "$PREFIX" cd "$PREFIX" PREFIX="$PWD" cd "$BUILDDIR" - echo "full path: $PREFIX" +# install headers cd ../src echodo mkdir -p "$PREFIX/include/helianthus/helianthus" echodo cp animation.h colors.h common.h drawing.h font.h framebuffer.h \ @@ -37,10 +39,13 @@ echodo cp helianthus.h helianthus-nk.h \ "$PREFIX/include/helianthus/" cd "$BUILDDIR" + +# install libs and pkgconfig file echodo mkdir -p "$PREFIX/lib/pkgconfig" echodo cp libhelianthus.a libhelianthus.so libhelianthus.so.0 libhelianthus.so.0.1.0 \ "$PREFIX/lib/" echo echo "prefix=$PREFIX" \| cat - helianthus.pc.in > "$PREFIX/lib/pkgconfig/helianthus.pc" echo "prefix=$PREFIX" | cat - helianthus.pc.in > "$PREFIX/lib/pkgconfig/helianthus.pc" + echo "done" \ No newline at end of file