1 # Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
6 libs
="-lGL -lglfw -lX11 -lXxf86vm -lXrandr -lm -lpthread -lXi -ldl -l:steam/libsteam_api.so"
7 flags
="-fsanitize=address -ggdb3 -Wno-unused-function"
8 build_dir
="build.linux"
9 steam_api
="libsteam_api.so"
11 if [[ "$OSTYPE" != "linux-gnu"* ]]; then
12 echo "Operating system is not GNU/Linux, windows will be assumed."
14 target
="fishladder.exe"
15 libs
="-lglfw3 -lopengl32 -lm -mwindows -l:steam/steam_api.dll"
16 flags
="-ggdb3 -Wno-unused-function"
17 build_dir
="build.win32"
18 steam_api
="steam_api.dll"
29 flags
="-O3 -Wno-unused-function"
49 echo "Unkown param: $1"
57 if [ "$compile_tools" = true
]; then
60 gcc
-Wall -Wstrict-aliasing=3 $lib $flags mdlcomp.c gl
/glad.c
-o tools
/mdlcomp
$libs -Wl,-rpath=.
/ $defines
61 gcc
-Wall -Wstrict-aliasing=3 $lib $flags fontcomp.c gl
/glad.c
-o tools
/fontcomp
$libs -Wl,-rpath=.
/ $defines
62 gcc
$lib qoiconv.c
-std=c99
-O3 -o tools
/qoiconv
67 # Convert all png to qoi
68 echo "Compiling textures"
69 for f
in textures
/*.png
;
71 .
/tools
/qoiconv
$f .
/_temp_textures
/"$(basename "$f" .png).qoi"
74 #if [ "$compile_models" = true ]; then
75 # echo "Recompiling models"
76 # for f in models/*.obj;
77 # do echo "Compiling $f..";
78 # ./tools/mdlcomp $f $f.h
83 if [ "$do_build" = true
]; then
84 gcc
-Wall -Wstrict-aliasing=3 $lib $flags $src gl
/glad.c
-o $target $libs -Wl,-rpath=.
/ $defines
87 echo "GCC build failed"
91 echo "Build succeeded"
94 mkdir
$build_dir/cfg
-p
95 mkdir
$build_dir/textures
-p
96 mkdir
$build_dir/sound
-p
97 mkdir
$build_dir/maps
-p
98 mkdir
$build_dir/sav
-p
100 cp $target $build_dir/$target
101 cp .
/steam
/$steam_api $build_dir/$steam_api
102 rm -r $build_dir/textures
103 mv .
/_temp_textures
/ $build_dir/textures
104 cp -r .
/sound
/ $build_dir
105 cp -r .
/maps
/ $build_dir
107 if [ "$run_after" = true
]; then