From 4e51e8664989c79e9470855b25516fb2714ab7eb Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Feb 24 2025 19:15:12 +0000 Subject: simple build --- diff --git a/simple-build/.gitignore b/simple-build/.gitignore new file mode 100644 index 0000000..68b19cc --- /dev/null +++ b/simple-build/.gitignore @@ -0,0 +1,6 @@ +src +*.a +*.so* +helianthus +data +demo diff --git a/simple-build/helianthus.pc.in b/simple-build/helianthus.pc.in new file mode 100644 index 0000000..ef6bb73 --- /dev/null +++ b/simple-build/helianthus.pc.in @@ -0,0 +1,11 @@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include/helianthus + +Name: helianthus +Description: Helianthus is a library to create small games +Requires: sdl2 SDL2_mixer SDL2_image freetype2 +Version: 0.1.0 +Libs: -L${libdir} -lhelianthus -lGL +Cflags: -I${includedir} + diff --git a/simple-build/simple-build.sh b/simple-build/simple-build.sh new file mode 100755 index 0000000..94b634d --- /dev/null +++ b/simple-build/simple-build.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +DEPS="sdl2 SDL2_mixer SDL2_image freetype2" +CFLAGS="$CFLAGS -DNDEBUG -fPIC -O3 `pkg-config --cflags $DEPS`" +LDFLAGS="$LDFLAGS -lm -lGL `pkg-config --libs $DEPS`" + + +function echodo() { + echo "$@" + "$@" +} + + +BUILDDIR="$PWD" + +mkdir -p src +cd .. +for file in src/*.c src/*.S; do + echodo cc -c $CFLAGS "$file" -o "$BUILDDIR/$file.o" +done +cd "$BUILDDIR" + +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 + +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-clean.sh b/simple-build/simple-clean.sh new file mode 100755 index 0000000..d48a7f7 --- /dev/null +++ b/simple-build/simple-clean.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +rm -r src *.a *.so* +rm helianthus data demo + diff --git a/simple-build/simple-install.sh b/simple-build/simple-install.sh new file mode 100755 index 0000000..1a0a1b1 --- /dev/null +++ b/simple-build/simple-install.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + + +function echodo() { + echo "$@" + "$@" +} + + +if [ ! -z "$1" ]; then + PREFIX="$1" +fi + +if [ -z "$PREFIX" ]; then + PREFIX="/usr/local" +fi + +echo "install to: $PREFIX" + +BUILDDIR="$PWD" +echodo mkdir -p "$PREFIX" +cd "$PREFIX" +PREFIX="$PWD" +cd "$BUILDDIR" + +echo "full path: $PREFIX" + + +cd ../src +echodo mkdir -p "$PREFIX/include/helianthus/helianthus" +echodo cp animation.h colors.h common.h drawing.h font.h framebuffer.h \ + group.h nuklear.h nuklear-heli.h sound.h sprite.h window.h \ + "$PREFIX/include/helianthus/helianthus/" +echodo cp helianthus.h helianthus-nk.h \ + "$PREFIX/include/helianthus/" +cd "$BUILDDIR" + +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