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 -DNO_STEAM"
8 build_dir
="build.linux"
10 if [[ "$OSTYPE" != "linux-gnu"* ]]; then
11 echo "Operating system is not GNU/Linux, windows will be assumed."
13 target
="fishladder.exe"
14 libs
="-lglfw3 -lopengl32 -lm -mwindows"
15 flags
="-ggdb3 -Wno-unused-function -DNO_STEAM"
16 build_dir
="build.win32"
27 flags
="-O3 -Wno-unused-function"
47 echo "Unkown param: $1"
55 if [ "$compile_tools" = true
]; then
58 gcc
-Wall -Wstrict-aliasing=3 $lib $flags mdlcomp.c gl
/glad.c
-o tools
/mdlcomp
$libs -Wl,-rpath=.
/ $defines
59 gcc
-Wall -Wstrict-aliasing=3 $lib $flags fontcomp.c gl
/glad.c
-o tools
/fontcomp
$libs -Wl,-rpath=.
/ $defines
60 gcc
$lib qoiconv.c
-std=c99
-O3 -o tools
/qoiconv
64 if [ "$compile_models" = true
]; then
65 echo "Recompiling models"
66 for f
in models
/*.obj
;
67 do echo "Compiling $f..";
68 .
/tools
/mdlcomp
$f $f.h
72 # Convert all png to qoi
73 echo "Compiling textures"
75 for f
in textures
/*.png
;
77 .
/tools
/qoiconv
$f .
/_temp_textures
/"$(basename "$f" .png).qoi"
81 if [ "$do_build" = true
]; then
82 gcc
-Wall -Wstrict-aliasing=3 $lib $flags $src gl
/glad.c
-o $target $libs -Wl,-rpath=.
/ $defines
85 echo "GCC build failed"
89 echo "Build succeeded"
92 mkdir
$build_dir/cfg
-p
93 mkdir
$build_dir/textures
-p
94 mkdir
$build_dir/sound
-p
95 mkdir
$build_dir/maps
-p
96 mkdir
$build_dir/sav
-p
98 cp $target $build_dir/$target
99 cp .
/steam
/libsteam_api.so
$build_dir/libsteam_api.so
100 rm -r $build_dir/textures
101 mv .
/_temp_textures
/ $build_dir/textures
102 cp -r .
/sound
/ $build_dir
103 cp -r .
/maps
/ $build_dir
105 if [ "$run_after" = true
]; then