Ports/mold: Update to 1.5.1 and use CMake instead of Makefile

Per the release notes for 1.5.0, the CMake build is preferred going
forward. This lets us drop some Makefile patches and pass them as CMake
options instead, with the exception of disabling mold-wrapper.so.
This commit is contained in:
Andrew Kaster 2022-10-02 21:01:33 -06:00 committed by Linus Groh
parent 376425639d
commit 32c9be30dc
Notes: sideshowbarker 2024-07-17 07:19:27 +09:00
10 changed files with 54 additions and 116 deletions

View File

@ -152,7 +152,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`md4c`](md4c/) | Markdown for C | 0.4.8 | https://github.com/mity/md4c |
| [`mgba`](mgba/) | Game Boy, Game Boy Color and Game Boy Advance emulator | 0.9.3 | https://mgba.io/ |
| [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker |
| [`mold`](mold/) | A Modern Linker | 1.0.3 | https://github.com/rui314/mold |
| [`mold`](mold/) | A Modern Linker | 1.5.1 | https://github.com/rui314/mold |
| [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.2.1 | http://www.multiprecision.org/mpc/ |
| [`mpfr`](mpfr/) | GNU Multiple Precision Floating-Point Reliable Library (MPFR) | 4.1.0 | https://www.mpfr.org/ |
| [`mrsh`](mrsh/) | mrsh | cd3c3a4 | https://mrsh.sh/ |

View File

@ -1,8 +1,25 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=mold
version=1.0.3
files="https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz mold-${version}.tgz 488c12058b4c7c77bff94c6f919e40b2f12c304214e2e0d7d4833c21167837c0"
version=1.5.1
files="https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz mold-${version}.tgz ec94aa74758f1bc199a732af95c6304ec98292b87f2f4548ce8436a7c5b054a1"
auth_type=sha256
depends=("zlib" "openssl")
makeopts=("OS=SerenityOS" "LDFLAGS=-L${DESTDIR}/usr/local/lib" "-j$(nproc)")
installopts=("OS=SerenityOS")
depends=("zlib" "openssl" "zstd")
useconfigure='true'
configopts=(
"-B build"
"-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt"
"-DMOLD_USE_MIMALLOC=OFF"
"-DBUILD_TESTING=OFF"
)
configure() {
run cmake "${configopts[@]}"
}
build() {
run make -C build "${makeopts[@]}"
}
install() {
run make -C build install "${installopts[@]}"
}

View File

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Sun, 23 Jan 2022 17:47:17 -0700
Subject: [PATCH] Disable mold-wrapper.so for Serenity
This feature depends on RTLD_NEXT capabilities which are not yet
implemented in the Serenity DynamicLoader.
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 844d149..946c952 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ ifeq ($(OS), Linux)
MOLD_WRAPPER_LDFLAGS = -Wl,-push-state -Wl,-no-as-needed -ldl -Wl,-pop-state
endif
-all: mold mold-wrapper.so
+all: mold
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB) $(XXHASH_LIB)
$(CXX) $(OBJS) -o $@ $(MOLD_LDFLAGS) $(LDFLAGS)
@@ -172,9 +172,9 @@ install: all
$(INSTALL_PROGRAM) mold $D$(BINDIR)
$(STRIP) $D$(BINDIR)/mold
- $(INSTALL) -d $D$(LIBDIR)/mold
- $(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold
- $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
+ # $(INSTALL) -d $D$(LIBDIR)/mold
+ # $(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold
+ # $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
$(INSTALL) -d $D$(LIBEXECDIR)/mold
ln -sf $(BINDIR)/mold $D$(LIBEXECDIR)/mold/ld

View File

@ -12,7 +12,7 @@ runtime. So, just lie to TBB that we don't support weak symbols.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/third-party/tbb/include/oneapi/tbb/detail/_config.h b/third-party/tbb/include/oneapi/tbb/detail/_config.h
index cce8ad6..3e07302 100644
index fa287cd2968ec7f336b754ee450a8da12f4ded23..b93878aa6369a8ffe386da4dd822ab5bd1fe3c3b 100644
--- a/third-party/tbb/include/oneapi/tbb/detail/_config.h
+++ b/third-party/tbb/include/oneapi/tbb/detail/_config.h
@@ -195,7 +195,7 @@

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Sun, 23 Jan 2022 17:55:32 -0700
Subject: [PATCH] Disable mimalloc for serenity
mimalloc needs some help to compile and run on serenity.
That's one yak too far for right now.
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index 946c952..dc8563d 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,8 @@ endif
USE_MIMALLOC = 1
ifeq ($(OS), Darwin)
USE_MIMALLOC = 0
+else ifeq ($(OS), SerenityOS)
+ USE_MIMALLOC = 0
else ifeq ($(IS_ANDROID), 1)
USE_MIMALLOC = 0
endif

View File

@ -11,7 +11,7 @@ library for mold, but the OS detection logic still needs updated.
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/third-party/tbb/src/tbb/allocator.cpp b/third-party/tbb/src/tbb/allocator.cpp
index f30ded6..0acccef 100644
index f30ded675f1372d572f4156489b15655cd302b2e..0acccef4b2521eee061e4df0aa8dd055e57f41c3 100644
--- a/third-party/tbb/src/tbb/allocator.cpp
+++ b/third-party/tbb/src/tbb/allocator.cpp
@@ -101,7 +101,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
@ -24,7 +24,7 @@ index f30ded6..0acccef 100644
#elif __unix__ // Note that order of these #elif's is important!
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so.2"
diff --git a/third-party/tbb/src/tbb/rml_tbb.cpp b/third-party/tbb/src/tbb/rml_tbb.cpp
index d31a77f..fb676bc 100644
index d31a77fb6ff25ef86557daf946aeefe8fe9db5ca..fb676bc90ec22c624b13835f77b5dda1c8d99d93 100644
--- a/third-party/tbb/src/tbb/rml_tbb.cpp
+++ b/third-party/tbb/src/tbb/rml_tbb.cpp
@@ -50,7 +50,7 @@ namespace rml {

View File

@ -12,7 +12,7 @@ use it will never be used.
1 file changed, 1 insertion(+)
diff --git a/third-party/tbb/src/tbb/dynamic_link.cpp b/third-party/tbb/src/tbb/dynamic_link.cpp
index 3f13425..7dd2169 100644
index 91941adab7d4a73699784aed0d896ff32125b8e0..dddbbe128dd92c860527ae7f8befb105690a81f2 100644
--- a/third-party/tbb/src/tbb/dynamic_link.cpp
+++ b/third-party/tbb/src/tbb/dynamic_link.cpp
@@ -53,6 +53,7 @@

View File

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <andrewdkaster@gmail.com>
Date: Sun, 2 Oct 2022 19:42:51 -0600
Subject: [PATCH] Disable mold-wrapper.so on SerenityOS
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79c035d5f523eece5a6da7c9f0994993ddb00364..368fa741aff60f41ba5842ad2450d87a1bea4401 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,7 +141,7 @@ else()
endif()
endif()
-if(NOT APPLE AND NOT WIN32)
+if(NOT APPLE AND NOT WIN32 AND NOT SERENITYOS)
add_library(mold-wrapper SHARED)
install(TARGETS mold-wrapper DESTINATION ${CMAKE_INSTALL_LIBDIR}/mold)

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Sun, 23 Jan 2022 17:58:07 -0700
Subject: [PATCH] Disable __TBB_RESUMABLE_TASKS for serenity
This feature requires ``<ucontext.h>``, which is not currently
implemented for any supported SerenityOS targets
---
third-party/tbb/include/oneapi/tbb/detail/_config.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/third-party/tbb/include/oneapi/tbb/detail/_config.h b/third-party/tbb/include/oneapi/tbb/detail/_config.h
index 3e07302..3b42d9e 100644
--- a/third-party/tbb/include/oneapi/tbb/detail/_config.h
+++ b/third-party/tbb/include/oneapi/tbb/detail/_config.h
@@ -268,7 +268,7 @@
#define __TBB_CPP20_COMPARISONS_PRESENT __TBB_CPP20_PRESENT
#endif
-#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__)
+#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__ && !__serenity__)
/* This macro marks incomplete code or comments describing ideas which are considered for the future.
* See also for plain comment with TODO and FIXME marks for small improvement opportunities.

View File

@ -1,20 +1,6 @@
# Patches for mold on SerenityOS
## `0001-Disable-mold-wrapper.so-for-Serenity.patch`
Disable mold-wrapper.so for Serenity
This feature depends on RTLD_NEXT capabilities which are not yet
implemented in the Serenity DynamicLoader.
## `0002-Disable-mimalloc-for-serenity.patch`
Disable mimalloc for serenity
mimalloc needs some help to compile and run on serenity.
That's one yak too far for right now.
## `0003-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch`
## `0001-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch`
Tell TBB that SerenityOS does not support weak symbols
@ -23,14 +9,14 @@ references to scalable_malloc to remain in the mold executable even
though there's no chance we'll be loading the tbbmalloc library at
runtime. So, just lie to TBB that we don't support weak symbols.
## `0004-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch`
## `0002-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch`
Tell TBB that SerenityOS libraries are named like BSD ones
We won't be loading these libraries when building TBB as a static
library for mold, but the OS detection logic still needs updated.
## `0005-Stub-out-a-definition-of-RTLD_NOLOAD.patch`
## `0003-Stub-out-a-definition-of-RTLD_NOLOAD.patch`
Stub out a definition of RTLD_NOLOAD
@ -39,10 +25,8 @@ be dynamically loading any tbb extensions for the static library build
mold uses, so we can just define it as a no-op as the code paths that
use it will never be used.
## `0006-Disable-__TBB_RESUMABLE_TASKS-for-serenity.patch`
## `0004-Disable-mold-wrapper.so-on-SerenityOS.patch`
Disable __TBB_RESUMABLE_TASKS for serenity
Disable mold-wrapper.so on SerenityOS
This feature requires ``<ucontext.h>``, which is not currently
implemented for any supported SerenityOS targets