aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2020-05-13 17:31:31 +0200
committerRasmus Thomsen <oss@cogitri.dev>2020-05-14 08:17:22 +0000
commit5d29e34eeaea08e71b3e9fe1716b8bd3d2dbb17e (patch)
tree49d58aa1bc7f019618f69136136b518e6ba73645
parent923be274cedd15e63fcae4d367c6b456d2b7c638 (diff)
community/ldc: add upstream patch to add missing definitions in stdlib
-rw-r--r--community/ldc/APKBUILD6
-rw-r--r--community/ldc/add-missing-musl-definitions.patch138
2 files changed, 142 insertions, 2 deletions
diff --git a/community/ldc/APKBUILD b/community/ldc/APKBUILD
index 95c372c9720..9eac2dd8853 100644
--- a/community/ldc/APKBUILD
+++ b/community/ldc/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Mathias LANG <pro.mathias.lang@gmail.com>
pkgname=ldc
pkgver=1.20.1
-pkgrel=5
+pkgrel=6
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
@@ -23,6 +23,7 @@ source="https://github.com/ldc-developers/ldc/releases/download/v$pkgver/ldc-$pk
01-conf.patch
disable-static-assert.patch
3332.patch
+ add-missing-musl-definitions.patch
"
builddir="$srcdir/ldc-$pkgver-src/"
@@ -140,4 +141,5 @@ bashcomp() {
sha512sums="bb699999a69de1773a10998c653b5a1b0bce30e39cfcee0e19b036378b28519b3118ac369b341cfd305a8a9bd904564ffffe83f720a62ab4f2c1942c2e26bb53 ldc-1.20.1-src.tar.gz
1a8ec8d75a5d01a1bc41e4b641e0663344fcbc44f3f10287f8cc716095faeadfa3dfc4ce7d84d72522151454e54d95e9f623ec5862e98e837d8fe44057307ce9 01-conf.patch
b6f3af48a927ae9f0517389f355e23746165322065525af0cd81a82c3402fff29198f2db5d118d9509dd961fef5971f359617c6a4d938fa57d64a544521984fe disable-static-assert.patch
-086bb8e7f6528fcc9aa715b6a9f99556b6f8c859377604d823c27fd615e815fe03e5c2ba805453ac4fce6253307616621a81c37577ce62564e7b954c5ccd9ac9 3332.patch"
+086bb8e7f6528fcc9aa715b6a9f99556b6f8c859377604d823c27fd615e815fe03e5c2ba805453ac4fce6253307616621a81c37577ce62564e7b954c5ccd9ac9 3332.patch
+09eed3314ff9e223052e411b12ca6e68ae572ec20ac96d24f4cf6b847575a5877e12d6687c9b19a1874f1636e0ff083735d295793d741edd4d84ef702bfb7912 add-missing-musl-definitions.patch"
diff --git a/community/ldc/add-missing-musl-definitions.patch b/community/ldc/add-missing-musl-definitions.patch
new file mode 100644
index 00000000000..545bba3b29b
--- /dev/null
+++ b/community/ldc/add-missing-musl-definitions.patch
@@ -0,0 +1,138 @@
+Upstream: Yes: https://github.com/dlang/druntime/pull/3036.patch
+Reason: A few definitions of the C headers aren't in the D bindings on musl.
+As such, we have to add them to be able to build software which uses these
+APIs
+diff --git a/runtime/druntime/src/core/sys/posix/stdio.d b/runtime/druntime/src/core/sys/posix/stdio.d
+index e617595..600e8aa 100644
+--- a/runtime/druntime/src/core/sys/posix/stdio.d
++++ b/runtime/druntime/src/core/sys/posix/stdio.d
+@@ -180,6 +180,37 @@ else version (CRuntime_UClibc)
+ FILE* tmpfile();
+ }
+ }
++else version (CRuntime_Musl)
++{
++ static if ( __USE_FILE_OFFSET64 )
++ {
++ int fgetpos64(FILE*, fpos_t *);
++ alias fgetpos64 fgetpos;
++
++ FILE* fopen64(const scope char*, const scope char*);
++ alias fopen64 fopen;
++
++ FILE* freopen64(const scope char*, const scope char*, FILE*);
++ alias freopen64 freopen;
++
++ int fseek(FILE*, c_long, int);
++
++ int fsetpos64(FILE*, const scope fpos_t*);
++ alias fsetpos64 fsetpos;
++
++ FILE* tmpfile64();
++ alias tmpfile64 tmpfile;
++ }
++ else
++ {
++ int fgetpos(FILE*, fpos_t *);
++ FILE* fopen(const scope char*, const scope char*);
++ FILE* freopen(const scope char*, const scope char*, FILE*);
++ int fseek(FILE*, c_long, int);
++ int fsetpos(FILE*, const scope fpos_t*);
++ FILE* tmpfile();
++ }
++}
+ else version (Solaris)
+ {
+ static if (__USE_FILE_OFFSET64 && __WORDSIZE != 64)
+@@ -277,6 +308,30 @@ else version (CRuntime_UClibc)
+ off_t ftello(FILE*);
+ }
+ }
++else version (CRuntime_Musl)
++{
++ enum L_ctermid = 20;
++
++ static if ( __USE_FILE_OFFSET64 )
++ {
++ int fseeko64(FILE*, off_t, int);
++ alias fseeko64 fseeko;
++ }
++ else
++ {
++ int fseeko(FILE*, off_t, int);
++ }
++
++ static if ( __USE_FILE_OFFSET64 )
++ {
++ off_t ftello64(FILE*);
++ alias ftello64 ftello;
++ }
++ else
++ {
++ off_t ftello(FILE*);
++ }
++}
+ else version (Solaris)
+ {
+ enum L_ctermid = 9;
+@@ -331,6 +386,9 @@ else version (OpenBSD) // as of OpenBSD 5.4
+ version = HaveMemstream;
+ else version (CRuntime_UClibc)
+ version = HaveMemstream;
++// http://git.musl-libc.org/cgit/musl/commit/src/stdio/open_memstream.c?id=b158b32a44d56ef20407d4285b58180447ffff1f
++else version (CRuntime_Musl)
++ version = HaveMemstream;
+
+ version (HaveMemstream)
+ {
+diff --git a/runtime/druntime/src/core/sys/posix/stdlib.d b/runtime/druntime/src/core/sys/posix/stdlib.d
+index 4ee533a..7efdc9b 100644
+--- a/runtime/druntime/src/core/sys/posix/stdlib.d
++++ b/runtime/druntime/src/core/sys/posix/stdlib.d
+@@ -574,9 +574,45 @@ else version (CRuntime_Bionic)
+ }
+ else version (CRuntime_Musl)
+ {
+- char* realpath(const scope char*, char*);
++ c_long a64l(const scope char*);
++ double drand48();
++ char* ecvt(double, int, int *, int *); // LEGACY
++ double erand48(ref ushort[3]);
++ char* fcvt(double, int, int *, int *); // LEGACY
++ char* gcvt(double, int, char*); // LEGACY
++ int getsubopt(char**, const scope char**, char**);
++ int grantpt(int);
++ char* initstate(uint, char*, size_t);
++ c_long jrand48(ref ushort[3]);
++ char* l64a(c_long);
++ void lcong48(ref ushort[7]);
++ c_long lrand48();
++ char* mktemp(char*); // LEGACY
++ char* mkdtemp(char*); // Defined in IEEE 1003.1, 2008 Edition
++ int mkstemp(char*);
++ c_long mrand48();
++ c_long nrand48(ref ushort[3]);
++ int posix_openpt(int);
++ char* ptsname(int);
+ int putenv(char*);
++ c_long random();
++ char* realpath(const scope char*, char*);
++ ushort *seed48(ref ushort[3]);
++ void setkey(const scope char*);
++ char* setstate(const scope char*);
++ void srand48(c_long);
++ void srandom(uint);
++ int unlockpt(int);
++
++ static if ( __USE_LARGEFILE64 )
++ {
++ int mkstemp64(char*);
++ alias mkstemp64 mkstemp;
++ }
++ else
++ {
+ int mkstemp(char*);
++ }
+
+ }
+ else version (Solaris)