dj64: enable dynamic linking using RTLD_GROUP

This commit is contained in:
PulkoMandy
2025-07-12 14:11:05 +02:00
parent 34947ceda7
commit 1a60dd89aa
2 changed files with 28 additions and 40 deletions

View File

@@ -15,10 +15,10 @@ future of DOS is probably in the emulated environments anyway."
HOMEPAGE="https://github.com/stsp/dj64dev"
COPYRIGHT="2024 Stas Sergeev, 19??-2024 DJ Delorie and others"
LICENSE="GNU GPL v3"
SOURCE_URI="https://github.com/stsp/dj64dev/archive/5c4ecc1256ad2047734ceef547e6d19fcf50e59d.tar.gz"
SOURCE_DIR="dj64dev-5c4ecc1256ad2047734ceef547e6d19fcf50e59d"
CHECKSUM_SHA256="096e70ebec77c60b54cd8a4a557c2c45e9aaf35aaf41d3636714934aa31d14f7"
REVISION="1"
SOURCE_URI="https://github.com/stsp/dj64dev/archive/1033bdad7d8df3224052be966970a916575f2db2.tar.gz"
SOURCE_DIR="dj64dev-1033bdad7d8df3224052be966970a916575f2db2"
CHECKSUM_SHA256="68180cef48aef749119070068b8cf5ddbaf83ad893a6888536c42de0e94b1857"
REVISION="2"
PATCHES="$portVersionedName.patchset"
ARCHITECTURES="all"
@@ -26,6 +26,7 @@ SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
dj64$secondaryArchSuffix = $portVersion
lib:libdj64$secondaryArchSuffix
lib:libdjdev64$secondaryArchSuffix
lib:libdjstub64$secondaryArchSuffix
"
@@ -52,7 +53,7 @@ BUILD_PREREQUIRES="
"
targetArch="i386-pc-dj64"
relativeInstallDir="develop/tools/${targetArch}"
relativeInstallDir="develop/tools/"
installDir="$prefix/$relativeInstallDir"
BUILD()
@@ -60,15 +61,18 @@ BUILD()
# Official instructions are to just run make (it will run configure if needed), but we need to
# pass options to configure for installation paths, etc.
autoreconf -v -i -I m4
export CFLAGS="-O2 -DRTLD_DEEPBIND=RTLD_GROUP"
runConfigure --omit-dirs prefix ./configure --prefix=$installDir
# ncurses build needs HOME to be set, otherwise it tries to write into system directories.
# ncurses build needs TERMINFO to be set, otherwise it tries to write into system directories.
export TERMINFO=/tmp
make
make $jobArgs
}
INSTALL()
{
make install
cp $installDir/i386-pc-dj64/lib64/libdj64.so* $libDir
}

View File

@@ -1,14 +1,23 @@
From 512c7d2a96633940ec3ba00b78461fce1d6f8c12 Mon Sep 17 00:00:00 2001
From 3ebc789256379a1ed261f57b5fbee0f1f92e8065 Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Sun, 22 Jun 2025 18:16:51 +0200
Subject: fix build for Haiku
Date: Sat, 12 Jul 2025 13:17:03 +0200
Subject: Reapply patch from previous version
diff --git a/dj64.mk b/dj64.mk
index 8cf7b86..7c5dff9 100644
index 1e7f56a..20a7d93 100644
--- a/dj64.mk
+++ b/dj64.mk
@@ -100,7 +100,7 @@ endif
@@ -72,7 +72,7 @@ ifeq ($(DJ64STATIC),0)
$(error DJ64STATIC must be empty, not 0)
endif
ifeq ($(DJ64STATIC),1)
-DJLDFLAGS = $(shell pkg-config --libs dj64_s)
+DJLDFLAGS = -Wl,--no-undefined -Wl,--whole-archive $(shell pkg-config --libs dj64_s) -Wl,--no-whole-archive
DJ64_XLDFLAGS += -f 0x40
else
RP := -Wl,-rpath=/usr/local/i386-pc-dj64/lib64 \
@@ -99,7 +99,7 @@ endif
GLOB_ASM = $(wildcard glob_asm.h)
ifneq ($(AS_OBJECTS),)
@@ -18,13 +27,13 @@ index 8cf7b86..7c5dff9 100644
XLDFLAGS += $(shell pkg-config --static --libs dj64static)
DJ64_XLDFLAGS += -f 0x4000
diff --git a/src/libc/dj64/makefile b/src/libc/dj64/makefile
index 91a7014..c2670ce 100644
index dee8104..0c99592 100644
--- a/src/libc/dj64/makefile
+++ b/src/libc/dj64/makefile
@@ -95,7 +95,7 @@ $(LIB)/libc.a: libc_tmp.a plt.o | $(LIB)
@@ -89,7 +89,7 @@ $(LIB)/libc_s.a: libc_tmp.a plt.o | $(LIB)
mv -f libctmp.a $@
$(LIB)/crt0.elf: $(LIB)/libc.a
$(LIB)/crt0.elf: $(LIB)/libc_s.a
- $(CROSS_LD) --whole-archive $< -melf_i386 -static $(XLD_IMB_OPT)=0x08048000 -o $@
+ $(CROSS_LD) --whole-archive $< -melf_i386_haiku -static $(XLD_IMB_OPT)=0x08048000 -o $@
$(CROSS_STRIP) --strip-debug $@
@@ -46,28 +55,3 @@ index 18da1df..cc36e87 100755
--
2.48.1
From f4220a32d87745d85e64cdcee20c0645c28bd989 Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Mon, 23 Jun 2025 21:20:27 +0200
Subject: Use static mode for Haiku
As recommended by dj64 developer
diff --git a/dj64.mk b/dj64.mk
index 7c5dff9..83fda82 100644
--- a/dj64.mk
+++ b/dj64.mk
@@ -66,6 +66,9 @@ endif
ifneq ($(filter freebsd%,$(MACH)),)
DJ64STATIC = 1
endif
+ifneq ($(filter haiku%,$(MACH)),)
+DJ64STATIC = 1
+endif
ifneq ($(filter android%,$(MACH)),)
DJ64STATIC = 1
endif
--
2.48.1