diff options
Diffstat (limited to 'community/ldc/APKBUILD')
-rw-r--r-- | community/ldc/APKBUILD | 175 |
1 files changed, 80 insertions, 95 deletions
diff --git a/community/ldc/APKBUILD b/community/ldc/APKBUILD index 6d5bda84dd3..f949525012c 100644 --- a/community/ldc/APKBUILD +++ b/community/ldc/APKBUILD @@ -1,83 +1,86 @@ # Contributor: Mathias LANG <pro.mathias.lang@gmail.com> # Maintainer: Mathias LANG <pro.mathias.lang@gmail.com> pkgname=ldc -pkgver=1.28.0 +pkgver=1.33.0 pkgrel=0 +_llvmver=15 pkgdesc="The LLVM-based D Compiler" url="https://github.com/ldc-developers/ldc" # LDC does not support host compiling on most of the architecture Alpine supports arch="x86_64 aarch64" license="BSD-3-Clause AND BSL-1.0 AND ( Artistic-1.0 OR GPL-2.0-or-later ) AND NCSA AND MIT" -depends="llvm-libunwind-dev tzdata $pkgname-static=$pkgver-r$pkgrel" -makedepends="chrpath cmake curl-dev diffutils gdmd llvm12-dev llvm12-static - libedit-dev zlib-dev" -checkdepends="bash gdb grep llvm11-test-utils" +depends=" + $pkgname-static=$pkgver-r$pkgrel + llvm-libunwind-dev + tzdata + " +makedepends=" + chrpath + clang + cmake + curl-dev + diffutils + gdmd + libedit-dev + llvm$_llvmver-dev + llvm$_llvmver-static + samurai + zlib-dev + " +checkdepends="bash gdb grep llvm$_llvmver-test-utils" # A user might want to install the '-runtime' subpackage when they have # a dynamically-linked D program. subpackages=" $pkgname-dbg $pkgname-runtime $pkgname-static - $pkgname-bash-completion:bashcomp:noarch" + $pkgname-bash-completion + " source="https://github.com/ldc-developers/ldc/releases/download/v$pkgver/ldc-$pkgver-src.tar.gz - 0001-Add-OpenBSD-to-section_ldc.d-202.patch - 0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch -" + lfs64.patch + " builddir="$srcdir/ldc-$pkgver-src/" build() { - # Note: The CI was running into OOM while building this package - # See https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/14364#note_122336 - case "$CARCH" in x86*) - export MAKEFLAGS="$MAKEFLAGS -j$((JOBS<4 ? JOBS : 4))" - export DFLAGS="$DFLAGS -lowmem" + # use less memory to not oom + export CC=clang + export CXX=clang++ + + case "$CARCH" in + aarch64) + export CFLAGS="${CFLAGS/-fstack-clash-protection}" + export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection}" ;; esac + # First, build LDC using GDC - mkdir -p "$builddir/stage1" if [ "$CBUILD" != "$CHOST" ]; then CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" fi unset DFLAGS - cmake \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ - -DCMAKE_C_FLAGS="$CFLAGS" \ + cmake -G Ninja -B stage1 \ -DD_COMPILER='gdmd' \ - -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-linker=bfd", "-link-defaultlib-shared", "-L--export-dynamic"' \ - $CMAKE_CROSSOPTS -S "$builddir" -B "$builddir/stage1" - make -C "$builddir/stage1" + -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-linker=bfd", "-link-defaultlib-shared", "-L--export-dynamic", "-L--eh-frame-hdr"' \ + -DLLVM_ROOT_DIR="/usr/lib/llvm$_llvmver" \ + $CMAKE_CROSSOPTS + ninja -C stage1 - # Then, self-build - if [ "$CBUILD" != "$CHOST" ]; then - CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" - fi - # Don't use None buildtype for now, see - # https://github.com/ldc-developers/ldc/issues/3386#issuecomment-603370855 - cmake \ + cmake -G Ninja -S . \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=True \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ - -DCMAKE_C_FLAGS="$CFLAGS" \ -DD_COMPILER="$builddir/stage1/bin/ldmd2" \ -DC_SYSTEM_LIBS="unwind;m;pthread;rt;dl" \ - -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-linker=bfd", "-link-defaultlib-shared", "-L--export-dynamic"' \ - $CMAKE_CROSSOPTS "$builddir" - make + -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-linker=bfd", "-link-defaultlib-shared", "-L--export-dynamic", "-L--eh-frame-hdr"' \ + -DLLVM_ROOT_DIR="/usr/lib/llvm$_llvmver" \ + $CMAKE_CROSSOPTS + ninja # Build the test runners - # Use of `-L--export-dynamic` is needed so that exceptions work correctly - # (namely: function names should be available without debug infos). - make all-test-runners - - # CMake added the rpaths to the shared libs (of stage1!) - strip them - chrpath -d "$builddir"/lib/*.so* - chrpath -d \ - "$builddir"/bin/ldc2 \ - "$builddir"/bin/ldmd2 \ - "$builddir"/bin/ldc-build-runtime \ - "$builddir"/bin/ldc-prune-cache + if want_check; then + ninja all-test-runners + fi } check() { @@ -85,18 +88,17 @@ check() { export LD_LIBRARY_PATH="$builddir"/lib case "$CARCH" in - # Math & numeric related tests fail due to https://github.com/ldc-developers/ldc/issues/3270#issuecomment-613132406 - # druntime-test-thread fails due to https://github.com/ldc-developers/ldc/issues/3403 - aarch64) - _tests_ignore="|core\.thread\.fiber|std.*math.*|std\.numeric.*|std\.format|std\.algorithm\.sorting.*|druntime-test-thread|std\.complex.*" - ;; - # https://github.com/ldc-developers/ldc/issues/3404 - x86) - _tests_ignore="|druntime-test-thread" - ;; + # Math & numeric related tests fail due to https://github.com/ldc-developers/ldc/issues/3270#issuecomment-613132406 + # druntime-test-thread fails due to https://github.com/ldc-developers/ldc/issues/3403 + aarch64) + _tests_ignore="|core\.thread\.fiber|std.*math.*|std\.numeric.*|std\.format|std\.algorithm\.sorting.*|druntime-test-thread|std\.complex.*" + ;; + # https://github.com/ldc-developers/ldc/issues/3404 + x86) + _tests_ignore="|druntime-test-thread" + ;; esac - # Note: The testsuite does not parallelize well, as the 'clean' target get run in parallel. # Hence '-j${JOBS}' was left out on purpose # @@ -107,64 +109,47 @@ check() { # - 'druntime-test-shared' fails, probably because it is using 'Object.factory' # - 'druntime-test-stdcpp' fails for an unknown reason and is temporarily disabled # - 'druntime-test-exceptions' fails for an unknown reason and is temporarily disabled - # - # The following two tests fail since v1.27.0, but seems to fail for unrelated reason. - # - 'druntime-test-cycles' - # - 'druntime-test-gc' - # Namely, the following assert is triggered: - # core.exception.AssertError@../../src/rt/lifetime.d(1250): Assertion failure - # ---------------- - # ??:? _d_assert [0x7fc894efb1a0] - # ??:? void rt.lifetime.__unittest_L1236_C12() [0x5642121a5040] - # - # Link: https://github.com/ldc-developers/druntime/blob/8e135b4e978975b24536e2a938801a29b39dc9f6/src/rt/lifetime.d#L1250 - # However this unittest is AFAICS unrelated to the two tests, - # and either succeed or isn't run on its own. - ctest --output-on-failure -E "dmd-testsuite|lit-tests|druntime-test-exceptions|druntime-test-shared|druntime-test-stdcpp|druntime-test-cycles|druntime-test-gc$_tests_ignore" + # + # The following two tests fail since v1.27.0, but seems to fail for unrelated reason. + # - 'druntime-test-cycles' + # - 'druntime-test-gc' + # Namely, the following assert is triggered: + # core.exception.AssertError@../../src/rt/lifetime.d(1250): Assertion failure + # ---------------- + # ??:? _d_assert [0x7fc894efb1a0] + # ??:? void rt.lifetime.__unittest_L1236_C12() [0x5642121a5040] + # + # Link: https://github.com/ldc-developers/druntime/blob/8e135b4e978975b24536e2a938801a29b39dc9f6/src/rt/lifetime.d#L1250 + # However this unittest is AFAICS unrelated to the two tests, + # and either succeed or isn't run on its own. + ctest --output-on-failure -E "std.datetime.timezone*|dmd-testsuite|lit-tests|druntime-test-exceptions|druntime-test-shared|druntime-test-stdcpp|druntime-test-cycles|druntime-test-gc$_tests_ignore" } package() { - # Use -j1, the install is flaky with too many build jobs - make -j1 DESTDIR="$pkgdir" install + DESTDIR="$pkgdir" cmake --install . + + # CMake added the rpaths to the shared libs (of stage1!) - strip them + chrpath -d "$pkgdir"/usr/lib/*.so* "$pkgdir"/usr/bin/* mkdir -p "$pkgdir"/usr/share/bash-completion mv "$pkgdir"/etc/bash_completion.d "$pkgdir"/usr/share/bash-completion/completions } runtime() { - depends="libexecinfo-dev" pkgdesc="Dynamic runtime library for D code compiled with $pkgname-$pkgver" + depends= - mkdir -p "$subpkgdir/usr/lib/" - for libn in "libdruntime" "libphobos2"; - do - mv "$pkgdir"/usr/lib/$libn-ldc-shared.so* "$subpkgdir/usr/lib/" + for libn in libdruntime libphobos2; do + amove usr/lib/$libn-ldc-shared.so* done # As of LDC v1.28.0, JIT is not supported for LLVM >= 12 # https://github.com/ldc-developers/ldc/blob/v1.28.0/CMakeLists.txt#L452 #mv "$pkgdir"/usr/lib/libldc-jit.so* "$subpkgdir/usr/lib" - mv "$pkgdir"/usr/lib/*.so* "$subpkgdir/usr/lib/" -} - -static() { - depends="libexecinfo-static" - pkgdesc="$pkgdesc (static library)" - - mkdir -p "$subpkgdir/usr/lib/" - mv "$pkgdir"/usr/lib/*.a "$subpkgdir/usr/lib/" -} - -bashcomp() { - depends="" - pkgdesc="Bash completions for $pkgname" - install_if="$pkgname=$pkgver-r$pkgrel bash-completion" - - amove usr/share/bash-completion/completions + amove usr/lib/*.so* } sha512sums=" -3e566282175d65eb075c9c076bcf0475658c747238ed91efd350a7834d6d54760310ac5249fb74db3812c07058efbca8d726427ef39055d77b3f9a6940bf4188 ldc-1.28.0-src.tar.gz -19a04c789b5f447dbc7dcf3536ef4f613ab4e637a4a707e3d5ba2445b4590881c030d7302a8ef3393ce5ca5bc9fb5695ba8b63b63fcd40b8d9c2fd147c079292 0001-Add-OpenBSD-to-section_ldc.d-202.patch -a59dc0c05f9e6c74efe8f6c9ea35dff89fd2a34fc79c793925df997904da3b6032803a74715641c11944f7ef49ab96ddea70eabc25005f2e00ad1d9af2bd7bd8 0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch +ef5a42934e24caf947b63ef29a62205b07b539a59292266877f2d5f5ecf06272e1fc3ca83772d02eda203e4b166fbcea788b804740b8780b07a4643e4b51bf70 ldc-1.33.0-src.tar.gz +068ab2b4f2f4c43ca3b68a7b6adabefd7ee32e9ace272a5e0146d5afd4b37d90dd5d44f838bdb08313445de40b8701fbf19bf265e26c6c4f3a33a8cf3dbbeab1 lfs64.patch " |