SHA256
1
0
forked from pool/0ad
0ad/0ad-cs7758.patch

80 lines
2.9 KiB
Diff

Index: build/premake/premake.lua
===================================================================
--- build/premake/premake.lua (revision 7757)
+++ build/premake/premake.lua (revision 7758)
@@ -6,6 +6,9 @@
addoption("outpath", "Location for generated project files")
addoption("without-tests", "Disable generation of test projects")
addoption("without-pch", "Disable generation and usage of precompiled headers")
+addoption("bindir", "Directory for executables (typically '/usr/games/bin'); default is to be relocatable")
+addoption("datadir", "Directory for data files (typically '/usr/share/games/0ad'); default is ../data/ relative to executable")
+addoption("libdir", "Directory for libraries (typically '/usr/games/lib'); default is ./ relative to executable")
dofile("functions.lua")
dofile("extern_libs.lua")
@@ -206,13 +209,6 @@
end
end
- if OS == "linux" then
- -- To use our local SpiderMonkey library, it needs to be part of the runtime dynamic linker
- -- path. So add the executable path with -rpath:
- -- (TODO: is this a sane way to do it?)
- tinsert(package.linkoptions, {"-Wl,-rpath='$$ORIGIN'"}) -- use Makefile escaping of '$'
- end
-
tinsert(package.buildoptions, {
-- Hide symbols in dynamic shared objects by default, for efficiency and for equivalence with
-- Windows - they should be exported explicitly with __attribute__ ((visibility ("default")))
@@ -233,10 +229,28 @@
if OS == "linux" and options["icc"] then
tinsert(package.libpaths, "/usr/i686-pc-linux-gnu/lib") -- needed for ICC to find libbfd
end
-
- package.defines = {
- -- "CONFIG_USE_MMGR",
- }
+
+ if options["bindir"] then
+ tinsert(package.defines, "INSTALLED_BINDIR=" .. options["bindir"])
+ end
+ if options["datadir"] then
+ tinsert(package.defines, "INSTALLED_DATADIR=" .. options["datadir"])
+ end
+ if options["libdir"] then
+ tinsert(package.defines, "INSTALLED_LIBDIR=" .. options["libdir"])
+ end
+
+ if OS == "linux" then
+ -- To use our local SpiderMonkey library, it needs to be part of the
+ -- runtime dynamic linker path. Add it with -rpath to make sure it gets found.
+ if options["libdir"] then
+ tinsert(package.linkoptions, {"-Wl,-rpath=" .. options["libdir"]})
+ else
+ -- Add the executable path:
+ tinsert(package.linkoptions, {"-Wl,-rpath='$$ORIGIN'"}) -- use Makefile escaping of '$'
+ end
+ end
+
end
end
Index: source/ps/GameSetup/Paths.cpp
===================================================================
--- source/ps/GameSetup/Paths.cpp (revision 7757)
+++ source/ps/GameSetup/Paths.cpp (revision 7758)
@@ -30,7 +30,13 @@
Paths::Paths(const CmdLineArgs& args)
{
m_root = Root(wstring_from_utf8(args.GetArg0()));
+
+#ifdef INSTALLED_DATADIR
+ m_rdata = WIDEN(STRINGIZE(INSTALLED_DATADIR)) L"/";
+#else
m_rdata = m_root/L"data/";
+#endif
+
const wchar_t* subdirectoryName = args.Has("writableRoot")? 0 : L"0ad";
// everything is a subdirectory of the root