Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldc: build in 2 stages, update to 1.30.0 #40931

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions common/shlibs
Original file line number Diff line number Diff line change
Expand Up @@ -2189,11 +2189,11 @@ libFcitx5Config.so.6 libfcitx5-5.0.5_1
libFcitx5GClient.so.2 fcitx5-gtk-5.0.4_1
libFcitx5Qt5DBusAddons.so.1 fcitx5-qt5-5.0.3_1
libFcitx5Qt5WidgetsAddons.so.2 fcitx5-qt5-5.0.3_1
libdruntime-ldc-debug-shared.so.98 ldc-runtime-1.28.0_1
libdruntime-ldc-shared.so.98 ldc-runtime-1.28.0_1
libphobos2-ldc-shared.so.98 ldc-runtime-1.28.0_1
libphobos2-ldc-debug-shared.so.98 ldc-runtime-1.28.0_1
libldc-jit.so.99 ldc-runtime-1.29.0_1
libdruntime-ldc-debug-shared.so.100 ldc-runtime-debug-1.30.0_1
libphobos2-ldc-debug-shared.so.100 ldc-runtime-debug-1.30.0_1
libdruntime-ldc-shared.so.100 ldc-runtime-1.30.0_1
libphobos2-ldc-shared.so.100 ldc-runtime-1.30.0_1
libldc-jit.so.100 ldc-runtime-1.30.0_1
libmarblewidget-qt5.so.28 marble5-17.12.2_1
libastro.so.2 marble5-17.12.2_1
libparrot.so.6.9.0 parrot-6.9.0_1
Expand Down
1 change: 1 addition & 0 deletions srcpkgs/ldc-runtime-debug
48 changes: 48 additions & 0 deletions srcpkgs/ldc-stage1/files/musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
taken from: https://github.com/dlang/druntime/pull/3830/commits/210d4c8b42ef916c65b8f052829f7b2aa27061b0.patch

--- a/runtime/druntime/src/core/sys/posix/sys/socket.d
+++ b/runtime/druntime/src/core/sys/posix/sys/socket.d
@@ -188,10 +188,40 @@

extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }

- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ version (CRuntime_Musl)
{
- return __cmsg_nxthdr(msg, cmsg);
+ extern (D)
+ {
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1));
+ }
+
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return cmsg + __CMSG_LEN(cmsg);
+ }
+
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc
+ {
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen);
+ }
+
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return cmsg.cmsg_len < cmsghdr.sizeof ||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg)
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg);
+ }
+ }
+ }
+ else
+ {
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return __cmsg_nxthdr(msg, cmsg);
+ }
}

extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
47 changes: 47 additions & 0 deletions srcpkgs/ldc-stage1/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Template file for 'ldc-stage1'
pkgname=ldc-stage1
version=1.30.0
revision=1
build_style=cmake
configure_args="
-DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DBASH_COMPLETION_COMPLETIONSDIR=/usr/share/bash-completion
-DCOMPILE_D_MODULES_SEPARATELY=ON
-DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
hostmakedepends="dmd llvm perl pkg-config"
makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
llvm-libunwind-devel"
depends="llvm-libunwind-devel"
checkdepends="python3"
short_desc="LLVM D Compiler - stage 1"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="BSD-3-Clause, BSL-1.0"
homepage="https://wiki.dlang.org/LDC"
changelog="https://raw.githubusercontent.com/ldc-developers/ldc/master/CHANGELOG.md"
distfiles="https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz"
checksum=fdbb376f08242d917922a6a22a773980217fafa310046fc5d6459490af23dacd
nopie=yes
nocross="dmd compilation fails on cross"
make_check=no
make_build_args=-v
conflicts="ldc>=0 ldc-runtime>=0 ldc-runtime-debug>=0"
provides="ldc-${version}_1
ldc-runtime-${version}_1
ldc-runtime-debug-${version}_1"
shlib_provides="
libdruntime-ldc-debug-shared.so.100
libphobos2-ldc-debug-shared.so.100
libdruntime-ldc-shared.so.100
libphobos2-ldc-shared.so.100"

post_patch() {
if [ "$XBPS_TARGET_LIBC" = musl ]; then
patch -Np1 -i "$FILESDIR/musl.patch"
fi
}

post_install() {
vlicense LICENSE
}
48 changes: 48 additions & 0 deletions srcpkgs/ldc/files/musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
taken from: https://github.com/dlang/druntime/pull/3830/commits/210d4c8b42ef916c65b8f052829f7b2aa27061b0.patch

--- a/runtime/druntime/src/core/sys/posix/sys/socket.d
+++ b/runtime/druntime/src/core/sys/posix/sys/socket.d
@@ -188,10 +188,40 @@

extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }

- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ version (CRuntime_Musl)
{
- return __cmsg_nxthdr(msg, cmsg);
+ extern (D)
+ {
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1));
+ }
+
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return cmsg + __CMSG_LEN(cmsg);
+ }
+
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc
+ {
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen);
+ }
+
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return cmsg.cmsg_len < cmsghdr.sizeof ||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg)
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg);
+ }
+ }
+ }
+ else
+ {
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc
+ {
+ return __cmsg_nxthdr(msg, cmsg);
+ }
}

extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc
37 changes: 27 additions & 10 deletions srcpkgs/ldc/template
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Template file for 'ldc'
pkgname=ldc
version=1.28.0
revision=2
reverts="1.29.0_1"
version=1.30.0
revision=1
build_style=cmake
configure_args="
-DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
Expand All @@ -11,30 +10,48 @@ configure_args="
-DBASH_COMPLETION_COMPLETIONSDIR=/usr/share/bash-completion
-DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
conf_files="/etc/ldc2.conf"
hostmakedepends="dmd llvm12 perl pkg-config"
hostmakedepends="ldc-stage1 llvm12 perl pkg-config"
makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
llvm-libunwind-devel"
depends="ldc-runtime llvm-libunwind-devel"
checkdepends="python3"
depends="ldc-runtime ldc-runtime-debug llvm-libunwind-devel"
checkdepends="python3-lit gdb"
short_desc="Portable D programming language compiler based on LLVM"
maintainer="Auri <me@aurieh.me>"
license="BSD-3-Clause, BSL-1.0"
homepage="https://wiki.dlang.org/LDC"
changelog="https://raw.githubusercontent.com/ldc-developers/ldc/master/CHANGELOG.md"
distfiles="https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz"
checksum=17fee8bb535bcb8cda0a45947526555c46c045f302a7349cc8711b254e54cf09
checksum=fdbb376f08242d917922a6a22a773980217fafa310046fc5d6459490af23dacd
nopie=yes
nocross="dmd compilation fails on cross"
# nocross="dmd compilation fails on cross"
# tests timeout on musl; also require unpackaged python3-lit
make_check=no
# make_check=no
make_build_args=-v

if [ "$XBPS_TARGET_LIBC" = glibc ]; then
checkdepends+=" libsanitizer-devel"
fi

post_patch() {
if [ "$XBPS_TARGET_LIBC" = musl ]; then
patch -Np1 -i "$FILESDIR/musl.patch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch supports glibc so it doesn't need to be conditional.
It was merged upstream:
dlang/dmd@5454426

fi
}

post_install() {
vlicense LICENSE
}

ldc-runtime-debug_package() {
short_desc+=" - D runtime (debug version)"
pkg_install() {
vmove "usr/lib/*ldc-debug-shared.so.*"
}
}

ldc-runtime_package() {
short_desc+=" - D runtime"
pkg_install() {
vmove "usr/lib/*.so*"
vmove "usr/lib/*ldc-shared.so.*"
}
}