diff --git a/srcpkgs/dmd-doc b/srcpkgs/dmd-doc
new file mode 120000
index 0000000000..81ab130de9
--- /dev/null
+++ b/srcpkgs/dmd-doc
@@ -0,0 +1 @@
+dmd
\ No newline at end of file
diff --git a/srcpkgs/dmd/files/default_ddoc_theme.ddoc b/srcpkgs/dmd/files/default_ddoc_theme.ddoc
deleted file mode 100644
index 93c8f6c192..0000000000
--- a/srcpkgs/dmd/files/default_ddoc_theme.ddoc
+++ /dev/null
@@ -1,735 +0,0 @@
-LPAREN = (
-RPAREN = )
-BACKTICK = `
-DOLLAR = $
-
-ESCAPES =
- /</
- />/>/
- /&/&/
-
-B = $0
-I = $0
-U = $0
-P =
$0
-DL = $0
-DT = $0
-DD = $0
-TABLE =
-TR = $0
-TH = $0 |
-TD = $0 |
-OL = $0
-UL =
-LI = $0
-BIG = $0
-SMALL = $0
-BR =
-LINK = $0
-LINK2 = $+
-DEPRECATED = $0
-
-RED = $0
-BLUE = $0
-GREEN = $0
-YELLOW = $0
-BLACK = $0
-WHITE = $0
-
-D_CODE =
-
-
-D_INLINECODE = $0
-DDOC_BACKQUOTED = $(D_INLINECODE $0)
-D_COMMENT =
-D_STRING = $0
-D_KEYWORD = $0
-D_PSYMBOL = $0
-D_PARAM = $0
-
-DDOC_BLANKLINE =
-DDOC_COMMENT =
-
-DDOC =
-
-
-
-
- $(TITLE)
-
-
-
-
-
-
-
-DDOC_MODULE_MEMBERS =
-
- $(DDOC_MEMBERS $0)
-
-
-
-DDOC_CLASS_MEMBERS = $(DDOC_MEMBERS $0)
-DDOC_STRUCT_MEMBERS = $(DDOC_MEMBERS $0)
-DDOC_ENUM_MEMBERS = $(DDOC_MEMBERS $0)
-DDOC_TEMPLATE_MEMBERS = $(DDOC_MEMBERS $0)
-
-DDOC_MEMBERS =
-
-DDOC_MEMBER =
- $0
-
-
-DDOC_MEMBER_HEADER =
-
-DDOC_HEADER_ANCHOR =
-
-DDOC_DECL =
-
-DDOC_ANCHOR =
-
-DDOC_DECL_DD =
- $0
-
-
-DDOC_SECTIONS =
-
-DDOC_SUMMARY =
-
-DDOC_DESCRIPTION =
-
-DDOC_EXAMPLES =
-
-DDOC_RETURNS =
-
Return Value
-
- $0
-
-
-
-DDOC_PARAMS =
-
-DDOC_PARAM_ROW =
- $0
-
-
-DDOC_PARAM_ID =
-
- $0
-
- |
-
-DDOC_PARAM_DESC =
-
- |
-
-DDOC_LICENSE =
-
-DDOC_AUTHORS =
-
-DDOC_BUGS =
-
-DDOC_COPYRIGHT =
-
-DDOC_DATE =
-
-DDOC_DEPRECATED =
-
-DDOC_HISTORY =
-
-DDOC_SEE_ALSO =
-
-DDOC_STANDARDS =
-
-DDOC_THROWS =
-
-DDOC_VERSION =
-
-DDOC_SECTION =
-
-DDOC_SECTION_H = $0
-
-DDOC_DITTO =
-$0
-
-DDOC_PSYMBOL = $0
-DDOC_ENUM_BASETYPE = $0
-DDOC_PSUPER_SYMBOL = $0
-DDOC_KEYWORD = $0
-DDOC_PARAM = $0
-DDOC_CONSTRAINT = $(DDOC_CONSTRAINT) if ($0)
-DDOC_OVERLOAD_SEPARATOR = $0
-DDOC_TEMPLATE_PARAM_LIST = $0
-DDOC_TEMPLATE_PARAM = $0
diff --git a/srcpkgs/dmd/files/musl.patch b/srcpkgs/dmd/files/musl.patch
new file mode 100644
index 0000000000..023b7d5eb5
--- /dev/null
+++ b/srcpkgs/dmd/files/musl.patch
@@ -0,0 +1,11 @@
+--- dmd/src/dmd/mars.d
++++ dmd/src/dmd/mars.d
+@@ -1374,7 +1374,7 @@ void addDefaultVersionIdentifiers()
+ }
+ else static if (TARGET.Linux)
+ {
+- VersionCondition.addPredefinedGlobalIdent("CRuntime_Glibc");
++ VersionCondition.addPredefinedGlobalIdent("CRuntime_Musl");
+ }
+
+ if (global.params.isLP64)
diff --git a/srcpkgs/dmd/patches/6193.patch b/srcpkgs/dmd/patches/6193.patch
new file mode 100644
index 0000000000..09d16b4616
--- /dev/null
+++ b/srcpkgs/dmd/patches/6193.patch
@@ -0,0 +1,145 @@
+From 034988a0db917719b59887d8017addba76076b1f Mon Sep 17 00:00:00 2001
+From: Joakim
+Date: Sat, 17 Feb 2018 14:25:07 +0530
+Subject: [PATCH] Add needed changes to get all tests passing with Musl
+
+---
+ .../allocator/building_blocks/region.d | 6 +++
+ std/socket.d | 44 +---------------------
+ std/stdio.d | 24 ++++++------
+ 3 files changed, 19 insertions(+), 55 deletions(-)
+
+diff --git a/std/experimental/allocator/building_blocks/region.d b/std/experimental/allocator/building_blocks/region.d
+index 40a5387c64..c277498d1e 100644
+--- phobos/std/experimental/allocator/building_blocks/region.d
++++ phobos/std/experimental/allocator/building_blocks/region.d
+@@ -647,6 +647,12 @@ struct InSituRegion(size_t size, size_t minAlign = platformAlignment)
+ assert((() nothrow @nogc => r2.deallocateAll())());
+ }
+
++version(CRuntime_Musl)
++{
++ // sbrk and brk are disabled in Musl:
++ // https://git.musl-libc.org/cgit/musl/commit/?id=7a995fe706e519a4f55399776ef0df9596101f93
++ // https://git.musl-libc.org/cgit/musl/commit/?id=863d628d93ea341b6a32661a1654320ce69f6a07
++} else:
+ private extern(C) void* sbrk(long) nothrow @nogc;
+ private extern(C) int brk(shared void*) nothrow @nogc;
+
+diff --git a/std/socket.d b/std/socket.d
+index 6a5e5ff2ba..8f0c8a225a 100644
+--- phobos/std/socket.d
++++ phobos/std/socket.d
+@@ -163,47 +163,7 @@ string formatSocketError(int err) @trusted
+ {
+ cs = strerror_r(err, buf.ptr, buf.length);
+ }
+- else version (OSX)
+- {
+- auto errs = strerror_r(err, buf.ptr, buf.length);
+- if (errs == 0)
+- cs = buf.ptr;
+- else
+- return "Socket error " ~ to!string(err);
+- }
+- else version (FreeBSD)
+- {
+- auto errs = strerror_r(err, buf.ptr, buf.length);
+- if (errs == 0)
+- cs = buf.ptr;
+- else
+- return "Socket error " ~ to!string(err);
+- }
+- else version (NetBSD)
+- {
+- auto errs = strerror_r(err, buf.ptr, buf.length);
+- if (errs == 0)
+- cs = buf.ptr;
+- else
+- return "Socket error " ~ to!string(err);
+- }
+- else version (DragonFlyBSD)
+- {
+- auto errs = strerror_r(err, buf.ptr, buf.length);
+- if (errs == 0)
+- cs = buf.ptr;
+- else
+- return "Socket error " ~ to!string(err);
+- }
+- else version (Solaris)
+- {
+- auto errs = strerror_r(err, buf.ptr, buf.length);
+- if (errs == 0)
+- cs = buf.ptr;
+- else
+- return "Socket error " ~ to!string(err);
+- }
+- else version (CRuntime_Bionic)
++ else
+ {
+ auto errs = strerror_r(err, buf.ptr, buf.length);
+ if (errs == 0)
+@@ -211,8 +171,6 @@ string formatSocketError(int err) @trusted
+ else
+ return "Socket error " ~ to!string(err);
+ }
+- else
+- static assert(0);
+
+ auto len = strlen(cs);
+
+diff --git a/std/stdio.d b/std/stdio.d
+index 16d34f0e94..9f0495d98c 100644
+--- phobos/std/stdio.d
++++ phobos/std/stdio.d
+@@ -44,38 +44,38 @@ version (CRuntime_Glibc)
+ version = GCC_IO;
+ version = HAS_GETDELIM;
+ }
+-
+-version (OSX)
++else version (CRuntime_Bionic)
+ {
+ version = GENERIC_IO;
+ version = HAS_GETDELIM;
+ }
+-
+-version (FreeBSD)
++else version (CRuntime_Musl)
+ {
+ version = GENERIC_IO;
+ version = HAS_GETDELIM;
+ }
+
+-version (NetBSD)
++version (OSX)
+ {
+ version = GENERIC_IO;
+ version = HAS_GETDELIM;
+ }
+-
+-version (DragonFlyBSD)
++else version (FreeBSD)
+ {
+ version = GENERIC_IO;
+ version = HAS_GETDELIM;
+ }
+-
+-version (Solaris)
++else version (NetBSD)
+ {
+ version = GENERIC_IO;
+- version = NO_GETDELIM;
++ version = HAS_GETDELIM;
+ }
+-
+-version (CRuntime_Bionic)
++else version (DragonFlyBSD)
++{
++ version = GENERIC_IO;
++ version = HAS_GETDELIM;
++}
++else version (Solaris)
+ {
+ version = GENERIC_IO;
+ version = NO_GETDELIM;
diff --git a/srcpkgs/dmd/template b/srcpkgs/dmd/template
index eef80af1e6..b177c0cd15 100644
--- a/srcpkgs/dmd/template
+++ b/srcpkgs/dmd/template
@@ -1,88 +1,105 @@
# Template file for 'dmd'
pkgname=dmd
-version=2.077.0
-revision=2
-wrksrc="dmd2"
+version=2.079.0
+revision=1
+create_wrksrc=yes
short_desc="The Digital Mars D compiler"
maintainer="Juan RP "
homepage="http://www.digitalmars.com/d/2.0/"
license="Boost Software License 1.0"
-distfiles="http://downloads.dlang.org/releases/2.x/${version}/dmd.${version}.linux.tar.xz
- https://raw.githubusercontent.com/dlang/dmd/5f3bdcde7a870509a3e2f1af48909c62bf8a18e7/config.sh"
-skip_extraction="config.sh"
-checksum="54471d7c5fdb73dd38cd8ab1d8ac4cb6b7aca0d0d18e7a9f38dcafcb242732f4
- 778834ad25225c6656565b3c66437543ed40066b9e40fde657c4d632fd4e391c"
+distfiles="
+ https://github.com/dlang/dmd/archive/v${version}.tar.gz>dmd-${version}.tar.gz
+ https://github.com/dlang/druntime/archive/v${version}.tar.gz>druntime-${version}.tar.gz
+ https://github.com/dlang/phobos/archive/v${version}.tar.gz>phobos-${version}.tar.gz
+ http://downloads.dlang.org/releases/2.x/${version}/dmd.${version}.linux.tar.xz"
+checksum="e4fed191a05051dd262198ebbfd77e9e99fbad251b67b88b3394e2cca8a41893
+531910210e29c938ecee8ff6f39d2d247e892cae71811a684a504504bf1ea29b
+39cae5b9578925a9458654c64c9a85204b7598c685c2e48b7d4fcfc37d4a3550
+75c3df4ba4e731ac0fa36a60cd04bbac05a2d79633f4602ad645f533847929ce"
-if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
- _archbits=64
-elif [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
- _archbits=32
-fi
+case "$XBPS_TARGET_MACHINE" in
+ x86_64*) _archbits=64;;
+ i686*) _archbits=32;;
+esac
-only_for_archs="x86_64"
+makedepends="dmd-bootstrap"
+only_for_archs="i686 i686-musl x86_64 x86_64-musl"
conf_files="/etc/dmd.conf"
nopie=yes
-hostmakedepends="curl"
+provides="d-compiler-${version}_${revision}"
+conflicts="dmd-bootstrap"
depends="libphobos>=${version} gcc"
+post_extract() {
+ rm -rf dmd druntime phobos
+ mv dmd-${version} dmd
+ mv druntime-${version} druntime
+ mv phobos-${version} phobos
+}
+
+pre_configure() {
+ case "$XBPS_TARGET_MACHINE" in
+ *-musl) patch -p0 < ${FILESDIR}/musl.patch
+ esac
+}
+
do_build() {
- cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/config.sh src
- chmod +x src/config.sh
-
- cd src
-
- # missing file in archive for some reason?
- mkdir -p res
- cp ${FILESDIR}/default_ddoc_theme.ddoc res
+ local dmd
cd dmd
+ make ${makejobs} -f posix.mak MODEL=${_archbits} TARGET_CPU=X86 BUILD=release PIC=1
+ dmd=${wrksrc}/dmd/generated/linux/release/$_archbits/dmd
- mkdir src
- cp osmodel.mak src
- make ${makejobs} -f posix.mak MODEL=${_archbits} AUTO_BOOTSTRAP=1 PIC=1
+ make ${makejobs} -C docs
cd ../druntime
- make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=../dmd/dmd PIC=1
+ make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=$dmd BUILD=release PIC=1
cd ../phobos
- make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=../dmd/dmd PIC=1
+ make ${makejobs} -f posix.mak MODEL=${_archbits} DMD=$dmd BUILD=release PIC=1
}
do_install() {
- vbin src/dmd/dmd
+ cd dmd
+ vbin generated/linux/release/$_archbits/dmd
vinstall ${FILESDIR}/dmd.conf 644 etc
- vman man/man1/dmd.1
- vman man/man1/rdmd.1
- vman man/man5/dmd.conf.5
+ vman generated/docs/man/man1/dmd.1
+ vman generated/docs/man/man5/dmd.conf.5
+}
- vmkdir usr/share/d/samples
- cp -r samples/d/* ${DESTDIR}/usr/share/d/samples/
+dmd-doc_package() {
+ short_desc="Documentation and sample code for D programming language"
+ replaces="dmd-docs>=0"
+ license="Boost License"
- find ${DESTDIR}/usr/share/d/samples -type f | xargs chmod 0644
+ pkg_install() {
+ cd dmd2
- for f in ddemangle dumpobj obj2asm rdmd; do
- vbin linux/bin${_archbits}/${f}
- done
+ vmkdir usr/share/doc/d
+ vcopy samples usr/share/doc/d
+ vcopy html usr/share/doc/d
+
+ find ${PKGDESTDIR}/usr/share/doc/d -type f | xargs chmod 0644
+
+ vlicense license.txt
+ }
}
libphobos_package() {
- short_desc="The phobos D standard library for DMD"
+ short_desc+=" - standard library"
license="Boost License"
+ conflicts="dmd-bootstrap"
pkg_install() {
- vinstall ${wrksrc}/src/druntime/generated/linux/release/$_archbits/libdruntime.a 644 usr/lib libdruntime.a
- vinstall ${wrksrc}/src/phobos/generated/linux/release/$_archbits/libphobos2.a 644 usr/lib libphobos2.a
+ vinstall ${wrksrc}/druntime/generated/linux/release/$_archbits/libdruntime.a 644 usr/lib libdruntime.a
+ vinstall ${wrksrc}/phobos/generated/linux/release/$_archbits/libphobos2.a 644 usr/lib libphobos2.a
vmkdir usr/include/d
- cp -r ${wrksrc}/src/phobos/{*.d,etc,std} ${PKGDESTDIR}/usr/include/d
+ cp -r ${wrksrc}/phobos/{*.d,etc,std} ${PKGDESTDIR}/usr/include/d
vmkdir usr/include/d/druntime
- cp -r ${wrksrc}/src/druntime/import ${PKGDESTDIR}/usr/include/d/druntime
+ cp -r ${wrksrc}/druntime/import ${PKGDESTDIR}/usr/include/d/druntime
- vmkdir usr/share/doc/d/
- cp -r ${wrksrc}/html ${PKGDESTDIR}/usr/share/doc/d/
- find ${PKGDESTDIR}/usr/share/doc/d -type f | xargs chmod 0644
-
- vlicense ${wrksrc}/src/druntime/LICENSE
+ vlicense ${wrksrc}/druntime/LICENSE.txt
}
}