pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

serious-engine-tfe-git: solve library loading problem in a different way



Module Name:	pkgsrc-wip
Committed By:	Yorick Hardy <yorickhardy%gmail.com@localhost>
Pushed By:	yhardy
Date:		Sun Sep 27 22:26:41 2020 +0200
Changeset:	675059beee5c50b6318c74a566652c10199eb0a6

Modified Files:
	serious-engine-tfe-git/Makefile
	serious-engine-tfe-git/distinfo
	serious-engine-tfe-git/patches/patch-Engine_Base_Unix_UnixDynamicLoader.cpp
	serious-engine-tse-git/Makefile
	serious-engine-tse-git/distinfo

Log Message:
serious-engine-tfe-git: solve library loading problem in a different way

Instead of using the rpath, just try the installed library directory directly.
Also, change the way that errors are detected for dlopen, checking the error
string picks up errors messages (on NetBSD) that are not relevant.

Adjust serious-engine-tse-git accordingly.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=675059beee5c50b6318c74a566652c10199eb0a6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 serious-engine-tfe-git/Makefile                    |  2 +-
 serious-engine-tfe-git/distinfo                    |  2 +-
 .../patch-Engine_Base_Unix_UnixDynamicLoader.cpp   | 40 +++++++++++++---------
 serious-engine-tse-git/Makefile                    |  2 +-
 serious-engine-tse-git/distinfo                    |  2 +-
 5 files changed, 28 insertions(+), 20 deletions(-)

diffs:
diff --git a/serious-engine-tfe-git/Makefile b/serious-engine-tfe-git/Makefile
index 41c6c51fe3..8aa0132d79 100644
--- a/serious-engine-tfe-git/Makefile
+++ b/serious-engine-tfe-git/Makefile
@@ -3,6 +3,6 @@
 PKGNAME=	serious-engine-tfe-0.0
 
 CMAKE_ARGS+=	-DTFE:BOOL=TRUE
-LDFLAGS+=	${COMPILER_RPATH_FLAG}${PREFIX}/lib/ssam-tfe
+CXXFLAGS+=	-DPACKAGE_LIBDIR=\""${PREFIX}/lib/ssam-tfe/"\"
 
 .include "../../wip/serious-engine-tfe-git/Makefile.common"
diff --git a/serious-engine-tfe-git/distinfo b/serious-engine-tfe-git/distinfo
index ad46135854..f8546eb5aa 100644
--- a/serious-engine-tfe-git/distinfo
+++ b/serious-engine-tfe-git/distinfo
@@ -2,5 +2,5 @@ $NetBSD$
 
 SHA1 (patch-CMakeLists.txt) = 8118cf60d01846bf0772e9e7a89a7f5e5b8035a5
 SHA1 (patch-Ecc_StdH.h) = e8c1bc298362db1781b5d15aeebcc10201ab8600
-SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 2e139fae083e0dc5f6f5af355e8bd907cabc2d94
+SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 51c406427eadf287df4a6be1990e427730bb2204
 SHA1 (patch-Engine_Engine.cpp) = 482b4af4d14aeade6c49703dc3578b730969280c
diff --git a/serious-engine-tfe-git/patches/patch-Engine_Base_Unix_UnixDynamicLoader.cpp b/serious-engine-tfe-git/patches/patch-Engine_Base_Unix_UnixDynamicLoader.cpp
index 1c081365c5..d3885b93ef 100644
--- a/serious-engine-tfe-git/patches/patch-Engine_Base_Unix_UnixDynamicLoader.cpp
+++ b/serious-engine-tfe-git/patches/patch-Engine_Base_Unix_UnixDynamicLoader.cpp
@@ -1,32 +1,40 @@
 $NetBSD$
 
