From 7efb8434f4dc79bd91e85c82f79cedff8870148b Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH] New package: mold-0.1.1 --- srcpkgs/mold/patches/00-system-mimalloc.patch | 66 +++++++++++++++++++ srcpkgs/mold/template | 31 +++++++++ 2 files changed, 97 insertions(+) create mode 100644 srcpkgs/mold/patches/00-system-mimalloc.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-system-mimalloc.patch b/srcpkgs/mold/patches/00-system-mimalloc.patch new file mode 100644 index 000000000000..5c05303773a1 --- /dev/null +++ b/srcpkgs/mold/patches/00-system-mimalloc.patch @@ -0,0 +1,66 @@ +diff --git b/Makefile a/Makefile +index cd5effb..fbdaf1a 100644 +--- b/Makefile ++++ a/Makefile +@@ -9,7 +9,7 @@ CPPFLAGS = -g -Imimalloc/include -pthread -std=c++20 \ + -DMOLD_VERSION=\"0.1.1\" \ + -DGIT_HASH=\"$(GIT_HASH)\" \ + $(EXTRA_CPPFLAGS) +-LDFLAGS = $(EXTRA_LDFLAGS) ++LDFLAGS += $(EXTRA_LDFLAGS) + LIBS = -Wl,-as-needed -lcrypto -pthread -ltbb -lz -lxxhash -ldl + OBJS = main.o object_file.o input_sections.o output_chunks.o \ + mapfile.o perf.o linker_script.o archive_file.o output_file.o \ +@@ -40,7 +40,11 @@ else + # By default, we want to use mimalloc as a memory allocator. + # Since replacing the standard malloc is not compatible with ASAN, + # we do that only when ASAN is not enabled. +- LDFLAGS += -Wl,-whole-archive $(MIMALLOC_LIB) -Wl,-no-whole-archive ++ ifndef SYSTEM_MIMALLOC ++ LIBS += -Wl,-whole-archive $(MIMALLOC_LIB) -Wl,-no-whole-archive ++ else ++ LIBS += -lmimalloc ++ endif + endif + + ifeq ($(TSAN), 1) +@@ -50,7 +54,7 @@ endif + + all: mold mold-wrapper.so + +-mold: $(OBJS) $(MIMALLOC_LIB) ++mold: $(OBJS) + $(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) + + mold-wrapper.so: mold-wrapper.c Makefile +@@ -71,20 +75,21 @@ test tests check: all + for i in test/*.sh; do $$i || exit 1; done + + install: all +- install -m 755 mold $(PREFIX)/bin ++ install -m 755 mold $(DESTDIR)$(PREFIX)/bin + strip $(PREFIX)/bin/mold + +- install -m 755 -d $(PREFIX)/lib/mold +- install -m 644 mold-wrapper.so $(PREFIX)/lib/mold +- strip $(PREFIX)/lib/mold/mold-wrapper.so ++ install -m 755 -d $(DESTDIR)$(PREFIX)/lib/mold ++ install -m 644 mold-wrapper.so $(DESTDIR)$(PREFIX)/lib/mold ++ strip $(DESTDIR)$(PREFIX)/lib/mold/mold-wrapper.so + +- install -m 644 docs/mold.1 $(PREFIX)/share/man/man1 +- rm -f $(PREFIX)/share/man/man1/mold.1.gz +- gzip -9 $(PREFIX)/share/man/man1/mold.1 ++ install -m 755 -d $(DESTDIR)$(PREFIX)/share/man/man1 ++ install -m 644 docs/mold.1 $(DESTDIR)$(PREFIX)/share/man/man1 ++ rm -f $(DESTDIR)$(PREFIX)/share/man/man1/mold.1.gz ++ gzip -9 $(DESTDIR)$(PREFIX)/share/man/man1/mold.1 + + uninstall: +- rm -rf $(PREFIX)/bin/mold $(PREFIX)/share/man/man1/mold.1.gz \ +- $(PREFIX)/lib/mold ++ rm -rf $(DESTDIR)$(PREFIX)/bin/mold $(DESTDIR)$(PREFIX)/share/man/man1/mold.1.gz \ ++ $(DESTDIR)$(PREFIX)/lib/mold + + clean: + rm -f *.o *~ mold mold-wrapper.so diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..ad9e9705c4dc --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,31 @@ +# Template file for 'mold' +pkgname=mold +version=0.1.1 +revision=1 +build_style=gnu-makefile +make_build_args="SYSTEM_MIMALLOC=1" +hostmakedepends="clang" +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila " +license="AGPL-3.0-or-later" +homepage="https://github.com/rui314/mold" +changelog="https://github.com/rui314/mold/releases" +distfiles="https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz" +checksum=43b18575334bc50ea4d4876806b4e15b3550fd92ff933a9de7b3c76d47f28684 + +pre_build() { + # gcc 10.2 doesn't fully support C++20 + export CXX=clang++ + # "non-PIE executable found in PIE build" without these lines + CXXFLAGS+=" -fPIC" + LDFLAGS+=" -Wl,-pie" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}