Formatting, lua_translate target_os
This commit is contained in:
parent
e73a462c91
commit
40b8cab88e
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import toml
|
import toml
|
||||||
|
import os
|
||||||
typesIn = {
|
typesIn = {
|
||||||
"__unknown": "lua_touserdata",
|
"__unknown": "lua_touserdata",
|
||||||
"char": "luaL_checkinteger",
|
"char": "luaL_checkinteger",
|
||||||
@ -22,11 +23,21 @@ statics = toml.loads(open("src/values/statics.toml").read())
|
|||||||
functions = toml.loads(open("src/values/functions.toml").read())
|
functions = toml.loads(open("src/values/functions.toml").read())
|
||||||
ofile = open("src/lua.c","w")
|
ofile = open("src/lua.c","w")
|
||||||
|
|
||||||
|
if os.environ["target_os"] == "linux":
|
||||||
ofile.write('''\
|
ofile.write('''\
|
||||||
#include <lua5.3/lua.h>
|
#include <lua5.3/lua.h>
|
||||||
#include <lua5.3/lualib.h>
|
#include <lua5.3/lualib.h>
|
||||||
#include <lua5.3/lauxlib.h>
|
#include <lua5.3/lauxlib.h>
|
||||||
lua_State * engine_lua_state;
|
''')
|
||||||
|
|
||||||
|
if os.environ["target_os"] == "openbsd":
|
||||||
|
ofile.write('''\
|
||||||
|
#include <lua-5.3/lua.h>
|
||||||
|
#include <lua-5.3/lualib.h>
|
||||||
|
#include <lua-5.3/lauxlib.h>
|
||||||
|
''')
|
||||||
|
|
||||||
|
ofile.write('''lua_State * engine_lua_state;
|
||||||
#include "lua_manual.c"
|
#include "lua_manual.c"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
18
run
Normal file → Executable file
18
run
Normal file → Executable file
@ -1,24 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
if [ "$#" -ne "1" ]; then
|
||||||
echo "Usage: $0 <supported_os>"
|
echo "Usage: $0 <linux/openbsd>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
export target_os="$1"
|
||||||
target_os=$(echo "$1")
|
|
||||||
|
|
||||||
printf "$target_os\n"
|
|
||||||
|
|
||||||
case "$target_os" in
|
case "$target_os" in
|
||||||
linux)
|
linux)
|
||||||
echo "compiling linux"
|
echo "* Compiling: linux ..."
|
||||||
./lua_translate
|
./lua_translate
|
||||||
gcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall
|
gcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall
|
||||||
;;
|
;;
|
||||||
openbsd)
|
openbsd)
|
||||||
echo "compiling openbsd"
|
echo "* Compiling: openbsd ..."
|
||||||
sed -i 's/lua5\.3/lua-5.3/g' lua_translate
|
|
||||||
./lua_translate
|
./lua_translate
|
||||||
egcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall -I /usr/local/include
|
egcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall -I /usr/local/include
|
||||||
;;
|
;;
|
||||||
@ -28,6 +23,5 @@ case "$target_os" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "\n\tengine is running"
|
echo "Running engine ..."
|
||||||
|
|
||||||
exec ./engine
|
exec ./engine
|
||||||
|
Loading…
Reference in New Issue
Block a user