119 lines
4.1 KiB
Diff
119 lines
4.1 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
|
|
Index: source/ps/DllLoader.cpp
|
|
===================================================================
|
|
--- source/ps/DllLoader.cpp (revision 7757)
|
|
+++ source/ps/DllLoader.cpp (revision 7758)
|
|
@@ -19,6 +19,7 @@
|
|
|
|
#include "DllLoader.h"
|
|
|
|
+#include "lib/timer.h"
|
|
#include "lib/posix/posix_dlfcn.h"
|
|
#include "ps/CStr.h"
|
|
#include "ps/CLogger.h"
|
|
@@ -30,10 +31,15 @@
|
|
// the library name.
|
|
|
|
// note: on Linux, lib is prepended to the SO file name;
|
|
-// we don't use a path with '/' so the linker will look in DT_RUNPATH
|
|
+// if we don't have an explicit libdir then we don't use
|
|
+// a path with '/' so the linker will look in DT_RUNPATH
|
|
// (which we set to $ORIGIN) to find it in the executable's directory
|
|
#if OS_UNIX
|
|
-static const char* prefix = "lib";
|
|
+ #ifdef INSTALLED_LIBDIR
|
|
+ static const char* prefix = STRINGIZE(INSTALLED_LIBDIR) "/lib";
|
|
+ #else
|
|
+ static const char* prefix = "lib";
|
|
+ #endif
|
|
#else
|
|
static const char* prefix = "";
|
|
#endif
|
|
@@ -72,6 +78,8 @@
|
|
// postcondition: m_Handle valid or == HANDLE_UNAVAILABLE.
|
|
if (m_Handle == 0)
|
|
{
|
|
+ TIMER(L"LoadDLL");
|
|
+
|
|
CStr filename = CStr(prefix) + m_Name + suffix;
|
|
|
|
// we don't really care when relocations take place, but one of
|