mudgangster

Log | Files | Refs

commit 6ec5c0dba5f5750a78d4e793d3a372b1ed9e1f24
parent da132b31db47c1c6002a4e43f9bb874286968366
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu,  6 Sep 2018 10:06:47 +0300

Build on Linux again

Diffstat:
make.lua | 18++++++++++++------
src/lua/script.lua | 8++++++--
2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/make.lua b/make.lua @@ -3,12 +3,18 @@ require( "scripts.gen_makefile" ) -- bin( "wintest", { "win", "platform_network", "ggformat", "strlcpy", "strlcat", "patterns", "strtonum" } ) -- msvc_bin_ldflags( "wintest", "gdi32.lib Ws2_32.lib" ) --- it only really makes sense to vendor lua on windows/osx --- but we can't actually build for them yet so do nothing for now -require( "libs.lua" ) -require( "libs.lpeg" ) -require( "libs.lfs" ) +local main_obj = { "src/main", "src/x11" } +local libs = { } -bin( "mudgangster", { "src/win32", "src/script", "src/textbox", "src/input", "src/platform_network" }, { "lua", "lpeg", "lfs" } ) +if OS == "windows" then + require( "libs.lua" ) + require( "libs.lpeg" ) + require( "libs.lfs" ) + + main_obj = "src/win32" + libs = { "lua", "lpeg", "lfs" } +end + +bin( "mudgangster", { main_obj, "src/script", "src/textbox", "src/input", "src/platform_network" }, libs ) msvc_bin_ldflags( "mudgangster", "gdi32.lib Ws2_32.lib" ) gcc_bin_ldflags( "mudgangster", "-lm -lX11 -llua" ) -- -Wl,-E" ) need to export symbols when vendoring diff --git a/src/lua/script.lua b/src/lua/script.lua @@ -1,8 +1,12 @@ local lfs = require( "lfs" ) local serialize = require( "serialize" ) -local ScriptsDir = os.getenv( "HOME" ) .. "/.mudgangster/scripts" -local ScriptsDir = os.getenv( "APPDATA" ) .. "\\Mud Gangster\\scripts" +local ScriptsDir +if package.config:sub( 1, 1 ) == "\\" then + ScriptsDir = os.getenv( "APPDATA" ) .. "\\Mud Gangster\\scripts" +else + ScriptsDir = os.getenv( "HOME" ) .. "/.mudgangster/scripts" +end package.path = package.path .. ";" .. ScriptsDir .. "/?.lua"