-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgamelib-config
More file actions
executable file
·94 lines (90 loc) · 2.08 KB
/
gamelib-config
File metadata and controls
executable file
·94 lines (90 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
prefix=$( dirname "$0" )
usage="\
Uso: gamelib-config [--cflags] [--libs] [--static-libs] [--builddir] [--platform]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
# Preparar configuracion
uname=$( uname )
unamem=$( uname -m )
gcctarget=$( gcc -dumpmachine )
if test $# -gt 0; then
if test $1 = "emscripten"; then
uname="EMSCRIPTEN"
shift
fi
if test $1 = "Darwin"; then
uname="Darwin"
shift
fi
fi
case "$uname" in
*MINGW* | *MSYS*)
# Configuracion de Win32/Mingw
libs="-lopengl32 $(sdl2-config --libs)"
cflags="-g -mwindows -D_GNU_SOURCE=1 -DWIN32 $(sdl2-config --cflags) -I$prefix/src"
builddir="build-$gcctarget"
platform="$gcctarget"
exeextension=".exe"
ldflags=""
;;
*EMSCRIPTEN*)
# Configuracion de Emscripten
libs=""
cflags="-s USE_SDL=2 -O2 -Wno-implicit-function-declaration -I$prefix/src"
builddir="build-emscripten"
platform="emscripten"
exeextension=".html"
ldflags="--preload-file data -s TOTAL_MEMORY=134217728 -lidbfs.js"
;;
*Darwin*)
# Configuracion de MacOSX
libs="-framework Cocoa -lm -framework OpenGL -framework SDL $prefix/macosx/SDLMain.m"
cflags="-Wall -g -DMACOSX -ObjC -Dmain=SDL_main -I/usr/include/ -I/usr/include/SDL/ -I/usr/X11R6/include/ -I$prefix/src"
builddir="build-$gcctarget"
platform="$gcctarget"
exeextension=""
ldflags=""
;;
*)
# Configuracion de Linux
libs="-lpthread -L/usr/X11R6/lib -L/usr/lib -lm -lGL -lX11 $(sdl2-config --libs)"
cflags="-Wall -g -I/usr/include/ -I/usr/X11R6/include/ $(sdl2-config --cflags) -I$prefix/src"
builddir="build-$gcctarget"
platform="$gcctarget"
exeextension=""
ldflags=""
;;
esac
while test $# -gt 0; do
case $1 in
--cflags)
echo "$cflags"
;;
--libs)
echo "$libs"
;;
--ldflags)
echo "$ldflags"
;;
--static-libs)
echo "$prefix/$builddir/libgame.a"
;;
--builddir)
echo "$builddir"
;;
--platform)
echo "$platform"
;;
--exe-extension)
echo "$exeextension"
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done