2 # Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved
5 # ==============================================================================
7 _linux_compiler
="gcc -std=c99 -D_REENTRANT"
8 _linux_linkgraphics
="-lGL -lglfw3 -lX11 -lXxf86vm -lXrandr -lm -pthread -lXi -ldl"
9 _linux_asan
="-fsanitize=address"
10 _linux_linksteam
="-lsteam_api"
11 _linux_folder
="bin/linux"
12 _linux_server_folder
="bin/linux_server"
14 _windows_compiler
="i686-w64-mingw32-gcc"
15 _windows_linkgraphics
="-lglfw3dll -lopengl32 -lm -mwindows"
17 _windows_linksteam
="vg/dep/steam/steam_api.dll"
18 _windows_folder
="bin/win32"
20 _options_debugmode
="-O0 -ggdb3 -fno-omit-frame-pointer"
21 _options_release
="-O3 -DVG_RELEASE"
24 # ==============================================================================
26 _warnings
="-Wall -Wno-unused-function -Wno-unused-variable"
27 _include
="-I. -I./vg/dep -I./vg/src"
28 _library
="-L. -L./vg/dep/glfw -L./vg/dep/steam"
29 _epilogue
="-Wl,-rpath=./"
33 # ==============================================================================
37 temp_options
=$_options
42 _src
="-c vg/dep/dr_soft/miniaudio_impl.c"
43 _dst
="vg/dep/dr_soft/miniaudio_$1"
47 _options
=$temp_options
50 # Again, these are not cross platform currently
59 cd $_linux_server_folder
69 #TODO: Make this a seperate script
70 # it should not be called compile, rename to 'generate' shader headers,
71 # its a code writing tool, not a compiling tool
75 target_shaders
="$target_shaders $1 $2 $3"
79 titleit
"Compiling shaders"
82 ..
/bin
/linux
/tools
/shader
$target_shaders
87 ln -sr bin
/content
/textures
/ $1/textures
88 ln -sr bin
/content
/models
/ $1/models
89 ln -sr bin
/content
/sound
/ $1/sound
92 TIMESTAMP
=`date +%Y-%m-%d_%H-%M-%S`
97 _linux_options
=$_options_release
98 _windows_options
=$_options_release
101 _linux_options
="$_linux_asan $_options_debugmode"
102 _windows_options
="$_windows_asan $_options_debugmode"
105 titleit
"Creating Linux build"
106 mkdir
-p $_linux_folder/cfg
109 cp vg
/dep
/steam
/libsteam_api.so
$_linux_folder
110 link_content
$_linux_folder
112 _compiler
=$_linux_compiler
113 _options
=$_linux_options
115 compile_miniaudio linux
118 _folder
=$_linux_folder
124 _link
="$_linux_linkgraphics $_linux_linksteam"
125 _src
="main.c vg/dep/glad/glad.c vg/dep/dr_soft/miniaudio_linux.o"
130 titleit
"Creating Windows build"
131 mkdir
-p $_windows_folder/cfg
134 cp vg
/dep
/steam
/steam_api.dll
$_windows_folder
135 link_content
$_windows_folder
137 _compiler
=$_windows_compiler
138 _options
=$_windows_options
140 compile_miniaudio windows
144 _folder
=$_windows_folder
148 _link
="$_windows_linkgraphics $_windows_linksteam"
149 _src
="main.c vg/dep/glad/glad.c vg/dep/dr_soft/miniaudio_windows.o"
154 titleit
"Creating Server build"
155 mkdir
-p $_linux_server_folder/cfg
158 cp vg
/dep
/steam
/steamclient.so bin
/linux_server
/
160 _compiler
=$_linux_compiler
161 _options
=$_linux_options
162 _link
="-lm $_linux_linksteam"
164 _folder
=$_linux_server_folder
165 _dst
="skaterift_server"
171 #TODO: These are not cross platform in the build script, a full build
172 # from source is therefore not possible on windows, only a linux
175 titleit
"Compiling textures"
176 mkdir
-p .
/bin
/content
/textures
177 for f
in .
/textures_src
/*.png
;
178 do logit
" qoiconv: $f";
179 dest
=.
/bin
/content
/textures
/"$(basename "$f" .png).qoi"
180 .
/bin
/linux
/tools
/qoiconv
$f $dest
184 logit
"Copying content"
185 mkdir
-p .
/bin
/content
/models
186 mkdir
-p .
/bin
/content
/sound
188 cp .
/models_src
/* .
/bin
/content
/models
/
189 cp .
/sound_src
/* .
/bin
/content
/sound
/
207 titleit
"Compressing distributions"
209 tar -chzvf dist
/skaterift_linux__
$TIMESTAMP.
tar.gz bin
/linux
/
211 tar -chzvf dist
/skaterift_server__
$TIMESTAMP.
tar.gz bin
/linux_server
213 tar -chzvf dist
/skaterift_win32__
$TIMESTAMP.
tar.gz bin
/win32
/
216 # ========================================================================
226 echo "Unrecognised command $1"
231 source vg
/vg_build.sh