# Contributor: Mathias LANG # Maintainer: Mathias LANG pkgname=ldc pkgver=1.18.0 pkgrel=0 pkgdesc="The LLVM-based D Compiler" url="https://github.com/ldc-developers/ldc" # Bootstrapping was done with an upstream-provided package, # with only x86_64 available # Once we can use GDC for bootstrapping, this can be "all" arch="x86_64" license="BSD-3-Clause AND BSL-1.0 AND (Artistic-1.0 OR GPL-2.0-or-later) AND NCSA AND MIT" depends="libexecinfo tzdata" makedepends="bash chrpath cmake curl-dev diffutils dlang-compiler gdb grep llvm9-dev llvm9-static libedit-dev libexecinfo-static py-pip zlib-dev" # A user might want to install the '-runtime' subpackage when they have # a dynamically-linked D program. subpackages="$pkgname-runtime $pkgname-static" provides="dlang-compiler" source="https://github.com/ldc-developers/ldc/releases/download/v$pkgver/ldc-$pkgver-src.tar.gz 01-stdio-fseek.patch 02-conf.patch" builddir="$srcdir/ldc-$pkgver-src/" build() { if [ "$CBUILD" != "$CHOST" ]; then CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" fi cmake \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=True \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_C_FLAGS="$CFLAGS" \ $CMAKE_CROSSOPTS "$builddir" make # CMake added the rpaths to the shared libs - strip them chrpath -d "$builddir"/lib/*.so* : } check() { # Dependency to lit-test python -m pip install --user lit # Note: The testsuite does not parallelize well, as the `clean` target get run in parallel. # Hence `-j${JOBS}` was left out on purpose # # - dmd-testsuite takes too long to run and has more to do with language checks # which are less relevant to us than platform integration tests # - lit-test disabled because 'TEST 'LDC :: debuginfo/print_gdb.d' FAILED' # Something to do with TLS variables not being printable in GDB # - '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 ctest --output-on-failure -E "dmd-testsuite|lit-tests|druntime-test-exceptions|druntime-test-shared|druntime-test-stdcpp" } package() { make DESTDIR="$pkgdir" install } runtime() { depends="libexecinfo-dev" pkgdesc="Dynamic runtime library for D code compiled with $pkgname-$pkgver" mkdir -p "$subpkgdir/usr/lib/" for libn in "libdruntime" "libphobos2"; do mv "$pkgdir"/usr/lib/$libn-ldc-shared.so* "$subpkgdir/usr/lib/" done 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/" } sha512sums="fe7529c33d0e43dfb71f474dfa381b88ee476b70933c8f80fc063d9a015df24a75e2b607a7242cc4b9cd4b6ac7559aec8f2883016bf7252342742322fcccbd4d ldc-1.18.0-src.tar.gz 20d6bb560867052edeed6005e15473dae25c62002c7bd47f0e37610ffd5e94a50b49244c2a9b814f4858babca403f120ae6028cd86f964dd4734736eda068536 01-stdio-fseek.patch eb86e4be0ecf72aaabbd5608c8056bb9cede035895e766330b6d14f14c06dc513fcecc1b6e56ab6fc9fc26c220a689cc8b1394a30a319189c414f1e067c1d983 02-conf.patch"