Skip to content

Commit

Permalink
yquake2: fix the search paths and installation on macOS
Browse files Browse the repository at this point in the history
On macOS, ld(1) defaults to the output filename for the "install path"
(LC_ID_DYLIB). This is caught by pkgsrc with `otool -L` in order to
determine REQUIRES= in mk/pkgformat/pkg/metadata.mk - but it is wrong
here, since the library is moved to libexec/yquake2 before packaging.
(Error "missing library" when checking for missing run-time search
paths in check-shlibs.mk)

While there, this also fixes the default search path for the quake2
executable.

NFCI anywhere outside macOS.

Tested on NetBSD/amd64 and macOS/amd64.
  • Loading branch information
khorben committed Nov 27, 2024
1 parent 91bbe5d commit a2b2878
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
3 changes: 2 additions & 1 deletion games/yquake2/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.32 2024/11/14 22:20:00 wiz Exp $
# $NetBSD: Makefile,v 1.33 2024/11/27 07:04:55 khorben Exp $

DISTNAME= quake2-8.20
PKGNAME= y${DISTNAME}
Expand All @@ -15,6 +15,7 @@ LICENSE= gnu-gpl-v2
USE_TOOLS+= gmake
USE_LANGUAGES= c99

MAKE_FLAGS+= PREFIX=${PREFIX}
MAKE_FLAGS+= WITH_SYSTEMWIDE=yes
MAKE_FLAGS+= WITH_SYSTEMDIR=${PREFIX}/share/yquake2

Expand Down
4 changes: 2 additions & 2 deletions games/yquake2/distinfo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$NetBSD: distinfo,v 1.7 2023/09/10 10:18:44 yhardy Exp $
$NetBSD: distinfo,v 1.8 2024/11/27 07:04:55 khorben Exp $

BLAKE2s (quake2-8.20.tar.xz) = 14be64905a3b8ab705817e35932d585dff284b84c1449ef9f10e8c5cbc59d0d5
SHA512 (quake2-8.20.tar.xz) = 5dbdbbf582494d16d00b9880ddea6de4b098a307dbe4ddf6bc90aa6b2bd2928c10fab40cf5dd63861e7a37f9c75b9afae6f43f8bfff3ee6704ca94f78ff9b7d2
Size (quake2-8.20.tar.xz) = 2152184 bytes
SHA1 (patch-Makefile) = adde4e75f4ac25b92b69260826720a1790e1aafe
SHA1 (patch-Makefile) = 9f237f72a569e201425438361f44db7b09b590e3
45 changes: 44 additions & 1 deletion games/yquake2/patches/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
$NetBSD: patch-Makefile,v 1.2 2023/09/10 10:18:44 yhardy Exp $
$NetBSD: patch-Makefile,v 1.3 2024/11/27 07:04:55 khorben Exp $

Let pkgsrc determine the search paths, instead of forcing
the prefix.

Set the correct ID for the shared libraries on macOS.

--- Makefile.orig 2022-12-09 11:37:27.000000000 +0000
+++ Makefile
@@ -286,7 +286,7 @@ INCLUDE ?= -I/usr/include
Expand All @@ -23,3 +25,44 @@ the prefix.
else ifeq ($(YQ2_OSTYPE),OpenBSD)
LDFLAGS ?= -L/usr/local/lib
else ifeq ($(YQ2_OSTYPE),Windows)
@@ -516,7 +516,7 @@ endif

ifeq ($(WITH_RPATH),yes)
ifeq ($(YQ2_OSTYPE), Darwin)
-release/quake2 : LDFLAGS += -Wl,-rpath,'@executable_path/lib'
+release/quake2 : LDFLAGS += -Wl,-rpath,'$(PREFIX)/lib'
else
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$$ORIGIN/lib'
endif
@@ -579,6 +579,7 @@ ref_gl1:


release/ref_gl1.dylib : LDFLAGS += -shared -framework OpenGL
+release/ref_gl1.dylib : LDFLAGS += -Wl,-install_name,$(PREFIX)/libexec/yquake2/ref_gl1.dylib

else # not Windows or Darwin

@@ -619,6 +620,7 @@ ref_gl3:

release/ref_gl3.dylib : GLAD_INCLUDE = -Isrc/client/refresh/gl3/glad/include
release/ref_gl3.dylib : LDFLAGS += -shared
+release/ref_gl3.dylib : LDFLAGS += -Wl,-install_name,$(PREFIX)/libexec/yquake2/ref_gl3.dylib

else # not Windows or Darwin

@@ -668,6 +670,7 @@ release/ref_gles3.dylib : GLAD_INCLUDE =
release/ref_gles3.dylib : CFLAGS += -DYQ2_GL3_GLES3 -DYQ2_GL3_GLES

release/ref_gles3.dylib : LDFLAGS += -shared
+release/ref_gles3.dylib : LDFLAGS += -Wl,-install_name,$(PREFIX)/libexec/yquake2/ref_gles3.dylib

else # not Windows or Darwin

@@ -711,6 +714,7 @@ ref_soft:
$(MAKE) release/ref_soft.dylib

release/ref_soft.dylib : LDFLAGS += -shared
+release/ref_soft.dylib : LDFLAGS += -Wl,-install_name,$(PREFIX)/libexec/yquake2/ref_soft.dylib

else # not Windows or Darwin

0 comments on commit a2b2878

Please sign in to comment.