vg2 port: build script and resource loading
[fishladder.git] / build.sh
index 598e7fe57473fad96f2c69f7d71b5c0431735c27..d807648f5c4c0b8567c1d98974b8037da16bbe8d 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,84 +1 @@
-# Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
-
-src="fishladder.c"
-target="fishladder"
-lib="-I. -L./lib -L./"
-libs="-lGL -lglfw -lX11 -lXxf86vm -lXrandr -lm -lpthread -lXi -ldl" # -l:steam/libsteam_api.so"
-flags="-fsanitize=address -ggdb3 -Wno-unused-function -DNO_STEAM"
-
-if [[ "$OSTYPE" != "linux-gnu"* ]]; then
-       echo "Operating system is not GNU/Linux, windows will be assumed."
-       target="fishladder.exe"
-       libs="-lglfw3 -lopengl32 -lm -mwindows"
-       flags="-ggdb3 -Wno-unused-function -DNO_STEAM"
-fi
-
-run_after=false
-do_build=true
-
-while (( "$#" )); do
-       case $1 in
-               -r|--release) 
-                       flags="-O3"
-                       echo "Release mode" 
-               ;;
-               -p|--play)
-                       run_after=true 
-                       echo "& Run" 
-               ;;
-               -n|--nobuild)
-                       do_build=false
-                       echo "no-build"
-               ;;
-               *) 
-                       echo "Unkown param: $1" 
-                       exit 1
-               ;;
-       esac
-       shift
-done
-
-# Main build
-if [ "$do_build" = true ]; then
-       gcc -Wall -Wstrict-aliasing=3 $lib $flags $src gl/glad.c -o $target $libs -Wl,-rpath=./ $defines
-
-       if [ $? -ne 0 ]; then
-               echo "GCC build failed"
-               exit 1
-       fi
-
-       echo "Build succeeded"
-fi
-
-if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-       # Directories to initialize
-       mkdir build.linux/cfg -p
-       mkdir build.linux/textures -p
-
-       cp $target ./build.linux/$target
-       cp ./steam/libsteam_api.so ./build.linux/libsteam_api.so
-       cp -r ./textures/ ./build.linux/
-
-       if [ "$run_after" = true ]; then
-               echo "Playing"
-
-               cd ./build.linux/
-               ./$target
-               cd ./../
-       fi
-else
-       mkdir build.win32/cfg -p
-       mkdir build.win32/textures -p
-       
-       cp $target ./build.win32/$target
-       cp -r ./textures/ ./build.win32/
-       cp ./lib/glfw3.dll ./build.win32/glfw3.dll
-       
-       if [ "$run_after" = true ]; then
-               echo "Playing"
-               
-               cd ./build.win32/
-               ./$target
-               cd ./../
-       fi
-fi
\ No newline at end of file
+clang -fsanitize=address -O0 -I./vg build.c -o /tmp/tmpsr && /tmp/tmpsr $@