-Don't override the search paths for libraries, the rpath is correct.
+ 1) Check for an error (in the handle), instead of just the error string.
+    (Otherwise transient errors are detected as a loading error.)
+ 2) Use the package directory to find the game libraries.
 
 --- Engine/Base/Unix/UnixDynamicLoader.cpp.orig	2020-09-26 18:29:18.000000000 +0000
 +++ Engine/Base/Unix/UnixDynamicLoader.cpp
-@@ -78,7 +78,8 @@ CTFileName CDynamicLoader::ConvertLibNam
+@@ -65,7 +65,9 @@ void *CUnixDynamicLoader::FindSymbol(con
+ void CUnixDynamicLoader::DoOpen(const char *lib)
+ {
+     module = ::dlopen(lib, RTLD_LAZY | RTLD_GLOBAL);
+-    SetError();
++    if (module == NULL) {
++        SetError();
++    }
+ }
+ 
+ 
+@@ -78,7 +80,8 @@ CTFileName CDynamicLoader::ConvertLibNam
      #endif
      CTFileName fnm = CTString(libname);
      CTString libstr((strncmp("lib", fnm.FileName(), 3) == 0) ? "" : "lib");
 -    return(fnm.FileDir() + libstr + fnm.FileName() + DLLEXTSTR);
-+    // use the rpath to find libraries, not the path name
++    // use the pkgsrc path to find libraries, not the path name
 +    return(libstr + fnm.FileName() + DLLEXTSTR);
  }
  
  
-@@ -91,6 +92,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
-     } else {
-         CTFileName fnm = ConvertLibNameToPlatform(libname);
- 
-+#if 0
+@@ -94,9 +97,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
          // Always try to dlopen from inside the game dirs before trying
          //  system libraries...
          if (fnm.FileDir() == "") {
-@@ -103,6 +105,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
-                 return;
-             }
-         }
-+#endif
- 
-         DoOpen(fnm);
-     }
+-            char buf[MAX_PATH];
+-            _pFileSystem->GetExecutablePath(buf, sizeof (buf));
+-            CTFileName fnmDir = CTString(buf);
++            CTFileName fnmDir = CTString(PACKAGE_LIBDIR);
+             fnmDir = fnmDir.FileDir() + fnm;
+             DoOpen(fnmDir);
+             if (module != NULL) {
diff --git a/serious-engine-tse-git/Makefile b/serious-engine-tse-git/Makefile
index 9a02d36407..0f279c10d7 100644
--- a/serious-engine-tse-git/Makefile
+++ b/serious-engine-tse-git/Makefile
@@ -4,6 +4,6 @@ PKGNAME=	serious-engine-tse-0.0
 PATCHDIR=	../../wip/serious-engine-tfe-git/patches
 
 CMAKE_ARGS+=	-DTFE:BOOL=FALSE
-LDFLAGS+=	${COMPILER_RPATH_FLAG}${PREFIX}/lib/ssam-tse
+CXXFLAGS+=	-DPACKAGE_LIBDIR=\""${PREFIX}/lib/ssam-tse/"\"
 
 .include "../../wip/serious-engine-tfe-git/Makefile.common"
diff --git a/serious-engine-tse-git/distinfo b/serious-engine-tse-git/distinfo
index ad46135854..f8546eb5aa 100644
--- a/serious-engine-tse-git/distinfo
+++ b/serious-engine-tse-git/distinfo
@@ -2,5 +2,5 @@ $NetBSD$
 
 SHA1 (patch-CMakeLists.txt) = 8118cf60d01846bf0772e9e7a89a7f5e5b8035a5
 SHA1 (patch-Ecc_StdH.h) = e8c1bc298362db1781b5d15aeebcc10201ab8600
-SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 2e139fae083e0dc5f6f5af355e8bd907cabc2d94
+SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 51c406427eadf287df4a6be1990e427730bb2204
 SHA1 (patch-Engine_Engine.cpp) = 482b4af4d14aeade6c49703dc3578b730969280c


Home | Main Index | Thread Index | Old Index