1 # Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
6 libs
="-lGL -lglfw -lX11 -lXxf86vm -lXrandr -lm -lpthread -lXi -ldl"
7 steam_part
="-l:steam/libsteam_api.so"
8 flags
="-fsanitize=address -ggdb3 -Wno-unused-function"
9 build_dir
="build.linux"
10 steam_api
="libsteam_api.so"
12 if [[ "$OSTYPE" != "linux-gnu"* ]]; then
13 echo "Operating system is not GNU/Linux, windows will be assumed."
15 target
="fishladder.exe"
16 libs
="-lglfw3 -lopengl32 -lm -mwindows"
17 flags
="-ggdb3 -Wno-unused-function"
18 build_dir
="build.win32"
19 steam_api
="steam_api.dll"
30 flags
="-O3 -Wno-unused-function"
55 echo "Unkown param: $1"
63 if [ "$compile_tools" = true
]; then
66 gcc
-Wall -Wstrict-aliasing=3 $lib $flags mdlcomp.c gl
/glad.c
-o tools
/mdlcomp
$libs $steam_part -Wl,-rpath=.
/ $defines
67 gcc
-Wall -Wstrict-aliasing=3 $lib $flags fontcomp.c gl
/glad.c
-o tools
/fontcomp
$libs $steam_part -Wl,-rpath=.
/ $defines
68 gcc
$lib qoiconv.c
-std=c99
-O3 -o tools
/qoiconv
73 # Convert all png to qoi
74 echo "Compiling textures"
75 for f
in textures
/*.png
;
77 .
/tools
/qoiconv
$f .
/_temp_textures
/"$(basename "$f" .png).qoi"
80 #if [ "$compile_models" = true ]; then
81 # echo "Recompiling models"
82 # for f in models/*.obj;
83 # do echo "Compiling $f..";
84 # ./tools/mdlcomp $f $f.h
89 if [ "$do_build" = true
]; then
90 gcc
-Wall -Wstrict-aliasing=3 $lib $flags $src gl
/glad.c
-o $target $libs $steam_part -Wl,-rpath=.
/ $defines
93 echo "GCC build failed"
97 echo "Build succeeded"
100 mkdir
$build_dir/cfg
-p
101 mkdir
$build_dir/textures
-p
102 mkdir
$build_dir/sound
-p
103 mkdir
$build_dir/maps
-p
104 mkdir
$build_dir/sav
-p
106 cp $target $build_dir/$target
107 cp .
/steam
/$steam_api $build_dir/$steam_api
108 rm -r $build_dir/textures
109 mv .
/_temp_textures
/ $build_dir/textures
110 cp -r .
/sound
/ $build_dir
111 cp -r .
/maps
/ $build_dir
113 if [ "$run_after" = true
]; then