1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 20:55:19 +03:00
aports/community/ldc/add-missing-musl-definitions.patch

138 lines
4 KiB
Diff

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)