[-- Attachment #1: Type: text/plain, Size: 1572 bytes --] There is a new pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 2217 bytes --] From 922b4c197703546414b4034fe32bbd0cc3bb736c Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + srcpkgs/mimalloc/template | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..23be4862abd2 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4012,4 +4012,5 @@ libinstpatch-1.0.so.2 libinstpatch-1.1.6_1 libbasu.so.0 basu-0.2.0_1 libXcomp.so.3 nx-libs-3.5.99.24_1 libXcompshad.so.3 nx-libs-3.5.99.24_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libNX_X11.so.6 nx-libs-3.5.99.24_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..f8c14c869b46 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,31 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DCMAKE_BUILD_TYPE=RelWithDebInfo" +short_desc="Compact general purpose allocator with excellent performance" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd +_major_ver=${version%.*} + +post_install() { + vlicense LICENSE + mv ${DESTDIR}/usr/include/mimalloc-${_major_ver}/* ${DESTDIR}/usr/include/ + mv ${DESTDIR}/usr/lib/mimalloc-${_major_ver}/* ${DESTDIR}/usr/lib/ +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/mimalloc-${_major_ver}/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 211 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660204996 Comment: `-DMI_INSTALL_TOPLEVEL=ON`, honestly, their build system is broken!!
[-- Attachment #1: Type: text/plain, Size: 208 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660202987 Comment: Why should this line be inserted between 2 libraries of `nx-libs`
[-- Attachment #1: Type: text/plain, Size: 154 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660202874 Comment: No, please!
[-- Attachment #1: Type: text/plain, Size: 219 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660205454 Comment: Please patch their build system to remove the addition of `-none` non-sense.
[-- Attachment #1: Type: text/plain, Size: 219 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660205708 Comment: Patch this line `set(mi_install_cmakedir "cmake")` to `share/cmake` instead.
[-- Attachment #1: Type: text/plain, Size: 231 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660206583 Comment: Honestly, the libraries name suggested its `short_desc` should be: `Microsoft's malloc`.
[-- Attachment #1: Type: text/plain, Size: 231 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660206583 Comment: Honestly, the libraries name suggested its `short_desc` should be: `MIcrosoft's malloc`.
[-- Attachment #1: Type: text/plain, Size: 263 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660207997 Comment: Is it neccessary to upstream the patch? Will it be OK to temporary have patch in `patches` until they accept it?
[-- Attachment #1: Type: text/plain, Size: 277 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660208389 Comment: I've just placed it between 2 random already existing lines to avoid merge conflicts when other line will be added in the end.
[-- Attachment #1: Type: text/plain, Size: 278 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660208389 Comment: I've just placed it between 2 random already existing lines to avoid merge conflicts when other lines will be added in the end.
[-- Attachment #1: Type: text/plain, Size: 361 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660216059 Comment: @sgn why does `common/build-style/cmake.sh` set `CMAKE_BUILD_TYPE` to `None` though? Isn't `RelWithDebInfo` more suitable (so it's release build, but with debug info which can be used to create `-dbg` package)?
[-- Attachment #1: Type: text/plain, Size: 360 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660216059 Comment: @sgn why does `common/build-style/cmake.sh` set `CMAKE_BUILD_TYPE` to `None` though? Isn't `RelWithDebInfo` more logical (so it's release build, but with debug info which can be used to create `-dbg` package)?
[-- Attachment #1: Type: text/plain, Size: 194 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660217089 Comment: Move it somewhere else, please. Somewhere near `m*`
[-- Attachment #1: Type: text/plain, Size: 278 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660208389 Comment: I've just placed it between 2 random already existing lines to avoid merge conflicts when other lines will be added to the end.
[-- Attachment #1: Type: text/plain, Size: 413 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660218263 Comment: - We don't want the flags KitWare implies (`-DNDEBUG`) - racer wants their `-O3` - We allow build without debug, too. And sometime, `-g` is unmanagable, look at `llvm12` ;) - broken build systems are broken build systems, to them, there are only `Debug` and `Release`
[-- Attachment #1: Type: text/plain, Size: 439 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660218263 Comment: - We don't want the flags KitWare implies (`-DNDEBUG`) - racer wants their `-O3` - We allow build without debug, too (`unset XBPS_DEBUG_PKGS`). And sometime, `-g` is unmanagable, look at `llvm12` ;) - broken build systems are broken build systems, to them, there are only `Debug` and `Release`
[-- Attachment #1: Type: text/plain, Size: 172 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r660218918 Comment: @sgn what is KitWare?
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 3262 bytes --] From faa87b8ca196d0860cd0c2facfbc225b5225fb5d Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 +++++++++++++ srcpkgs/mimalloc/template | 28 +++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..6dece8cd5fe5 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,28 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 236 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-870161957 Comment: @sgn please check out if everything is OK now (except for that one failing test of course).
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 3939 bytes --] From a44e547c0ba26206e8a60756ad8feab67d0c273f Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 +++++++++++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++++++++ srcpkgs/mimalloc/template | 28 +++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..8846bfd522b5 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc(PTRDIFF_MAX) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..6dece8cd5fe5 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,28 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 3943 bytes --] From f1e61e12c9eb3d845a4fd30c8688689e0761f813 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 +++++++++++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++++++++ srcpkgs/mimalloc/template | 28 +++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..a66a32bdd6a5 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc(PTRDIFF_MAX + 1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..6dece8cd5fe5 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,28 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 3959 bytes --] From 8d181019cfe4c5e7e85ecb4e6b174867829a8510 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 +++++++++++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++++++++ srcpkgs/mimalloc/template | 28 +++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..6dece8cd5fe5 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,28 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 8361 bytes --] From d08372bb588ed8f51cb1822caf517e9f0e6089d8 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 111 ++++++++++++++++++ srcpkgs/mimalloc/template | 32 +++++ 6 files changed, 176 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ed808e417213 --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,111 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,8 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..579763e885f6 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 8417 bytes --] From 09f1b6cccd2d7c3b9317b2e3bda4352c302a2491 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ srcpkgs/mimalloc/template | 32 +++++ 6 files changed, 177 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..579763e885f6 --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 190 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-870886039 Comment: @sgn apparently it's fixed now, please verify
[-- Attachment #1: Type: text/plain, Size: 382 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-870886039 Comment: @sgn apparently it's fixed now, please verify I've opened PRs to try to upstream the patches: https://github.com/microsoft/mimalloc/pull/427, https://github.com/microsoft/mimalloc/pull/428, https://github.com/microsoft/mimalloc/pull/429
[-- Attachment #1: Type: text/plain, Size: 386 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-870886039 Comment: @sgn apparently it's fixed now, please verify I've opened the PRs to try to upstream the patches: https://github.com/microsoft/mimalloc/pull/427, https://github.com/microsoft/mimalloc/pull/428, https://github.com/microsoft/mimalloc/pull/429
[-- Attachment #1: Type: text/plain, Size: 210 bytes --] New review comment by travankor on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r661272915 Comment: why not add ` -DMI_SECURE=on`? This adds security mitigations
[-- Attachment #1: Type: text/plain, Size: 499 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r661416118 Comment: @travankor I've thought about adding this flag, but then looked at the performance graphs and saw a performance hit, and thus didn't add the flag. Though for most benchmarks mimalloc is still faster than glibc's allocator even with mitigations. And Void cares about security hardening, so I've reconsidered my decision and will enable mitigations.
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 9327 bytes --] From 24ea140d5faf56a845e01a686a0c687713bfdd6b Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +}
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New package: mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 14591 bytes --] From 24ea140d5faf56a845e01a686a0c687713bfdd6b Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From d571b4ecd02fa02af07cd7e565cf63e51a74f37a Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.1 --- srcpkgs/mold/patches/00-makefile.patch | 84 ++++++++++++++++++++++++++ srcpkgs/mold/template | 45 ++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 srcpkgs/mold/patches/00-makefile.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-makefile.patch b/srcpkgs/mold/patches/00-makefile.patch new file mode 100644 index 000000000000..9bb0594b6141 --- /dev/null +++ b/srcpkgs/mold/patches/00-makefile.patch @@ -0,0 +1,84 @@ +diff --git a/Makefile b/Makefile +index 207f54c..e20a55d 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,15 +1,14 @@ + CC = clang + CXX = clang++ + +-MIMALLOC_LIB = mimalloc/out/release/libmimalloc.a +-GIT_HASH = $(shell [ -d .git ] && git rev-parse HEAD) ++GIT_HASH ?= $(shell [ -d .git ] && git rev-parse HEAD) + + CPPFLAGS = -g -Imimalloc/include -pthread -std=c++20 \ + -Wno-deprecated-volatile \ + -DMOLD_VERSION=\"0.9.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 \ +@@ -41,7 +40,12 @@ 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 ++ ifdef SYSTEM_MIMALLOC ++ LIBS += -lmimalloc ++ else ++ MIMALLOC_LIB = mimalloc/out/release/libmimalloc.a ++ LIBS += -Wl,-whole-archive $(MIMALLOC_LIB) -Wl,-no-whole-archive ++ endif + endif + + ifeq ($(TSAN), 1) +@@ -52,7 +56,7 @@ endif + all: mold mold-wrapper.so + + mold: $(OBJS) $(MIMALLOC_LIB) +- $(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) ++ $(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) + + mold-wrapper.so: mold-wrapper.c Makefile + $(CC) -fPIC -shared -o $@ $< -ldl +@@ -62,26 +66,27 @@ $(OBJS): mold.h elf.h Makefile + $(MIMALLOC_LIB): + mkdir -p mimalloc/out/release + (cd mimalloc/out/release; CFLAGS=-DMI_USE_ENVIRON=0 cmake ../..) +- $(MAKE) -C mimalloc/out/release ++ $(MAKE) -C mimalloc/out/release mimalloc-static + + test tests check: all + $(MAKE) -C test --output-sync --no-print-directory + + install: all +- install -m 755 mold $(PREFIX)/bin +- strip $(PREFIX)/bin/mold ++ install -m 755 mold $(DESTDIR)$(PREFIX)/bin ++ strip $(DESTDIR)$(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 -rf *.o *~ mold mold-wrapper.so test/tmp diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..286eccb54b38 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,45 @@ +# Template file for 'mold' +pkgname=mold +version=0.9.1 +revision=1 +build_style=gnu-makefile +hostmakedepends="clang" +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=02b156de6cd2d94fea4eed9748a7c96955673d810ec672359f603f2f90e2990d +_commit_hash=9a09c777d9460ebe7eb498d1cc0327915f8bbcdc + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 + +pre_build() { + # gcc 10.2 doesn't fully support C++20 + export CXX=clang++ + + # fix cross + if [ "$CROSS_BUILD" ]; then + CXXFLAGS+=" -target ${XBPS_CROSS_TRIPLET}" + CXXFLAGS+=" -I/usr/${XBPS_CROSS_TRIPLET}/usr/include/c++/10.2/${XBPS_CROSS_TRIPLET}" + LDFLAGS+=" -L/usr/${XBPS_CROSS_TRIPLET}/lib" + fi + + # "non-PIE executable found in PIE build" without these lines + CXXFLAGS+=" -fPIC" + LDFLAGS+=" -pie" + + # commit hash for --version + export GIT_HASH=$_commit_hash +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 463 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662201036 Comment: @q66 please help with this: https://github.com/void-linux/void-packages/pull/31706/checks?check_run_id=2961521405#step:8:336 Why is `chroot-grep` built without `PCRE` support? And how to install normal `grep` as `checkdepends` while avoiding the conflict with `chroot-grep`? Or should I patch this test somehow?
[-- Attachment #1: Type: text/plain, Size: 158 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662197101 Comment: archs="x86_64*"
[-- Attachment #1: Type: text/plain, Size: 197 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662198477 Comment: @q66 why? the build for other archs is fixable
[-- Attachment #1: Type: text/plain, Size: 327 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662201036 Comment: @q66 please help with this: https://github.com/void-linux/void-packages/pull/31706/checks?check_run_id=2961521405#step:8:336 Why is `chroot-grep` built without `PCRE` support?
[-- Attachment #1: Type: text/plain, Size: 453 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662276527 Comment: "Currently, mold is being developed with Linux/x86-64 as the primary target platform. mold can link many user-land programs including large ones such as web browsers for that target. It also has preliminary Linux/i386 support. Supporting other OSes and ISAs are planned after Linux/x86-64 support is complete."
[-- Attachment #1: Type: text/plain, Size: 215 bytes --] New review comment by Vaelatern on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662284903 Comment: that line should be in a comment so people know why archs is there
[-- Attachment #1: Type: text/plain, Size: 224 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662288799 Comment: it's right there in the project readme, which @Logarithmus apparently hasn't read
[-- Attachment #1: Type: text/plain, Size: 220 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662292956 Comment: Leave this new version, otherwise people will forget to update the value.
[-- Attachment #1: Type: text/plain, Size: 180 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662294146 Comment: You're hardcoding the GCC version
[-- Attachment #1: Type: text/plain, Size: 319 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662293918 Comment: clang doesn't support C++20 fully either, so this doesn't explain why it's necessary. Using a different compiler for something as transient as standard support isn't great.
[-- Attachment #1: Type: text/plain, Size: 247 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662298611 Comment: Report this upstream, I find it hard to believe it actually needs 64 bit atomics on 32 bit platforms
[-- Attachment #1: Type: text/plain, Size: 195 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662296217 Comment: This looks like it should be upstreamed as well.
[-- Attachment #1: Type: text/plain, Size: 268 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662295859 Comment: You can run make install with `PREFIX=$DESTDIR$PREFIX` and avoid the patch. Though it should be upstreamed at some point.
[-- Attachment #1: Type: text/plain, Size: 221 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662292956 Comment: Leave this near version, otherwise people will forget to update the value.
[-- Attachment #1: Type: text/plain, Size: 1180 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662299349 Comment: > it's right there in the project readme, which @Logarithmus apparently hasn't read Please, don't make assumptions about the others if you don't know the whole story. I've read the README multiple times, even contributed to it (https://github.com/rui314/mold/pull/63). This line states that `mold` does support only x86_64 **as a target platform**. The line doesn't say anything about supported **host platform**. So I tried to cross build `mold` for `aarch64` on my laptop and it finised successfully. CI run for `aarch64` worked as well: https://github.com/void-linux/void-packages/pull/31706/checks?check_run_id=2961521454. After you've posted [this comment](https://github.com/void-linux/void-packages/pull/31706#discussion_r662276527), I asked the author of `mold` if it supports cross linking. The answer was "yes". You can read it [here](https://github.com/rui314/mold/issues/55#issuecomment-872239804). I didn't try it in practice yet though. Summing up: your suggestion about adding `cross=x86_64*` is wrong.
[-- Attachment #1: Type: text/plain, Size: 215 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662307932 Comment: I'll place it after `revision`, otherwise `xlint` will complain.
[-- Attachment #1: Type: text/plain, Size: 243 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662307080 Comment: It's upstreamed at this moment, but no new tag released yet. I can ask him for a tag though.
[-- Attachment #1: Type: text/plain, Size: 213 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662311127 Comment: any way to avoid this? doing some `ls` with `sed` stuff maybe?
[-- Attachment #1: Type: text/plain, Size: 326 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662310600 Comment: @ericonr hmm we still have gcc 10.2 in Void, and it's older than clang 12, and that's why our gcc doesn't support c++20. When our gcc will be updated, we will ditch this line.
[-- Attachment #1: Type: text/plain, Size: 603 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662302207 Comment: I don't know if it needs 64 bit atomics on 32 bit platforms. I borrowed this code from `llvm`: ``` +# Based on: +# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake +# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ``` If you think this patch can be made smaller, I welcome the suggestions.
[-- Attachment #1: Type: text/plain, Size: 308 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662304376 Comment: It has been upstreamed already: https://github.com/rui314/mold/pull/62, https://github.com/rui314/mold/pull/64. But no new releases made with this patch yet.
[-- Attachment #1: Type: text/plain, Size: 266 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662307932 Comment: I'll place it after `revision`, otherwise `xlint` will complain. **UPD** placing it *before* `version` also works.
[-- Attachment #1: Type: text/plain, Size: 271 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662316768 Comment: This patch contains more than just `$(DESTDIR)` stuff, and so your suggestion won't work, and so I'll leave it as it is.
[-- Attachment #1: Type: text/plain, Size: 629 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662322966 Comment: so, you admit you haven't verified it supports cross linking before i posted my comment CI for cross architectures is pointless when it comes to verifying whether things work, since tests do not run the linker still defaults to x86_64 mode when run without arguments (rather than explicitly erroring about unsupported architecture), and the usefulness of using an experimental linker to cross-link from some other arch to x86_64 is questionable, so i'd still make it archs=x86_64*
[-- Attachment #1: Type: text/plain, Size: 1768 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662338735 Comment: @q66 >CI for cross architectures is pointless when it comes to verifying whether things work, since tests do not run Is it possible to use `qemu` to fix that? Just asking about theoretical possibility, and not the complexity. >the linker still defaults to x86_64 mode when run without arguments (rather than explicitly erroring about unsupported architecture) Are talking about `mold` specifically or about linkers in general? If about `mold`, I guess the error message can be added quite easily, since the author of `mold` is a very nice person and accepts contributions without much bureocracy. >the usefulness of using an experimental linker to cross-link from some other arch to x86_64 is questionable Please, don't decide for the other Void users, noone forces personally you to use `mold`. Like Arch, Void is a popular distro among Linux users who like experimenting, and having `mold` in a repos for other architectures certainly won't harm anyone. About "experimental": if you didn't know, `mold`'s author is also an original author of `lld`. Also read the release notes for `v0.9.0`: https://github.com/rui314/mold/releases/tag/v0.9#:~:text=We%20bumped%20the%20mold%27s%20version%20from%200.1.1%20to%200.9%20to%20show%20that%20mold%20is%20getting%20ready%20for%20production. >so i'd still make it archs=x86_64* You would make it `archs=x86_64*`, but I don't see a reason for this sort of gatekeeping. You sound like if Void is a super-stable Debian-like distro where every packages is supposedly needed to be very thoroughly tested before geting into the repo, but it's simply not true.
[-- Attachment #1: Type: text/plain, Size: 1772 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662338735 Comment: @q66 >CI for cross architectures is pointless when it comes to verifying whether things work, since tests do not run Is it possible to use `qemu` to fix that? Just asking about theoretical possibility, and not the complexity. >the linker still defaults to x86_64 mode when run without arguments (rather than explicitly erroring about unsupported architecture) Are you talking about `mold` specifically or about linkers in general? If about `mold`, I guess the error message can be added quite easily, since the author of `mold` is a very nice person and accepts contributions without much bureocracy. >the usefulness of using an experimental linker to cross-link from some other arch to x86_64 is questionable Please, don't decide for the other Void users, noone forces personally you to use `mold`. Like Arch, Void is a popular distro among Linux users who like experimenting, and having `mold` in a repos for other architectures certainly won't harm anyone. About "experimental": if you didn't know, `mold`'s author is also an original author of `lld`. Also read the release notes for `v0.9.0`: https://github.com/rui314/mold/releases/tag/v0.9#:~:text=We%20bumped%20the%20mold%27s%20version%20from%200.1.1%20to%200.9%20to%20show%20that%20mold%20is%20getting%20ready%20for%20production. >so i'd still make it archs=x86_64* You would make it `archs=x86_64*`, but I don't see a reason for this sort of gatekeeping. You sound like if Void is a super-stable Debian-like distro where every packages is supposedly needed to be very thoroughly tested before geting into the repo, but it's simply not true.
[-- Attachment #1: Type: text/plain, Size: 281 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662342685 Comment: on the contrary, you seem to be deciding that things do not need to be well tested before getting into the repo, which is simply not true
[-- Attachment #1: Type: text/plain, Size: 399 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662348271 Comment: @q66 I'm all in for well package testing. My point is that IMO many Void packages hasn't been tested at all on all those non x86_64 architectures, especially `armv6`, but they don't have `archs=x86_64*` in their templates. Correct me if I'm wrong.
[-- Attachment #1: Type: text/plain, Size: 487 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662348271 Comment: @q66 I'm all in for well package testing. My point is that IMO many Void packages hasn't been tested at all on all those non x86_64 architectures, especially `armv6`, but they don't have `archs=x86_64*` in their templates. Looks like double standards. Or maybe package quality criterias have been toughened up? Correct me if I'm wrong.
[-- Attachment #1: Type: text/plain, Size: 488 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662348271 Comment: @q66 I'm all in for well package testing. My point is that IMO many Void packages haven't been tested at all on all those non x86_64 architectures, especially `armv6`, but they don't have `archs=x86_64*` in their templates. Looks like double standards. Or maybe package quality criterias have been toughened up? Correct me if I'm wrong.
[-- Attachment #1: Type: text/plain, Size: 226 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662355166 Comment: @ericonr let's wait for a release: https://github.com/rui314/mold/issues/65
[-- Attachment #1: Type: text/plain, Size: 1095 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662359071 Comment: 1) in the past things have been overly lax (until recently there wasn't even CI with unit tests) 2) with most things it's generally safe to assume things work okay, since most things don't have platform specific code, and weren't developed with any specific platform in mind 3) this is a thing that explicitly has platform specific code, and is developed with a single platform in mind for the time being considering making this work for cross targets involves special compiler setup that complicates the template, and fixing other targets appears to require patching, and even if you do make it build it will not be tested, i don't see any reason to include it in the packages - and i can pretty much guarantee you that there will be zero users trying to link with mold from an arm/ppc/whatever host to x86_64 target (until recently we didn't even ship cross-compilers to x86_64 and nobody complained for years, until i went ahead and added them)
[-- Attachment #1: Type: text/plain, Size: 229 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662371749 Comment: Why would you add the patch if it doesn't need 64-bit atomics on 32-bit platforms?
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662372322 Comment: @q66 >until recently we didn't even ship cross-compilers to x86_64 and nobody complained for years, until i went ahead and added them Honestly, did you test all of those cross-compilers before adding them? :) > making this work for cross targets involves special compiler setup that complicates the template 5 lines of bash, muh much complicated, many code, compared to ``` $ find srcpkgs -name template | xargs wc -l | sort -kh1 343 srcpkgs/php/template 359 srcpkgs/rust/template 361 srcpkgs/electron10/template 369 srcpkgs/gcc6/template 385 srcpkgs/electron12/template 399 srcpkgs/texlive/template 423 srcpkgs/llvm12/template 435 srcpkgs/boost/template 441 srcpkgs/mesa/template 661 srcpkgs/libreoffice/template 723 srcpkgs/gcc/template 1164 srcpkgs/qt5/template 1220 srcpkgs/tesseract-ocr/template ```
[-- Attachment #1: Type: text/plain, Size: 332 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662373879 Comment: That's not how things work. Compilers move at difference paces, so having something newer or older than the other doesn't really mean a lot. What errors does it get when built with gcc?
[-- Attachment #1: Type: text/plain, Size: 349 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662375055 Comment: @ericonr because it fails to compile on `armv6`. Saying something about `atomic_add8` (or something similar). So apparently it wants 64bit atomics. See https://github.com/microsoft/mimalloc/pull/429
[-- Attachment #1: Type: text/plain, Size: 1781 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.1, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] Fix this for `i686` & `armv6`: ``` test: malloc-nomem1... FAILED: ../test/test-api.c:85: { result = (mi_malloc(SIZE_MAX/2) == NULL); } ``` #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 15772 bytes --] From 24ea140d5faf56a845e01a686a0c687713bfdd6b Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 8a7eef8df8c3..79fd2f5c3de0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -417,6 +417,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 4a8ae0bbfaf8b18f23d5cf796640d1d39da39371 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.1 --- srcpkgs/mold/patches/00-makefile.patch | 84 ++++++++++++++++++++ srcpkgs/mold/patches/01-grep-pcre-test.patch | 14 ++++ srcpkgs/mold/template | 46 +++++++++++ 3 files changed, 144 insertions(+) create mode 100644 srcpkgs/mold/patches/00-makefile.patch create mode 100644 srcpkgs/mold/patches/01-grep-pcre-test.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-makefile.patch b/srcpkgs/mold/patches/00-makefile.patch new file mode 100644 index 000000000000..9bb0594b6141 --- /dev/null +++ b/srcpkgs/mold/patches/00-makefile.patch @@ -0,0 +1,84 @@ +diff --git a/Makefile b/Makefile +index 207f54c..e20a55d 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,15 +1,14 @@ + CC = clang + CXX = clang++ + +-MIMALLOC_LIB = mimalloc/out/release/libmimalloc.a +-GIT_HASH = $(shell [ -d .git ] && git rev-parse HEAD) ++GIT_HASH ?= $(shell [ -d .git ] && git rev-parse HEAD) + + CPPFLAGS = -g -Imimalloc/include -pthread -std=c++20 \ + -Wno-deprecated-volatile \ + -DMOLD_VERSION=\"0.9.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 \ +@@ -41,7 +40,12 @@ 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 ++ ifdef SYSTEM_MIMALLOC ++ LIBS += -lmimalloc ++ else ++ MIMALLOC_LIB = mimalloc/out/release/libmimalloc.a ++ LIBS += -Wl,-whole-archive $(MIMALLOC_LIB) -Wl,-no-whole-archive ++ endif + endif + + ifeq ($(TSAN), 1) +@@ -52,7 +56,7 @@ endif + all: mold mold-wrapper.so + + mold: $(OBJS) $(MIMALLOC_LIB) +- $(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) ++ $(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) + + mold-wrapper.so: mold-wrapper.c Makefile + $(CC) -fPIC -shared -o $@ $< -ldl +@@ -62,26 +66,27 @@ $(OBJS): mold.h elf.h Makefile + $(MIMALLOC_LIB): + mkdir -p mimalloc/out/release + (cd mimalloc/out/release; CFLAGS=-DMI_USE_ENVIRON=0 cmake ../..) +- $(MAKE) -C mimalloc/out/release ++ $(MAKE) -C mimalloc/out/release mimalloc-static + + test tests check: all + $(MAKE) -C test --output-sync --no-print-directory + + install: all +- install -m 755 mold $(PREFIX)/bin +- strip $(PREFIX)/bin/mold ++ install -m 755 mold $(DESTDIR)$(PREFIX)/bin ++ strip $(DESTDIR)$(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 -rf *.o *~ mold mold-wrapper.so test/tmp diff --git a/srcpkgs/mold/patches/01-grep-pcre-test.patch b/srcpkgs/mold/patches/01-grep-pcre-test.patch new file mode 100644 index 000000000000..34eb0222bc66 --- /dev/null +++ b/srcpkgs/mold/patches/01-grep-pcre-test.patch @@ -0,0 +1,14 @@ +# This patch is required because `chroot-grep` doesn't support PCRE. +# Adding ordinary `grep` to `checkdepends` won't work because `grep` conflicts with `chroot-grep`. +# So instead we use `ripgrep`, which is a tool similar to `grep`. +--- a/test/build-id.sh ++++ b/test/build-id.sh +@@ -12,7 +12,7 @@ readelf -n $t/exe | grep -qv 'GNU.*0x00000010.*NT_GNU_BUILD_ID' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=uuid + readelf -nW $t/exe | +- grep -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' ++ rg -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=md5 + readelf -n $t/exe | grep -q 'GNU.*0x00000010.*NT_GNU_BUILD_ID' diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..1c2f7f8bf0a3 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,46 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=9a09c777d9460ebe7eb498d1cc0327915f8bbcdc +version=0.9.1 +revision=1 +build_style=gnu-makefile +hostmakedepends="clang" +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=02b156de6cd2d94fea4eed9748a7c96955673d810ec672359f603f2f90e2990d + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 + +pre_build() { + # gcc 10.2 doesn't fully support C++20 + # export CXX=clang++ + + # # fix cross + # if [ "$CROSS_BUILD" ]; then + # CXXFLAGS+=" -target ${XBPS_CROSS_TRIPLET}" + # CXXFLAGS+=" -I/usr/${XBPS_CROSS_TRIPLET}/usr/include/c++/10.2/${XBPS_CROSS_TRIPLET}" + # LDFLAGS+=" -L/usr/${XBPS_CROSS_TRIPLET}/lib" + # fi + + # "non-PIE executable found in PIE build" without these lines + # CXXFLAGS+=" -fPIC" + # LDFLAGS+=" -pie" + + # commit hash for --version + export GIT_HASH=$_commit_hash +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 347 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662385690 Comment: @ericonr hmm now it compiled just fine... Maybe a change in some of the patches did the trick. Because at the very beginning there were some errors in g++ which I unfortunately don't remember now.
[-- Attachment #1: Type: text/plain, Size: 290 bytes --] New review comment by q66 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662387903 Comment: > Honestly, did you test all of those cross-compilers before adding them? :) > of course i did, i cross-bootstrapped the entire system with them
[-- Attachment #1: Type: text/plain, Size: 175 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662391728 Comment: Apparently GCC now works
[-- Attachment #1: Type: text/plain, Size: 177 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662392159 Comment: Waiting for rui314/mold#65
[-- Attachment #1: Type: text/plain, Size: 386 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662395897 Comment: @q66 do you have all those boards with `armv6`, `armv7`, etc. CPUs? Or did you use `qemu`? When I'll resolve all `mold` cross-build issues, can I kindly ask you to run the tests (it should take only a couple of minutes for each arch)?
[-- Attachment #1: Type: text/plain, Size: 433 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662395897 Comment: @q66 do you have all those boards with `armv6`, `armv7`, etc. CPUs? Or did you use `qemu`? When I'll resolve all `mold` cross-build issues, can I kindly ask you to run the tests (it should take only a couple of minutes for each arch)? If you don't have time, can I use `qemu` then?
[-- Attachment #1: Type: text/plain, Size: 167 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662453232 Comment: Google is your friend ;)
[-- Attachment #1: Type: text/plain, Size: 234 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662454588 Comment: @sgn adding "cmake" to my search query worked. TLDR; it's the company behind CMake
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.1, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [ ] run and possibly fix tests for `mold` for all other architectures - [ ] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 22703 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From ce5731ca2f95f9128b51e5cb197913da91969a24 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-grep.patch | 279 +++++++++++++++++++++++++++++ srcpkgs/mold/template | 38 ++++ 2 files changed, 317 insertions(+) create mode 100644 srcpkgs/mold/patches/00-grep.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-grep.patch b/srcpkgs/mold/patches/00-grep.patch new file mode 100644 index 000000000000..fa939d96a22a --- /dev/null +++ b/srcpkgs/mold/patches/00-grep.patch @@ -0,0 +1,279 @@ +--- a/test/build-id.sh ++++ b/test/build-id.sh +@@ -12,7 +12,7 @@ readelf -n $t/exe | grep -qv 'GNU.*0x00000010.*NT_GNU_BUILD_ID' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=uuid + readelf -nW $t/exe | +- grep -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' ++ rg -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=md5 + readelf -n $t/exe | grep -q 'GNU.*0x00000010.*NT_GNU_BUILD_ID' +--- a/test/copyrel-relro.sh ++++ b/test/copyrel-relro.sh +@@ -22,7 +22,7 @@ EOF + clang -fuse-ld=`pwd`/../mold $t/a.o $t/b.so -o $t/exe + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log +-grep -Pqz '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log + + echo OK +--- a/test/demangle.sh ++++ b/test/demangle.sh +@@ -16,10 +16,10 @@ EOF + grep -q 'undefined symbol: .*: _Z3fooii' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-demangle 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + cat <<EOF | clang -c -o $t/b.o -xc - + extern int Pi; +--- a/test/dt_init.sh ++++ b/test/dt_init.sh +@@ -18,15 +18,15 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-init,init -Wl,-fini,fini + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log + + echo OK +--- a/test/dt_needed.sh ++++ b/test/dt_needed.sh +@@ -23,7 +23,7 @@ clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L $t -lfoo + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libfoo]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o $t/libbar.so +-readelf --dynamic $t/exe | grep -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' ++readelf --dynamic $t/exe | rg -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L$t -lbar + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libbar.so]' +--- a/test/dynamic.sh ++++ b/test/dynamic.sh +@@ -14,7 +14,7 @@ fgrep -q 'Shared library: [libc.so.6]' $t/log + fgrep -q 'Shared library: [ld-linux-x86-64.so.2]' $t/log + + readelf -W --symbols --use-dynamic $t/exe > $t/log2 +-grep -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 ++rg -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 + + cat <<EOF | clang -c -fPIC -o $t/b.o -xc - + #include <stdio.h> +--- a/test/ifunc-export.sh ++++ b/test/ifunc-export.sh +@@ -32,6 +32,6 @@ resolve_foobar: + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-readelf --dyn-syms $t/b.so | grep -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' ++readelf --dyn-syms $t/b.so | rg -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' + + echo OK +--- a/test/image-base.sh ++++ b/test/image-base.sh +@@ -16,6 +16,6 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,--image-base=0x8000000 + $t/exe | grep -q 'Hello world' +-readelf -W --sections $t/exe | grep -Pq '.interp\s+PROGBITS\s+0000000008000...\b' ++readelf -W --sections $t/exe | rg -Pq '.interp\s+PROGBITS\s+0000000008000...\b' + + echo OK +--- a/test/note.sh ++++ b/test/note.sh +@@ -31,9 +31,9 @@ EOF + ../mold -static -o $t/exe $t/a.o + readelf -W --sections $t/exe > $t/log + +-grep -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log +-grep -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log +-grep -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log ++rg -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log ++rg -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log ++rg -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log + + readelf --segments $t/exe > $t/log + fgrep -q '01 .note.bar' $t/log +--- a/test/pltgot.sh ++++ b/test/pltgot.sh +@@ -26,6 +26,6 @@ EOF + + objdump -d -j .plt.got $t/exe > $t/log + +-grep -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log ++rg -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log + + echo OK +--- a/test/relax.sh ++++ b/test/relax.sh +@@ -39,43 +39,43 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log +-grep -Pq 'callq.*<foo>' $t/log +-grep -Pq 'jmpq.*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log ++rg -Pq 'callq.*<foo>' $t/log ++rg -Pq 'jmpq.*<foo>' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o -Wl,-no-relax + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log +-grep -Pq 'callq.*\(%rip\)' $t/log +-grep -Pq 'jmpq.*\(%rip\)' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log ++rg -Pq 'callq.*\(%rip\)' $t/log ++rg -Pq 'jmpq.*\(%rip\)' $t/log + + echo OK +--- a/test/shared.sh ++++ b/test/shared.sh +@@ -19,7 +19,7 @@ clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o + readelf --dyn-syms $t/b.so > $t/log + + grep -q '0000000000000000 0 NOTYPE GLOBAL DEFAULT UND fn2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log + + cat <<EOF | clang -fPIC -c -o $t/c.o -xc - + #include <stdio.h> +--- a/test/symtab.sh ++++ b/test/symtab.sh +@@ -28,11 +28,11 @@ echo '{ local: module_local; };' > $t/c.map + + readelf --symbols $t/exe > $t/log + +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log + + echo OK +--- a/test/thin-archive.sh ++++ b/test/thin-archive.sh +@@ -34,9 +34,9 @@ rm -f $t/d.a + + clang -fuse-ld=`pwd`/../mold -Wl,--trace -o $t/exe $t/d.o $t/d.a > $t/log + +-grep -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(.*b.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log + fgrep -q thin-archive/d.o $t/log + + $t/exe | grep -q 15 +--- a/test/z_nodump.sh ++++ b/test/z_nodump.sh +@@ -10,9 +10,9 @@ void foo() {} + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-! readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' || false ++! readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' || false + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,nodump +-readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' ++readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' + + echo OK +--- a/test/z_origin.sh ++++ b/test/z_origin.sh +@@ -15,7 +15,7 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-z,origin + +-readelf --dynamic $t/exe | grep -Pq '\(FLAGS\)\s+ORIGIN' +-readelf --dynamic $t/exe | grep -Pq 'Flags: ORIGIN' ++readelf --dynamic $t/exe | rg -Pq '\(FLAGS\)\s+ORIGIN' ++readelf --dynamic $t/exe | rg -Pq 'Flags: ORIGIN' + + echo OK diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..8359114c3145 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,38 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +# skip 32-bit tests on 64-bit musl, because musl doesn't support multilib +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +else + rm test/i386*.sh +fi + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.1, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [ ] run and possibly fix tests for `mold` for all other architectures - [ ] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 23311 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 9b9c8baec62455963b85de4addda8975c9dda9c7 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-grep.patch | 279 ++++++++++++++++++ srcpkgs/mold/patches/01-undef-page-size.patch | 15 + srcpkgs/mold/template | 38 +++ 3 files changed, 332 insertions(+) create mode 100644 srcpkgs/mold/patches/00-grep.patch create mode 100644 srcpkgs/mold/patches/01-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-grep.patch b/srcpkgs/mold/patches/00-grep.patch new file mode 100644 index 000000000000..fa939d96a22a --- /dev/null +++ b/srcpkgs/mold/patches/00-grep.patch @@ -0,0 +1,279 @@ +--- a/test/build-id.sh ++++ b/test/build-id.sh +@@ -12,7 +12,7 @@ readelf -n $t/exe | grep -qv 'GNU.*0x00000010.*NT_GNU_BUILD_ID' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=uuid + readelf -nW $t/exe | +- grep -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' ++ rg -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=md5 + readelf -n $t/exe | grep -q 'GNU.*0x00000010.*NT_GNU_BUILD_ID' +--- a/test/copyrel-relro.sh ++++ b/test/copyrel-relro.sh +@@ -22,7 +22,7 @@ EOF + clang -fuse-ld=`pwd`/../mold $t/a.o $t/b.so -o $t/exe + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log +-grep -Pqz '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log + + echo OK +--- a/test/demangle.sh ++++ b/test/demangle.sh +@@ -16,10 +16,10 @@ EOF + grep -q 'undefined symbol: .*: _Z3fooii' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-demangle 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + cat <<EOF | clang -c -o $t/b.o -xc - + extern int Pi; +--- a/test/dt_init.sh ++++ b/test/dt_init.sh +@@ -18,15 +18,15 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-init,init -Wl,-fini,fini + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log + + echo OK +--- a/test/dt_needed.sh ++++ b/test/dt_needed.sh +@@ -23,7 +23,7 @@ clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L $t -lfoo + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libfoo]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o $t/libbar.so +-readelf --dynamic $t/exe | grep -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' ++readelf --dynamic $t/exe | rg -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L$t -lbar + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libbar.so]' +--- a/test/dynamic.sh ++++ b/test/dynamic.sh +@@ -14,7 +14,7 @@ fgrep -q 'Shared library: [libc.so.6]' $t/log + fgrep -q 'Shared library: [ld-linux-x86-64.so.2]' $t/log + + readelf -W --symbols --use-dynamic $t/exe > $t/log2 +-grep -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 ++rg -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 + + cat <<EOF | clang -c -fPIC -o $t/b.o -xc - + #include <stdio.h> +--- a/test/ifunc-export.sh ++++ b/test/ifunc-export.sh +@@ -32,6 +32,6 @@ resolve_foobar: + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-readelf --dyn-syms $t/b.so | grep -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' ++readelf --dyn-syms $t/b.so | rg -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' + + echo OK +--- a/test/image-base.sh ++++ b/test/image-base.sh +@@ -16,6 +16,6 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,--image-base=0x8000000 + $t/exe | grep -q 'Hello world' +-readelf -W --sections $t/exe | grep -Pq '.interp\s+PROGBITS\s+0000000008000...\b' ++readelf -W --sections $t/exe | rg -Pq '.interp\s+PROGBITS\s+0000000008000...\b' + + echo OK +--- a/test/note.sh ++++ b/test/note.sh +@@ -31,9 +31,9 @@ EOF + ../mold -static -o $t/exe $t/a.o + readelf -W --sections $t/exe > $t/log + +-grep -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log +-grep -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log +-grep -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log ++rg -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log ++rg -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log ++rg -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log + + readelf --segments $t/exe > $t/log + fgrep -q '01 .note.bar' $t/log +--- a/test/pltgot.sh ++++ b/test/pltgot.sh +@@ -26,6 +26,6 @@ EOF + + objdump -d -j .plt.got $t/exe > $t/log + +-grep -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log ++rg -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log + + echo OK +--- a/test/relax.sh ++++ b/test/relax.sh +@@ -39,43 +39,43 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log +-grep -Pq 'callq.*<foo>' $t/log +-grep -Pq 'jmpq.*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log ++rg -Pq 'callq.*<foo>' $t/log ++rg -Pq 'jmpq.*<foo>' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o -Wl,-no-relax + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log +-grep -Pq 'callq.*\(%rip\)' $t/log +-grep -Pq 'jmpq.*\(%rip\)' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log ++rg -Pq 'callq.*\(%rip\)' $t/log ++rg -Pq 'jmpq.*\(%rip\)' $t/log + + echo OK +--- a/test/shared.sh ++++ b/test/shared.sh +@@ -19,7 +19,7 @@ clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o + readelf --dyn-syms $t/b.so > $t/log + + grep -q '0000000000000000 0 NOTYPE GLOBAL DEFAULT UND fn2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log + + cat <<EOF | clang -fPIC -c -o $t/c.o -xc - + #include <stdio.h> +--- a/test/symtab.sh ++++ b/test/symtab.sh +@@ -28,11 +28,11 @@ echo '{ local: module_local; };' > $t/c.map + + readelf --symbols $t/exe > $t/log + +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log + + echo OK +--- a/test/thin-archive.sh ++++ b/test/thin-archive.sh +@@ -34,9 +34,9 @@ rm -f $t/d.a + + clang -fuse-ld=`pwd`/../mold -Wl,--trace -o $t/exe $t/d.o $t/d.a > $t/log + +-grep -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(.*b.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log + fgrep -q thin-archive/d.o $t/log + + $t/exe | grep -q 15 +--- a/test/z_nodump.sh ++++ b/test/z_nodump.sh +@@ -10,9 +10,9 @@ void foo() {} + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-! readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' || false ++! readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' || false + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,nodump +-readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' ++readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' + + echo OK +--- a/test/z_origin.sh ++++ b/test/z_origin.sh +@@ -15,7 +15,7 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-z,origin + +-readelf --dynamic $t/exe | grep -Pq '\(FLAGS\)\s+ORIGIN' +-readelf --dynamic $t/exe | grep -Pq 'Flags: ORIGIN' ++readelf --dynamic $t/exe | rg -Pq '\(FLAGS\)\s+ORIGIN' ++readelf --dynamic $t/exe | rg -Pq 'Flags: ORIGIN' + + echo OK diff --git a/srcpkgs/mold/patches/01-undef-page-size.patch b/srcpkgs/mold/patches/01-undef-page-size.patch new file mode 100644 index 000000000000..92b7e134aa15 --- /dev/null +++ b/srcpkgs/mold/patches/01-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..c2bc291 100644 +--- a/mold.h ++++ b/mold.h +@@ -4,6 +4,10 @@ + #define _GNU_SOURCE + #endif + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + #include "elf.h" + + #include <atomic> diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..8359114c3145 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,38 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +# skip 32-bit tests on 64-bit musl, because musl doesn't support multilib +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +else + rm test/i386*.sh +fi + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.1, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [ ] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [ ] run and possibly fix tests for `mold` for all other architectures - [ ] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 23360 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From f87fe9fc2fc687290742061793c2b9bc648ad407 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-grep.patch | 279 ++++++++++++++++++ srcpkgs/mold/patches/01-undef-page-size.patch | 15 + srcpkgs/mold/template | 38 +++ 3 files changed, 332 insertions(+) create mode 100644 srcpkgs/mold/patches/00-grep.patch create mode 100644 srcpkgs/mold/patches/01-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-grep.patch b/srcpkgs/mold/patches/00-grep.patch new file mode 100644 index 000000000000..fa939d96a22a --- /dev/null +++ b/srcpkgs/mold/patches/00-grep.patch @@ -0,0 +1,279 @@ +--- a/test/build-id.sh ++++ b/test/build-id.sh +@@ -12,7 +12,7 @@ readelf -n $t/exe | grep -qv 'GNU.*0x00000010.*NT_GNU_BUILD_ID' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=uuid + readelf -nW $t/exe | +- grep -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' ++ rg -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=md5 + readelf -n $t/exe | grep -q 'GNU.*0x00000010.*NT_GNU_BUILD_ID' +--- a/test/copyrel-relro.sh ++++ b/test/copyrel-relro.sh +@@ -22,7 +22,7 @@ EOF + clang -fuse-ld=`pwd`/../mold $t/a.o $t/b.so -o $t/exe + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log +-grep -Pqz '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log + + echo OK +--- a/test/demangle.sh ++++ b/test/demangle.sh +@@ -16,10 +16,10 @@ EOF + grep -q 'undefined symbol: .*: _Z3fooii' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-demangle 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + cat <<EOF | clang -c -o $t/b.o -xc - + extern int Pi; +--- a/test/dt_init.sh ++++ b/test/dt_init.sh +@@ -18,15 +18,15 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-init,init -Wl,-fini,fini + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log + + echo OK +--- a/test/dt_needed.sh ++++ b/test/dt_needed.sh +@@ -23,7 +23,7 @@ clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L $t -lfoo + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libfoo]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o $t/libbar.so +-readelf --dynamic $t/exe | grep -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' ++readelf --dynamic $t/exe | rg -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L$t -lbar + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libbar.so]' +--- a/test/dynamic.sh ++++ b/test/dynamic.sh +@@ -14,7 +14,7 @@ fgrep -q 'Shared library: [libc.so.6]' $t/log + fgrep -q 'Shared library: [ld-linux-x86-64.so.2]' $t/log + + readelf -W --symbols --use-dynamic $t/exe > $t/log2 +-grep -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 ++rg -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 + + cat <<EOF | clang -c -fPIC -o $t/b.o -xc - + #include <stdio.h> +--- a/test/ifunc-export.sh ++++ b/test/ifunc-export.sh +@@ -32,6 +32,6 @@ resolve_foobar: + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-readelf --dyn-syms $t/b.so | grep -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' ++readelf --dyn-syms $t/b.so | rg -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' + + echo OK +--- a/test/image-base.sh ++++ b/test/image-base.sh +@@ -16,6 +16,6 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,--image-base=0x8000000 + $t/exe | grep -q 'Hello world' +-readelf -W --sections $t/exe | grep -Pq '.interp\s+PROGBITS\s+0000000008000...\b' ++readelf -W --sections $t/exe | rg -Pq '.interp\s+PROGBITS\s+0000000008000...\b' + + echo OK +--- a/test/note.sh ++++ b/test/note.sh +@@ -31,9 +31,9 @@ EOF + ../mold -static -o $t/exe $t/a.o + readelf -W --sections $t/exe > $t/log + +-grep -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log +-grep -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log +-grep -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log ++rg -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log ++rg -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log ++rg -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log + + readelf --segments $t/exe > $t/log + fgrep -q '01 .note.bar' $t/log +--- a/test/pltgot.sh ++++ b/test/pltgot.sh +@@ -26,6 +26,6 @@ EOF + + objdump -d -j .plt.got $t/exe > $t/log + +-grep -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log ++rg -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log + + echo OK +--- a/test/relax.sh ++++ b/test/relax.sh +@@ -39,43 +39,43 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log +-grep -Pq 'callq.*<foo>' $t/log +-grep -Pq 'jmpq.*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log ++rg -Pq 'callq.*<foo>' $t/log ++rg -Pq 'jmpq.*<foo>' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o -Wl,-no-relax + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log +-grep -Pq 'callq.*\(%rip\)' $t/log +-grep -Pq 'jmpq.*\(%rip\)' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log ++rg -Pq 'callq.*\(%rip\)' $t/log ++rg -Pq 'jmpq.*\(%rip\)' $t/log + + echo OK +--- a/test/shared.sh ++++ b/test/shared.sh +@@ -19,7 +19,7 @@ clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o + readelf --dyn-syms $t/b.so > $t/log + + grep -q '0000000000000000 0 NOTYPE GLOBAL DEFAULT UND fn2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log + + cat <<EOF | clang -fPIC -c -o $t/c.o -xc - + #include <stdio.h> +--- a/test/symtab.sh ++++ b/test/symtab.sh +@@ -28,11 +28,11 @@ echo '{ local: module_local; };' > $t/c.map + + readelf --symbols $t/exe > $t/log + +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log + + echo OK +--- a/test/thin-archive.sh ++++ b/test/thin-archive.sh +@@ -34,9 +34,9 @@ rm -f $t/d.a + + clang -fuse-ld=`pwd`/../mold -Wl,--trace -o $t/exe $t/d.o $t/d.a > $t/log + +-grep -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(.*b.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log + fgrep -q thin-archive/d.o $t/log + + $t/exe | grep -q 15 +--- a/test/z_nodump.sh ++++ b/test/z_nodump.sh +@@ -10,9 +10,9 @@ void foo() {} + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-! readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' || false ++! readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' || false + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,nodump +-readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' ++readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' + + echo OK +--- a/test/z_origin.sh ++++ b/test/z_origin.sh +@@ -15,7 +15,7 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-z,origin + +-readelf --dynamic $t/exe | grep -Pq '\(FLAGS\)\s+ORIGIN' +-readelf --dynamic $t/exe | grep -Pq 'Flags: ORIGIN' ++readelf --dynamic $t/exe | rg -Pq '\(FLAGS\)\s+ORIGIN' ++readelf --dynamic $t/exe | rg -Pq 'Flags: ORIGIN' + + echo OK diff --git a/srcpkgs/mold/patches/01-undef-page-size.patch b/srcpkgs/mold/patches/01-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/01-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..aa5f8b1e65d2 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,38 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +# skip 32-bit tests on 64-bit musl, because musl doesn't support multilib +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +else + rm ${wrksrc}/test/i386*.sh +fi + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 171 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668380479 Comment: Please set `archs="x86_64*"`
[-- Attachment #1: Type: text/plain, Size: 233 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668380868 Comment: You can avoid the whole patch by `ln -s /usr/bin/rg fake-bin/grep` and put it into `$PATH`
[-- Attachment #1: Type: text/plain, Size: 188 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668381438 Comment: @sgn clever solution, I appreciate it
[-- Attachment #1: Type: text/plain, Size: 335 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668384069 Comment: @sgn, @q66 OK, you won, I'll set `archs=x86_64*` for now, because right now I don't have any ARM boards to test on, and also now I have no time to dig into emulation of arm using qemu.
[-- Attachment #1: Type: text/plain, Size: 339 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668384069 Comment: @sgn, @q66 OK, you won, I'll set `archs=x86_64*` temporarily, because right now I don't have any ARM boards to test on, and also now I have no time to dig into emulation of arm using qemu.
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 23375 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 705ab28e157cd9fd442c625610c49c455a213b02 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-grep.patch | 279 ++++++++++++++++++ srcpkgs/mold/patches/01-undef-page-size.patch | 15 + srcpkgs/mold/template | 39 +++ 3 files changed, 333 insertions(+) create mode 100644 srcpkgs/mold/patches/00-grep.patch create mode 100644 srcpkgs/mold/patches/01-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-grep.patch b/srcpkgs/mold/patches/00-grep.patch new file mode 100644 index 000000000000..fa939d96a22a --- /dev/null +++ b/srcpkgs/mold/patches/00-grep.patch @@ -0,0 +1,279 @@ +--- a/test/build-id.sh ++++ b/test/build-id.sh +@@ -12,7 +12,7 @@ readelf -n $t/exe | grep -qv 'GNU.*0x00000010.*NT_GNU_BUILD_ID' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=uuid + readelf -nW $t/exe | +- grep -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' ++ rg -Pq 'GNU.*0x00000010.*NT_GNU_BUILD_ID.*Build ID: ............4...[89abcdef]' + + clang -o $t/exe $t/a.c -fuse-ld=`pwd`/../mold -Wl,-build-id=md5 + readelf -n $t/exe | grep -q 'GNU.*0x00000010.*NT_GNU_BUILD_ID' +--- a/test/copyrel-relro.sh ++++ b/test/copyrel-relro.sh +@@ -22,7 +22,7 @@ EOF + clang -fuse-ld=`pwd`/../mold $t/a.o $t/b.so -o $t/exe + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log +-grep -Pqz '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss.rel.ro .* \1 readonly' $t/log ++rg -PUq '(?s)\[(\d+)\] .dynbss .* \1 readwrite' $t/log + + echo OK +--- a/test/demangle.sh ++++ b/test/demangle.sh +@@ -16,10 +16,10 @@ EOF + grep -q 'undefined symbol: .*: _Z3fooii' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-demangle 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + ! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o 2> $t/log || false +-grep -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log ++rg -Pq 'undefined symbol: .*: foo\(int, int\)' $t/log + + cat <<EOF | clang -c -o $t/b.o -xc - + extern int Pi; +--- a/test/dt_init.sh ++++ b/test/dt_init.sh +@@ -18,15 +18,15 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 FUNC GLOBAL HIDDEN\s+\d+ _fini\b' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-init,init -Wl,-fini,fini + readelf -a $t/exe > $t/log + +-grep -Pqz '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log ++rg -PUq '(?s)\(INIT\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ init\b' $t/log + +-grep -Pqz '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log ++rg -PUq '(?s)\(FINI\)\s+0x([0-9a-f]+)\b.*\1\s+0 NOTYPE GLOBAL DEFAULT\s+\d+ fini\b' $t/log + + echo OK +--- a/test/dt_needed.sh ++++ b/test/dt_needed.sh +@@ -23,7 +23,7 @@ clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L $t -lfoo + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libfoo]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o $t/libbar.so +-readelf --dynamic $t/exe | grep -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' ++readelf --dynamic $t/exe | rg -Pq 'Shared library: \[.*dt_needed/libbar\.so\]' + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o -L$t -lbar + readelf --dynamic $t/exe | fgrep -q 'Shared library: [libbar.so]' +--- a/test/dynamic.sh ++++ b/test/dynamic.sh +@@ -14,7 +14,7 @@ fgrep -q 'Shared library: [libc.so.6]' $t/log + fgrep -q 'Shared library: [ld-linux-x86-64.so.2]' $t/log + + readelf -W --symbols --use-dynamic $t/exe > $t/log2 +-grep -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 ++rg -Pq 'FUNC\s+GLOBAL\s+DEFAULT\s+UND\s+__libc_start_main' $t/log2 + + cat <<EOF | clang -c -fPIC -o $t/b.o -xc - + #include <stdio.h> +--- a/test/ifunc-export.sh ++++ b/test/ifunc-export.sh +@@ -32,6 +32,6 @@ resolve_foobar: + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-readelf --dyn-syms $t/b.so | grep -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' ++readelf --dyn-syms $t/b.so | rg -Pq '0 (IFUNC|<OS specific>: 10)\s+GLOBAL DEFAULT \d+ foobar' + + echo OK +--- a/test/image-base.sh ++++ b/test/image-base.sh +@@ -16,6 +16,6 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,--image-base=0x8000000 + $t/exe | grep -q 'Hello world' +-readelf -W --sections $t/exe | grep -Pq '.interp\s+PROGBITS\s+0000000008000...\b' ++readelf -W --sections $t/exe | rg -Pq '.interp\s+PROGBITS\s+0000000008000...\b' + + echo OK +--- a/test/note.sh ++++ b/test/note.sh +@@ -31,9 +31,9 @@ EOF + ../mold -static -o $t/exe $t/a.o + readelf -W --sections $t/exe > $t/log + +-grep -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log +-grep -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log +-grep -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log ++rg -Pq '.note.bar\s+NOTE.+000008 00 A 0 0 4' $t/log ++rg -Pq '.note.baz\s+NOTE.+000008 00 A 0 0 8' $t/log ++rg -Pq '.note.nonalloc\s+NOTE.+000008 00 0 0 1' $t/log + + readelf --segments $t/exe > $t/log + fgrep -q '01 .note.bar' $t/log +--- a/test/pltgot.sh ++++ b/test/pltgot.sh +@@ -26,6 +26,6 @@ EOF + + objdump -d -j .plt.got $t/exe > $t/log + +-grep -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log ++rg -Pq '201020:\s+ff 25 da 0f 00 00\s+jmpq \*0xfda\(%rip\)\s+# 202000 <ext2>' $t/log + + echo OK +--- a/test/relax.sh ++++ b/test/relax.sh +@@ -39,43 +39,43 @@ EOF + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log +-grep -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log +-grep -Pq 'callq.*<foo>' $t/log +-grep -Pq 'jmpq.*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log ++rg -Pq 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log ++rg -Pq 'callq.*<foo>' $t/log ++rg -Pq 'jmpq.*<foo>' $t/log + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o -Wl,-no-relax + objdump -d $t/exe | grep -A20 '<bar>:' > $t/log + +-grep -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log +-grep -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log +-grep -Pq 'callq.*\(%rip\)' $t/log +-grep -Pq 'jmpq.*\(%rip\)' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rax' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rcx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbx' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rbp' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rsi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%rdi' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r8 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r9 ' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r10' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r11' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r12' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r13' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r14' $t/log ++rg -Pq 'mov \s*0x.+\(%rip\),%r15' $t/log ++rg -Pq 'callq.*\(%rip\)' $t/log ++rg -Pq 'jmpq.*\(%rip\)' $t/log + + echo OK +--- a/test/shared.sh ++++ b/test/shared.sh +@@ -19,7 +19,7 @@ clang -shared -fuse-ld=`pwd`/../mold -o $t/b.so $t/a.o + readelf --dyn-syms $t/b.so > $t/log + + grep -q '0000000000000000 0 NOTYPE GLOBAL DEFAULT UND fn2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ fn1' $t/log + + cat <<EOF | clang -fPIC -c -o $t/c.o -xc - + #include <stdio.h> +--- a/test/symtab.sh ++++ b/test/symtab.sh +@@ -28,11 +28,11 @@ echo '{ local: module_local; };' > $t/c.map + + readelf --symbols $t/exe > $t/log + +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log +-grep -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log +-grep -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local1' $t/log ++rg -Pq '0 NOTYPE LOCAL DEFAULT \d+ local2' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ foo' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ bar' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ this_is_global' $t/log ++rg -Pq '0 NOTYPE GLOBAL DEFAULT \d+ module_local' $t/log + + echo OK +--- a/test/thin-archive.sh ++++ b/test/thin-archive.sh +@@ -34,9 +34,9 @@ rm -f $t/d.a + + clang -fuse-ld=`pwd`/../mold -Wl,--trace -o $t/exe $t/d.o $t/d.a > $t/log + +-grep -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(.*b.o\)' $t/log +-grep -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*long-long-long-filename.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(.*b.o\)' $t/log ++rg -Pq 'thin-archive/d.a\(/.*/b.o\)' $t/log + fgrep -q thin-archive/d.o $t/log + + $t/exe | grep -q 15 +--- a/test/z_nodump.sh ++++ b/test/z_nodump.sh +@@ -10,9 +10,9 @@ void foo() {} + EOF + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o +-! readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' || false ++! readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' || false + + clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,nodump +-readelf --dynamic $t/b.so | grep -Pq 'Flags: NODUMP' ++readelf --dynamic $t/b.so | rg -Pq 'Flags: NODUMP' + + echo OK +--- a/test/z_origin.sh ++++ b/test/z_origin.sh +@@ -15,7 +15,7 @@ EOF + + clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o -Wl,-z,origin + +-readelf --dynamic $t/exe | grep -Pq '\(FLAGS\)\s+ORIGIN' +-readelf --dynamic $t/exe | grep -Pq 'Flags: ORIGIN' ++readelf --dynamic $t/exe | rg -Pq '\(FLAGS\)\s+ORIGIN' ++readelf --dynamic $t/exe | rg -Pq 'Flags: ORIGIN' + + echo OK diff --git a/srcpkgs/mold/patches/01-undef-page-size.patch b/srcpkgs/mold/patches/01-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/01-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..f1305c7e8a69 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,39 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +archs=x86_64* +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +# skip 32-bit tests on 64-bit musl, because musl doesn't support multilib +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +else + rm ${wrksrc}/test/i386*.sh +fi + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 490 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668389768 Comment: > You can avoid the whole patch by `ln -s /usr/bin/rg fake-bin/grep` and put it into `$PATH` @sgn I think the patch is needed anyway because sometimes `grep` & `rg` have slightly different options: `-U` in `rg` vs `-z` in `grep` for multiline mode. Though I can make the patch a lot smaller if I employ your approach. Should I do that?
[-- Attachment #1: Type: text/plain, Size: 534 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668389768 Comment: > You can avoid the whole patch by `ln -s /usr/bin/rg fake-bin/grep` and put it into `$PATH` @sgn I think the patch is needed anyway because sometimes `grep` & `rg` have slightly different options: `-U` in `rg` vs `-z` in `grep` for multiline mode. Though I can make the patch a lot smaller if I employ your approach. Should I do that? **UPD** hmm, I can just use `sed` probably
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 11825 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 016a540a1214c0f24a41ee19e8d9dd243eaf604f Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 +++++++ srcpkgs/mold/template | 43 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..fbab5366c5f9 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,43 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +archs=x86_64* +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +# skip 32-bit tests on 64-bit musl, because musl doesn't support multilib +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +else + rm ${wrksrc}/test/i386*.sh +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 1180 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r662299349 Comment: > it's right there in the project readme, which @Logarithmus apparently hasn't read Please, don't make assumptions about the others if you don't know the whole story. I've read the README multiple times, even contributed to it (https://github.com/rui314/mold/pull/63). This line states that `mold` does support only x86_64 **as a target platform**. The line doesn't say anything about supported **host platform**. So I tried to cross build `mold` for `aarch64` on my laptop and it finised successfully. CI run for `aarch64` worked as well: https://github.com/void-linux/void-packages/pull/31706/checks?check_run_id=2961521454. After you've posted [this comment](https://github.com/void-linux/void-packages/pull/31706#discussion_r662276527), I asked the author of `mold` if it supports cross linking. The answer was "yes". You can read it [here](https://github.com/rui314/mold/issues/55#issuecomment-872239804). I didn't try it in practice yet though. Summing up: your suggestion about adding `archs=x86_64*` is wrong.
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 11927 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 198c9f3198632528ef6e8976c5a9b6de50fad0e8 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 ++++++ srcpkgs/mold/template | 47 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..a741c43b75a3 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,47 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=6695c49379d6d053ea37ba716bf94acb5c4767aa +version=0.9.2 +revision=1 +archs=x86_64* +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +pre_check() { + # skip 32-bit tests on 64-bit musl, because musl doesn't support multilib + if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + rm ${wrksrc}/test/i386*.sh + fi +}
[-- Attachment #1: Type: text/plain, Size: 438 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-878755456 Comment: @sgn any ideas about the possible cause of this? With glibc it's fine, but with musl it fails: ``` mold: /builddir/mold-0.9.2/test/tmp/canonical-plt/b.o:(.text): R_X86_64_32S relocation against symbol `foo' can not be used; recompile with -fPIE ``` https://github.com/rui314/mold/issues/89
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 12014 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 5917717be583f37cbf97301a6c96f2af4ce18b34 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 ++++++ srcpkgs/mold/template | 48 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..76ecd2d75b82 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,48 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=d79cdb83716e21854e37608f246a1bff594881da +version=0.9.3 +revision=1 +archs=x86_64* +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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" +distfiles="https://github.com/rui314/mold/archive/refs/heads/${_commit_hash}.tar.gz" +checksum=09b624e6bf5240a59aac5eb961b7dde2ea9b439d3e017a1e393034a10fe75b27 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +pre_check() { + # skip 32-bit tests on 64-bit musl, because musl doesn't support multilib + if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + rm ${wrksrc}/test/i386*.sh + fi +}
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 12003 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 6b569941753b0b2547a3a7c2c6163320ee490628 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 ++++++ srcpkgs/mold/template | 48 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..308a4530bb11 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,48 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=d79cdb83716e21854e37608f246a1bff594881da +version=0.9.3 +revision=1 +archs=x86_64* +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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" +distfiles="https://github.com/rui314/mold/archive/${_commit_hash}.tar.gz" +checksum=20f12fdb17551da5e46fe27eec864a8f105b72079df555f49628d197f83caa28 + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +pre_check() { + # skip 32-bit tests on 64-bit musl, because musl doesn't support multilib + if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + rm ${wrksrc}/test/i386*.sh + fi +}
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 11961 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 19652879665f141b4860e616e281ec056eddad71 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 ++++++ srcpkgs/mold/template | 49 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..d0c890f25e5d --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,49 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=191a69e36f5da5d18219ca5bce739c6e86039d31 +version=0.9.3 +_ver=0.9.3-rc1 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=ac35cdd14bcbd15e01b79831f50ce79f31830df225c1429725008f7eda322d7e + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +pre_check() { + # skip 32-bit tests on 64-bit musl, because musl doesn't support multilib + if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + rm ${wrksrc}/test/i386*.sh + fi +}
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 14531 bytes --] From 3b660f0b40e0bf024a9ace0d1e3e22a13ca7f2e1 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 9df122c0edfe..b748cc44be6f 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From ac7d38f858ce4fe6a056ec4886feb4485526de8c Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.2 --- srcpkgs/mold/patches/00-undef-page-size.patch | 15 ++++ srcpkgs/mold/patches/01-fix-no-pic.patch | 68 +++++++++++++++++++ srcpkgs/mold/template | 49 +++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 srcpkgs/mold/patches/00-undef-page-size.patch create mode 100644 srcpkgs/mold/patches/01-fix-no-pic.patch create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/patches/00-undef-page-size.patch b/srcpkgs/mold/patches/00-undef-page-size.patch new file mode 100644 index 000000000000..1aec3860105c --- /dev/null +++ b/srcpkgs/mold/patches/00-undef-page-size.patch @@ -0,0 +1,15 @@ +diff --git a/mold.h b/mold.h +index 49fd7fd..9da6a9d 100644 +--- a/mold.h ++++ b/mold.h +@@ -29,6 +29,10 @@ + #include <vector> + #include <xxh3.h> + ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif ++ + typedef uint8_t u8; + typedef uint16_t u16; + typedef uint32_t u32; diff --git a/srcpkgs/mold/patches/01-fix-no-pic.patch b/srcpkgs/mold/patches/01-fix-no-pic.patch new file mode 100644 index 000000000000..df22f747bdba --- /dev/null +++ b/srcpkgs/mold/patches/01-fix-no-pic.patch @@ -0,0 +1,68 @@ +diff --git a/test/copyrel.sh b/test/copyrel.sh +index 8e365bf..d1538f8 100755 +--- a/test/copyrel.sh ++++ b/test/copyrel.sh +@@ -25,7 +25,7 @@ bar: + .long 42 + EOF + +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.o $t/b.o ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/a.o $t/b.o + $t/exe | grep -q '42 42 1' + + echo OK +diff --git a/test/i386-shared.sh b/test/i386-shared.sh +index 663f481..8e7f1eb 100755 +--- a/test/i386-shared.sh ++++ b/test/i386-shared.sh +@@ -31,7 +31,7 @@ int main() { + EOF + + clang -c -o $t/d.o $t/c.c -fno-PIC -m32 +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/d.o $t/b.so -m32 ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/d.o $t/b.so -m32 + $t/exe | grep -q '5 7 2' + + clang -c -o $t/e.o $t/c.c -fPIE -m32 +diff --git a/test/nocopyreloc.sh b/test/nocopyreloc.sh +index 9cb52c4..8f09ca1 100755 +--- a/test/nocopyreloc.sh ++++ b/test/nocopyreloc.sh +@@ -22,10 +22,10 @@ int main() { + } + EOF + +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.so $t/b.o ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/a.so $t/b.o + $t/exe | grep -q '3 5' + +-! clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.so $t/b.o \ ++! clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/a.so $t/b.o \ + -Wl,-z,nocopyreloc 2> $t/log || false + + grep -q 'recompile with -fPIE' $t/log +diff --git a/test/weak-export.sh b/test/weak-export.sh +index dd96b7c..cf782bd 100755 +--- a/test/weak-export.sh ++++ b/test/weak-export.sh +@@ -18,17 +18,17 @@ EOF + + cc -fno-PIC -c -o $t/c.o $t/a.c + +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/c.o ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/c.o + ! readelf --dyn-syms $t/exe | grep -q 'NOTYPE WEAK DEFAULT UND foo' || false + $t/exe | grep -q '3 5' + +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/c.o -Wl,-z,nocopyreloc ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/c.o -Wl,-z,nocopyreloc + ! readelf --dyn-syms $t/exe | grep -q 'NOTYPE WEAK DEFAULT UND foo' || false + $t/exe | grep -q '3 5' + + cc -fPIC -c -o $t/b.o $t/a.c + +-clang -fuse-ld=`pwd`/../mold -o $t/exe $t/b.o ++clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/b.o + readelf --dyn-syms $t/exe | grep -q 'NOTYPE WEAK DEFAULT UND foo' + $t/exe | grep -q '3 5' + diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..e3996218598c --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,49 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=191a69e36f5da5d18219ca5bce739c6e86039d31 +_ver=0.9.3-rc1 +version=0.9.3 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel tbb-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=ac35cdd14bcbd15e01b79831f50ce79f31830df225c1429725008f7eda322d7e + +# use system-wide installed mimalloc instead of the vendored one +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then + if [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + checkdepends+=" glibc-devel-32bit libgcc-devel-32bit" + else + checkdepends+=" glibc-devel libgcc-devel" + fi +fi + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +pre_check() { + # skip 32-bit tests on 64-bit musl, because musl doesn't support multilib + if [ "$XBPS_TARGET_LIBC" = "musl" ] && [ "$XBPS_TARGET_WORDSIZE" -eq 64 ]; then + rm ${wrksrc}/test/i386*.sh + fi +}
[-- Attachment #1: Type: text/plain, Size: 186 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668747172 Comment: These are already installed by default.
[-- Attachment #1: Type: text/plain, Size: 209 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668748634 Comment: Is this necessary because `chroot-grep` is built without pcre?
[-- Attachment #1: Type: text/plain, Size: 257 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668747615 Comment: These packages only exist for `x86_64`, and we'd like to deprecate at some point. Just don't run `-m32` tests.
[-- Attachment #1: Type: text/plain, Size: 171 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668746901 Comment: What does this patch do?
[-- Attachment #1: Type: text/plain, Size: 222 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668750531 Comment: > Is this necessary because `chroot-grep` is built without pcre? yes
[-- Attachment #1: Type: text/plain, Size: 251 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668751689 Comment: @ericonr do you want to deprecate multilib altogether? Then how to run 32 bit programs, e. g. Steam?
[-- Attachment #1: Type: text/plain, Size: 493 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r668754669 Comment: @ericonr `musl`'s `limits.h` defines `PAGE_SIZE`, but `glibc`'s doesn't. `mold` author didn't know about that and assuming `PAGE_SIZE` is undefined, he named his variable the same way. That's one of the causes of `musl` build failing. This will be fixed in upstream surely, it's just a temporary workaround (this PR is still draft after all).
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [ ] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 11040 bytes --] From 35b197614a5b7893cfb1779f41082f613082a811 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index a7afbf2a56f7..f0e050ff17a4 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 289f5dcbb68f9cd7a3ed96fc4fc08bec9b573950 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.3 --- srcpkgs/mold/template | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..b369d00b2a3f --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,43 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=191a69e36f5da5d18219ca5bce739c6e86039d31 +_ver=0.9.3 +version=0.9.3 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=c63ca249fde10b9fbceddca7046ddf54d1c6a994c311ca3d8a3cf7a6181ee62c + +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +# pre_check() { +# # skip 32-bit tests +# # https://github.com/void-linux/void-packages/pull/31706#discussion_r668747615 +# rm ${wrksrc}/test/i386*.sh +# } + +do_check() { + ls test/*.fail | xargs -I{} bash -x {} & +}
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.2, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [x] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 11040 bytes --] From 35b197614a5b7893cfb1779f41082f613082a811 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index a7afbf2a56f7..f0e050ff17a4 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From ca60940a608ad19716b92d6500120d1e2e69044c Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.3 --- srcpkgs/mold/template | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..a6e0a7b01aff --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,43 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=191a69e36f5da5d18219ca5bce739c6e86039d31 +_ver=0.9.3 +version=0.9.3 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +makedepends="mimalloc-devel openssl-devel xxHash-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=bb4dea1e6b04ef989ffd4bd32c91a4f03fcd4853c849a9d0aae2a28e56aaa99f + +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +} + +# pre_check() { +# # skip 32-bit tests +# # https://github.com/void-linux/void-packages/pull/31706#discussion_r668747615 +# rm ${wrksrc}/test/i386*.sh +# } + +do_check() { + ls test/*.fail | xargs -I{} bash -x {} & +}
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.3, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [x] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 10832 bytes --] From 35b197614a5b7893cfb1779f41082f613082a811 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index a7afbf2a56f7..f0e050ff17a4 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 7c0cca16742ba10e9e1f996a858158fef6b24a14 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.3 --- srcpkgs/mold/template | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..7c9085d53fb5 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,34 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=ec3319b37f653dccfa4d1a859a5c687565ab722d +_ver=0.9.3 +version=0.9.3 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +hostmakedepends="cmake" +makedepends="mimalloc-devel openssl-devel xxHash-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=bb4dea1e6b04ef989ffd4bd32c91a4f03fcd4853c849a9d0aae2a28e56aaa99f + +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +pre_patch() { + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 320 bytes --] New review comment by sgn on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r675991941 Comment: ```sh mkdir /r32 XBPS_ARCH=i686 xbps-install -S -r /r32 -R "$repo" base-system $packages unlink /lib32 rm -rf /usr/lib32 ln -s /r32/lib /lib ln -s /r32/lib /usr/lib32 ```
[-- Attachment #1: Type: text/plain, Size: 184 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r675992090 Comment: Resolving because fixed upstream.
[-- Attachment #1: Type: text/plain, Size: 196 bytes --] New review comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r676197192 Comment: Then it should probably have a comment as to why.
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.3, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [x] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 10906 bytes --] From 3eae7788c9a98178135f22fbc2e1190f84616582 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 14c9e6a84e2c..9a6c8079a60b 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 82044c57fd7b13f80e913dd8558248cdb1d5481c Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.3 --- srcpkgs/mold/template | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..6bab4ce2bb83 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,35 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=ec3319b37f653dccfa4d1a859a5c687565ab722d +_ver=0.9.3 +version=0.9.3 +revision=1 +archs=x86_64* +wrksrc=mold-${_ver} +build_style=gnu-makefile +hostmakedepends="cmake" +makedepends="mimalloc-devel openssl-devel xxHash-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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${_ver}.tar.gz" +checksum=bb4dea1e6b04ef989ffd4bd32c91a4f03fcd4853c849a9d0aae2a28e56aaa99f + +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +pre_patch() { + # chroot-grep is built without PCRE support, so we use ripgrep instead + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --] There is an updated pull request by Logarithmus against master on the void-packages repository https://github.com/Logarithmus/void-packages mimalloc https://github.com/void-linux/void-packages/pull/31706 New packages: mold-0.9.3, mimalloc-1.7.2 <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [x] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl --> A patch file from https://github.com/void-linux/void-packages/pull/31706.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-mimalloc-31706.patch --] [-- Type: text/x-diff, Size: 10874 bytes --] From 3eae7788c9a98178135f22fbc2e1190f84616582 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:30:50 +0300 Subject: [PATCH 1/2] New package: mimalloc-1.7.2 --- common/shlibs | 1 + srcpkgs/mimalloc-devel | 1 + .../mimalloc/patches/00-fix-cmakelists.patch | 20 ++++ srcpkgs/mimalloc/patches/01-fix-test.patch | 11 ++ srcpkgs/mimalloc/patches/03-libatomic.patch | 112 ++++++++++++++++++ ...4-remove-secure-suffix-from-basename.patch | 15 +++ srcpkgs/mimalloc/template | 32 +++++ 7 files changed, 192 insertions(+) create mode 120000 srcpkgs/mimalloc-devel create mode 100644 srcpkgs/mimalloc/patches/00-fix-cmakelists.patch create mode 100644 srcpkgs/mimalloc/patches/01-fix-test.patch create mode 100644 srcpkgs/mimalloc/patches/03-libatomic.patch create mode 100644 srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch create mode 100644 srcpkgs/mimalloc/template diff --git a/common/shlibs b/common/shlibs index 14c9e6a84e2c..9a6c8079a60b 100644 --- a/common/shlibs +++ b/common/shlibs @@ -416,6 +416,7 @@ libMAC.so.6 libMAC-5.28_1 libmad.so.0 libmad-0.15.1b_1 libmatroska.so.7 libmatroska-1.6.0_1 libmatrix_client.so.0.5.1 mtxclient-0.5.1_1 +libmimalloc.so.1.7 mimalloc-1.7.2_1 libebml.so.5 libebml-1.4.0_1 libdvdread.so.8 libdvdread-6.1.1_1 libdvdnav.so.4 libdvdnav-4.1.3_1 diff --git a/srcpkgs/mimalloc-devel b/srcpkgs/mimalloc-devel new file mode 120000 index 000000000000..9af584a917a5 --- /dev/null +++ b/srcpkgs/mimalloc-devel @@ -0,0 +1 @@ +mimalloc \ No newline at end of file diff --git a/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch new file mode 100644 index 000000000000..1d18ccd7d859 --- /dev/null +++ b/srcpkgs/mimalloc/patches/00-fix-cmakelists.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,7 @@ endif() + if (MI_INSTALL_TOPLEVEL) + set(mi_install_libdir "lib") + set(mi_install_incdir "include") +- set(mi_install_cmakedir "cmake") ++ set(mi_install_cmakedir "share/cmake") + else() + set(mi_install_libdir "lib/mimalloc-${mi_version}") + set(mi_install_incdir "include/mimalloc-${mi_version}") +@@ -224,7 +224,7 @@ else() + endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) +-if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel)$")) ++if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) + set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version + endif() + if(MI_BUILD_SHARED) diff --git a/srcpkgs/mimalloc/patches/01-fix-test.patch b/srcpkgs/mimalloc/patches/01-fix-test.patch new file mode 100644 index 000000000000..f1c35c37ea28 --- /dev/null +++ b/srcpkgs/mimalloc/patches/01-fix-test.patch @@ -0,0 +1,11 @@ +--- a/test/test-api.c ++++ b/test/test-api.c +@@ -83,7 +83,7 @@ int main() { + void* p = mi_malloc(0); mi_free(p); + }); + CHECK_BODY("malloc-nomem1",{ +- result = (mi_malloc(SIZE_MAX/2) == NULL); ++ result = (mi_malloc((size_t)PTRDIFF_MAX + (size_t)1) == NULL); + }); + CHECK_BODY("malloc-null",{ + mi_free(NULL); diff --git a/srcpkgs/mimalloc/patches/03-libatomic.patch b/srcpkgs/mimalloc/patches/03-libatomic.patch new file mode 100644 index 000000000000..ca9af8ddfb1a --- /dev/null +++ b/srcpkgs/mimalloc/patches/03-libatomic.patch @@ -0,0 +1,112 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,6 +203,9 @@ else() + endif() + endif() + ++include("cmake/atomic.cmake") ++list(APPEND mi_libraries ${CMAKE_REQUIRED_LIBRARIES}) ++ + # ----------------------------------------------------------------------------- + # Install and output names + # ----------------------------------------------------------------------------- +--- /dev/null ++++ b/cmake/atomic.cmake +@@ -0,0 +1,97 @@ ++# Based on: ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/DetermineGCCCompatible.cmake ++# https://github.com/llvm/llvm-project/blob/d4dcb55c7050fd908af2378fa551078d859d994f/llvm/cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++# Determine if the compiler has GCC-compatible command-line syntax. ++ ++if(CMAKE_COMPILER_IS_GNUCXX) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( MSVC ) ++ set(COMPILER_IS_GCC_COMPATIBLE OFF) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) ++ set(COMPILER_IS_GCC_COMPATIBLE ON) ++endif() ++ ++# Sometimes linking against libatomic is required for atomic ops, if ++# the platform doesn't support lock-free atomics. ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++std::atomic<short> y; ++std::atomic<char> z; ++int main() { ++ ++z; ++ ++y; ++ return ++x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ (void)i; ++ return 0; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++ ++# Check for (non-64-bit) atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if(HAVE_LIBATOMIC) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++ endif() ++endif() ++ ++# Check for 64 bit atomic operations. ++if(MSVC) ++ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) ++elseif(COMPILER_IS_GCC_COMPATIBLE) ++ # First check if atomics work without the library. ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ # If not, check if the library exists, and atomics work with it. ++ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.") ++ endif() ++ endif() ++endif() diff --git a/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch new file mode 100644 index 000000000000..604df22d38ce --- /dev/null +++ b/srcpkgs/mimalloc/patches/04-remove-secure-suffix-from-basename.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -220,11 +220,7 @@ else() + set(mi_install_cmakedir "share/mimalloc-${mi_version}/cmake") + endif() + +-if(MI_SECURE) +- set(mi_basename "mimalloc-secure") +-else() +- set(mi_basename "mimalloc") +-endif() ++set(mi_basename "mimalloc") + + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC) + if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")) diff --git a/srcpkgs/mimalloc/template b/srcpkgs/mimalloc/template new file mode 100644 index 000000000000..fa14ba485b6c --- /dev/null +++ b/srcpkgs/mimalloc/template @@ -0,0 +1,32 @@ +# Template file for 'mimalloc' +pkgname=mimalloc +version=1.7.2 +revision=1 +build_style=cmake +configure_args="-DMI_INSTALL_TOPLEVEL=ON -DMI_SECURE=ON" +short_desc="MIcrosoft's malloc" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +license="MIT" +homepage="https://github.com/microsoft/mimalloc" +distfiles="https://github.com/microsoft/mimalloc/archive/refs/tags/v${version}.tar.gz" +checksum=b1912e354565a4b698410f7583c0f83934a6dbb3ade54ab7ddcb1569320936bd + +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +post_install() { + vlicense LICENSE +} + +mimalloc-devel_package() { + depends="${pkgname}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/share/cmake + vmove usr/lib/*.a + vmove usr/lib/*.o + vmove usr/lib/*.so + } +} From 8d624061a0d3ea66f0ae4c4d39694b1431eb7805 Mon Sep 17 00:00:00 2001 From: Artur Sinila <freesoftware@logarithmus.dev> Date: Tue, 29 Jun 2021 03:31:54 +0300 Subject: [PATCH 2/2] New package: mold-0.9.3 --- srcpkgs/mold/template | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 srcpkgs/mold/template diff --git a/srcpkgs/mold/template b/srcpkgs/mold/template new file mode 100644 index 000000000000..37abe81ef136 --- /dev/null +++ b/srcpkgs/mold/template @@ -0,0 +1,33 @@ +# Template file for 'mold' +pkgname=mold +_commit_hash=ec3319b37f653dccfa4d1a859a5c687565ab722d +version=0.9.3 +revision=1 +archs=x86_64* +build_style=gnu-makefile +hostmakedepends="cmake" +makedepends="mimalloc-devel openssl-devel xxHash-devel zlib-devel" +checkdepends="ripgrep libdwarf clang tar" +short_desc="High performance drop-in replacement for existing Unix linkers" +maintainer="Artur Sinila <freesoftware@logarithmus.dev>" +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=bb4dea1e6b04ef989ffd4bd32c91a4f03fcd4853c849a9d0aae2a28e56aaa99f + +export SYSTEM_MIMALLOC=1 +export GIT_HASH=$_commit_hash + +pre_patch() { + # chroot-grep is built without PCRE support, so we use ripgrep instead + vsed -i test/*.sh -e "s/grep -P/rg -P/;s/rg -\([a-yA-Z]*\)z/rg -\1U/" +} + +pre_install() { + vmkdir usr/bin +} + +post_install() { + vlicense LICENSE +}
[-- Attachment #1: Type: text/plain, Size: 212 bytes --] New review comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r677088620 Comment: `mold` author disabled running `i386-*` tests for musl anyway
[-- Attachment #1: Type: text/plain, Size: 186 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-887178332 Comment: @sgn it's finally ready for merge perhaps
[-- Attachment #1: Type: text/plain, Size: 402 bytes --] New comment by cinerea0 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-950369564 Comment: I saw in your PR in the mimalloc repo that someone responded with [a commit](https://github.com/microsoft/mimalloc/commit/4d89176eb4584c16a2b3141a97c1970cc1664014) that was intended to address one of the issues in this PR. Is that enough to not need the patch?
[-- Attachment #1: Type: text/plain, Size: 192 bytes --] New comment by Sinono3 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-997522715 Comment: What's the state of this PR with mold 1.0 released?
[-- Attachment #1: Type: text/plain, Size: 230 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-1000925546 Comment: @Sinono3 thanks for the reminder. Will devote some time for this PR on this weekend.
[-- Attachment #1: Type: text/plain, Size: 313 bytes --] New comment by Logarithmus on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-1000925546 Comment: @Sinono3 thanks for the reminder. I didn't contribute to free software for a couple of months due to being busy IRL. Will devote some time for this PR on this weekend.
[-- Attachment #1: Type: text/plain, Size: 315 bytes --] New review comment by Anachron on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r780826142 Comment: @sgn sorry for chiming in like that, but what repo would I use for that small script? When I use the multilib it cannot find the repodata, as it is `x86_64-repodata`.
[-- Attachment #1: Type: text/plain, Size: 265 bytes --] New review comment by Chocimier on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r781489340 Comment: @Anachron: the main repository. Idea is to install regular i686 packages. Not sure how well it would work right now.
[-- Attachment #1: Type: text/plain, Size: 322 bytes --] New review comment by Anachron on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r781604182 Comment: @Chocimier indeed, I've done exactly that and I'm planning to test stuff (`wine`, `lutris`, `bottles` etc). I'll probably post a new issue on void-packages with my results.
[-- Attachment #1: Type: text/plain, Size: 230 bytes --] New review comment by Anachron on void-packages repository https://github.com/void-linux/void-packages/pull/31706#discussion_r781874340 Comment: My WIP can be found here: https://github.com/void-linux/void-packages/issues/34988
[-- Attachment #1: Type: text/plain, Size: 13462 bytes --] New comment by cinerea0 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-1012736780 Comment: Currently attempting to build mold using a very similar template to the one in this PR and I think I'm getting the compilation errors mentioned earlier that disappeared on their own: <details> <summary>Build Output</summary> ``` => mold-1.0.1_1: running do_build ... mkdir -p out/elf touch out/elf/.keep mkdir -p out/macho touch out/macho/.keep g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/local/lib\"" -Ithird-party/tbb/include -Ithird-party/xxhash -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -fdebug-prefix-map=/builddir/mold-1.0.1=. -c -o out/compress.o compress.cc In file included from compress.cc:15: mold.h:27:32: error: 'string_view_literals' is not a namespace-name; did you mean 'string_literals'? 27 | using namespace std::literals::string_view_literals; | ^~~~~~~~~~~~~~~~~~~~ | string_literals mold.h:41:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 41 | inline char *output_tmpfile; | ^~~~~~ mold.h:42:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 42 | inline char *socket_tmpfile; | ^~~~~~ mold.h:43:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 43 | inline thread_local bool opt_demangle; | ^~~~~~ mold.h:47:6: error: 'string_view' in namespace 'std' does not name a type 47 | std::string_view errno_string(); | ^~~~~~~~~~~ mold.h:47:1: note: 'std::string_view' is only available from C++17 onwards 47 | std::string_view errno_string(); | ^~~ mold.h:72:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 72 | static inline std::mutex mu; | ^~~~~~ mold.h: In destructor 'mold::SyncOut<C>::~SyncOut()': mold.h:63:21: error: missing template arguments before 'lock' 63 | std::lock_guard lock(mu); | ^~~~ mold.h: At global scope: mold.h:202:39: error: 'std::string_view' has not been declared 202 | inline i64 write_string(u8 *buf, std::string_view str) { | ^~~~~~~~~~~ mold.h: In function 'mold::i64 mold::write_string(mold::u8*, int)': mold.h:203:19: error: request for member 'data' in 'str', which is of non-class type 'int' 203 | memcpy(buf, str.data(), str.size()); | ^~~~ mold.h:203:31: error: request for member 'size' in 'str', which is of non-class type 'int' 203 | memcpy(buf, str.data(), str.size()); | ^~~~ mold.h:204:11: error: request for member 'size' in 'str', which is of non-class type 'int' 204 | buf[str.size()] = '\0'; | ^~~~ mold.h:205:14: error: request for member 'size' in 'str', which is of non-class type 'int' 205 | return str.size() + 1; | ^~~~ mold.h: At global scope: mold.h:255:6: error: 'string_view' in namespace 'std' does not name a type 255 | std::string_view save_string(C &ctx, const std::string &str) { | ^~~~~~~~~~~ mold.h:255:1: note: 'std::string_view' is only available from C++17 onwards 255 | std::string_view save_string(C &ctx, const std::string &str) { | ^~~ mold.h:295:36: error: 'std::string_view' has not been declared 295 | std::pair<T *, bool> insert(std::string_view key, u64 hash, const T &val) { | ^~~~~~~~~~~ mold.h: In member function 'std::pair<T*, bool> mold::ConcurrentMap<T>::insert(int, mold::u64, const T&)': mold.h:316:26: error: request for member 'size' in 'key', which is of non-class type 'int' 316 | sizes[idx] = key.size(); | ^~~~ mold.h:317:25: error: request for member 'data' in 'key', which is of non-class type 'int' 317 | keys[idx] = key.data(); | ^~~~ mold.h:321:15: error: request for member 'size' in 'key', which is of non-class type 'int' 321 | if (key.size() == sizes[idx] && memcmp(ptr, key.data(), sizes[idx]) == 0) | ^~~~ mold.h:321:55: error: request for member 'data' in 'key', which is of non-class type 'int' 321 | if (key.size() == sizes[idx] && memcmp(ptr, key.data(), sizes[idx]) == 0) | ^~~~ mold.h: At global scope: mold.h:436:31: error: 'string_view' is not a member of 'std' 436 | std::string get_realpath(std::string_view path); | ^~~~~~~~~~~ mold.h:436:31: note: 'std::string_view' is only available from C++17 onwards mold.h:437:23: error: 'string_view' is not a member of 'std' 437 | bool path_is_dir(std::string_view path); | ^~~~~~~~~~~ mold.h:437:23: note: 'std::string_view' is only available from C++17 onwards mold.h:438:6: error: 'string_view' in namespace 'std' does not name a type 438 | std::string_view path_dirname(std::string_view path); | ^~~~~~~~~~~ mold.h:438:1: note: 'std::string_view' is only available from C++17 onwards 438 | std::string_view path_dirname(std::string_view path); | ^~~ mold.h:439:6: error: 'string_view' in namespace 'std' does not name a type 439 | std::string_view path_filename(std::string_view path); | ^~~~~~~~~~~ mold.h:439:1: note: 'std::string_view' is only available from C++17 onwards 439 | std::string_view path_filename(std::string_view path); | ^~~ mold.h:440:6: error: 'string_view' in namespace 'std' does not name a type 440 | std::string_view path_basename(std::string_view path); | ^~~~~~~~~~~ mold.h:440:1: note: 'std::string_view' is only available from C++17 onwards 440 | std::string_view path_basename(std::string_view path); | ^~~ mold.h:441:35: error: 'string_view' is not a member of 'std' 441 | std::string path_to_absolute(std::string_view path); | ^~~~~~~~~~~ mold.h:441:35: note: 'std::string_view' is only available from C++17 onwards mold.h:442:29: error: 'string_view' is not a member of 'std' 442 | std::string path_clean(std::string_view path); | ^~~~~~~~~~~ mold.h:442:29: note: 'std::string_view' is only available from C++17 onwards mold.h:448:6: error: 'string_view' in namespace 'std' does not name a type 448 | std::string_view demangle(std::string_view name); | ^~~~~~~~~~~ mold.h:448:1: note: 'std::string_view' is only available from C++17 onwards 448 | std::string_view demangle(std::string_view name); | ^~~ mold.h:456:34: error: expected ')' before 'input' 456 | ZlibCompressor(std::string_view input); | ~ ^~~~~~ | ) mold.h:467:34: error: expected ')' before 'input' 467 | GzipCompressor(std::string_view input); | ~ ^~~~~~ | ) mold.h:484:27: error: expected ')' before 'name' 484 | Counter(std::string_view name, i64 value = 0) : name(name), values(value) { | ~ ^~~~~ | ) mold.h:504:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 504 | static inline bool enabled = false; | ^~~~~~ mold.h:509:8: error: 'string_view' in namespace 'std' does not name a type 509 | std::string_view name; | ^~~~~~~~~~~ mold.h:509:3: note: 'std::string_view' is only available from C++17 onwards 509 | std::string_view name; | ^~~ mold.h:512:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 512 | static inline std::vector<Counter *> instances; | ^~~~~~ mold.h:568:38: error: 'std::string_view' has not been declared 568 | void append(std::string path, std::string_view data); | ^~~~~~~~~~~ mold.h:578:43: error: 'string_view' is not a member of 'std' 578 | std::vector<std::pair<std::string, std::string_view>> contents; | ^~~~~~~~~~~ mold.h:578:43: note: 'std::string_view' is only available from C++17 onwards mold.h:578:43: error: 'string_view' is not a member of 'std' mold.h:578:43: note: 'std::string_view' is only available from C++17 onwards mold.h:578:43: error: template argument 2 is invalid mold.h:578:54: error: template argument 1 is invalid 578 | std::vector<std::pair<std::string, std::string_view>> contents; | ^~ mold.h:578:54: error: template argument 2 is invalid mold.h:598:8: error: 'string_view' in namespace 'std' does not name a type 598 | std::string_view get_contents() { | ^~~~~~~~~~~ mold.h:598:3: note: 'std::string_view' is only available from C++17 onwards 598 | std::string_view get_contents() { | ^~~ mold.h: In static member function 'static mold::MappedFile<C>* mold::MappedFile<C>::open(C&, std::string)': mold.h:617:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'starts_with' 617 | if (path.starts_with('/') && !ctx.arg.chroot.empty()) | ^~~~~~~~~~~ mold.h:618:50: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (std::string&)' 618 | path = ctx.arg.chroot + "/" + path_clean(path); | ^ mold.h:626:10: error: missing template arguments before '(' token 626 | Fatal(ctx) << path << ": fstat failed: " << errno_string(); | ^ mold.h:626:49: error: there are no arguments to 'errno_string' that depend on a template parameter, so a declaration of 'errno_string' must be available [-fpermissive] 626 | Fatal(ctx) << path << ": fstat failed: " << errno_string(); | ^~~~~~~~~~~~ mold.h:626:49: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) mold.h:639:12: error: missing template arguments before '(' token 639 | Fatal(ctx) << path << ": mmap failed: " << errno_string(); | ^ mold.h:639:50: error: there are no arguments to 'errno_string' that depend on a template parameter, so a declaration of 'errno_string' must be available [-fpermissive] 639 | Fatal(ctx) << path << ": mmap failed: " << errno_string(); | ^~~~~~~~~~~~ mold.h: In static member function 'static mold::MappedFile<C>* mold::MappedFile<C>::must_open(C&, std::string)': mold.h:650:8: error: missing template arguments before '(' token 650 | Fatal(ctx) << "cannot open " << path; | ^ compress.cc: At global scope: compress.cc:24:25: error: 'string_view' is not a member of 'std' 24 | static std::vector<std::string_view> split(std::string_view input) { | ^~~~~~~~~~~ compress.cc:24:25: note: 'std::string_view' is only available from C++17 onwards compress.cc:24:25: error: 'string_view' is not a member of 'std' compress.cc:24:25: note: 'std::string_view' is only available from C++17 onwards compress.cc:24:36: error: template argument 1 is invalid 24 | static std::vector<std::string_view> split(std::string_view input) { | ^ compress.cc:24:36: error: template argument 2 is invalid compress.cc:24:49: error: 'string_view' is not a member of 'std' 24 | static std::vector<std::string_view> split(std::string_view input) { | ^~~~~~~~~~~ compress.cc:24:49: note: 'std::string_view' is only available from C++17 onwards compress.cc:36:41: error: 'string_view' is not a member of 'std' 36 | static std::vector<u8> do_compress(std::string_view input) { | ^~~~~~~~~~~ compress.cc:36:41: note: 'std::string_view' is only available from C++17 onwards compress.cc:36:60: error: expected ',' or ';' before '{' token 36 | static std::vector<u8> do_compress(std::string_view input) { | ^ compress.cc:66:31: error: expected constructor, destructor, or type conversion before '(' token 66 | ZlibCompressor::ZlibCompressor(std::string_view input) { | ^ compress.cc:114:31: error: expected constructor, destructor, or type conversion before '(' token 114 | GzipCompressor::GzipCompressor(std::string_view input) { | ^ make: *** [Makefile:126: out/compress.o] Error 1 => ERROR: mold-1.0.1_1: do_build: '${make_cmd} CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ${makejobs} ${make_build_args} ${make_build_target}' exited with 2 => ERROR: in do_build() at common/build-style/gnu-makefile.sh:9 ``` </details>
[-- Attachment #1: Type: text/plain, Size: 305 bytes --] New comment by github-actions[bot] on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-1135323168 Comment: Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
[-- Attachment #1: Type: text/plain, Size: 1863 bytes --] There's a closed pull request on the void-packages repository New packages: mold-0.9.3, mimalloc-1.7.2 https://github.com/void-linux/void-packages/pull/31706 Description: <!-- Mark items with [x] where applicable --> TODO - [x] fix tests for `mold` on `x86_64` (blocker: https://github.com/rui314/mold/pull/77) - [x] ~~run and possibly fix tests for `mold` for all other architectures~~ using `archs=x86_64*` as a temp workaround - [x] wait for a new release of `mold` (0.9.2) https://github.com/rui314/mold/issues/65 - [x] fix `mold` compilation on `*-musl` targets (progress: https://github.com/rui314/mold/issues/89) #### General - [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements) #### Have the results of the proposed changes been tested? - [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me - [ ] I generally don't use the affected packages but briefly tested this PR <!-- If GitHub CI cannot be used to validate the build result (for example, if the build is likely to take several hours), make sure to [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration). When skipping CI, uncomment and fill out the following section. Note: for builds that are likely to complete in less than 2 hours, it is not acceptable to skip CI. --> <!-- #### Does it build and run successfully? (Please choose at least one native build and, if supported, at least one cross build. More are better.) - [ ] I built this PR locally for my native architecture, (ARCH-LIBC) - [ ] I built this PR locally for these architectures (if supported. mark crossbuilds): - [ ] aarch64-musl - [ ] armv7l - [ ] armv6l-musl -->