cross/gcc-*: bump pkgrel (!879)
Make the version match Alpine's gcc again. Fixes libstdc++ unsatisfiable constrains related error messages (because the libstdc++ generated by these cross-* packages has the same pkgver and pkgrel again as the one provided by Alpine's gcc package). [ci:skip-build]
This commit is contained in:
parent
f329c8f5ac
commit
57edb0f149
12 changed files with 3236 additions and 163 deletions
448
cross/gcc-aarch64/402-dlang-stat.patch
Normal file
448
cross/gcc-aarch64/402-dlang-stat.patch
Normal file
|
@ -0,0 +1,448 @@
|
|||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -779,7 +779,102 @@ else version (CRuntime_Bionic)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- enum {
|
||||
+ version (X86_64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0,
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ // Note: Definitions for i386 are in arch/generic/bits/fcntl.h
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (ARM)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x020000, // octal 0400000
|
||||
+ O_LARGEFILE = 0x010000, // octal 0200000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert(0, "Platform not supported");
|
||||
+
|
||||
+ enum
|
||||
+ {
|
||||
O_CREAT = 0x40, // octal 0100
|
||||
O_EXCL = 0x80, // octal 0200
|
||||
O_NOCTTY = 0x100, // octal 0400
|
||||
@@ -790,16 +885,11 @@ else version (CRuntime_Musl)
|
||||
O_DSYNC = 0x1000, // octal 010000
|
||||
O_SYNC = 0x101000, // octal 04010000
|
||||
O_RSYNC = O_SYNC,
|
||||
- O_DIRECTORY = 0x10000,
|
||||
- O_NOFOLLOW = 0x20000,
|
||||
O_CLOEXEC = 0x80000,
|
||||
|
||||
O_ASYNC = 0x2000,
|
||||
- O_DIRECT = 0x4000,
|
||||
- O_LARGEFILE = 0,
|
||||
O_NOATIME = 0x40000,
|
||||
O_PATH = 0x200000,
|
||||
- O_TMPFILE = 0x410000,
|
||||
O_NDELAY = O_NONBLOCK,
|
||||
O_SEARCH = O_PATH,
|
||||
O_EXEC = O_PATH,
|
||||
@@ -809,19 +899,19 @@ else version (CRuntime_Musl)
|
||||
O_WRONLY = 01,
|
||||
O_RDWR = 02,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_DUPFD = 0,
|
||||
F_GETFD = 1,
|
||||
F_SETFD = 2,
|
||||
F_GETFL = 3,
|
||||
F_SETFL = 4,
|
||||
- F_GETLK = 5,
|
||||
- F_SETLK = 6,
|
||||
- F_SETLKW = 7,
|
||||
+ // F_GETLK, F_SETLK, F_SETLKW are arch-specific
|
||||
F_SETOWN = 8,
|
||||
F_GETOWN = 9,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_RDLCK = 0,
|
||||
F_WRLCK = 1,
|
||||
F_UNLCK = 2,
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -143,8 +143,10 @@ else version (CRuntime_Bionic)
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
struct sem_t {
|
||||
- int[4*long.sizeof/int.sizeof] __val;
|
||||
+ int[4*c_long.sizeof/int.sizeof] __val;
|
||||
}
|
||||
+
|
||||
+ enum SEM_FAILED = (sem_t*).init;
|
||||
}
|
||||
else version (CRuntime_UClibc)
|
||||
{
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1587,31 +1587,225 @@ else version (CRuntime_Musl)
|
||||
S_ISGID = 0x400, // octal 02000
|
||||
S_ISVTX = 0x200, // octal 01000
|
||||
}
|
||||
- struct stat_t {
|
||||
- dev_t st_dev;
|
||||
- ino_t st_ino;
|
||||
- nlink_t st_nlink;
|
||||
-
|
||||
- mode_t st_mode;
|
||||
- uid_t st_uid;
|
||||
- gid_t st_gid;
|
||||
- uint __pad0;
|
||||
- dev_t st_rdev;
|
||||
- off_t st_size;
|
||||
- blksize_t st_blksize;
|
||||
- blkcnt_t st_blocks;
|
||||
-
|
||||
- timespec st_atim;
|
||||
- timespec st_mtim;
|
||||
- timespec st_ctim;
|
||||
- extern(D) @safe @property inout pure nothrow
|
||||
- {
|
||||
- ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
- ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
- ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ version (ARM)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ c_ulong __pad;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ int __pad2;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ uint[2] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86_64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ mode_t st_mode;
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ uint __pad0;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ c_long[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
}
|
||||
- long[3] __unused;
|
||||
}
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int[3] __pad1;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ uint[2] __pad2;
|
||||
+ off_t st_size;
|
||||
+ int __pad3;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ blksize_t st_blksize;
|
||||
+ uint __pad4;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ int[14] __pad5;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert("Unsupported platform");
|
||||
+
|
||||
private
|
||||
{
|
||||
extern (D) bool S_ISTYPE( mode_t mode, uint mask )
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
@@ -112,8 +112,26 @@ version (CRuntime_Glibc)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- alias c_long blksize_t;
|
||||
- alias c_ulong nlink_t;
|
||||
+ version (AArch64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (RISCV64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias c_ulong nlink_t;
|
||||
+ }
|
||||
alias long dev_t;
|
||||
alias long blkcnt_t;
|
||||
alias ulong ino_t;
|
137
cross/gcc-aarch64/403-dlang-ibmz.patch
Normal file
137
cross/gcc-aarch64/403-dlang-ibmz.patch
Normal file
|
@ -0,0 +1,137 @@
|
|||
diff -Nurp a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
|
||||
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1084,7 +1084,9 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
|
||||
|
||||
// base offset
|
||||
auto ti = tls_index(mod, 0);
|
||||
- version (IBMZ_Any)
|
||||
+ version (CRuntime_Musl)
|
||||
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
|
||||
+ else version (IBMZ_Any)
|
||||
{
|
||||
auto idx = cast(void *)__tls_get_addr_internal(&ti)
|
||||
+ cast(ulong)__builtin_thread_pointer();
|
||||
diff -Nurp a/libphobos/configure.ac b/libphobos/configure.ac
|
||||
--- a/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -140,6 +140,14 @@ case ${host} in
|
||||
esac
|
||||
AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
|
||||
|
||||
+AC_MSG_CHECKING([if target needs to link in swapcontext])
|
||||
+AC_MSG_RESULT($LIBDRUNTIME_NEEDS_UCONTEXT)
|
||||
+AS_IF([test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes], [
|
||||
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [], [
|
||||
+ AC_MSG_ERROR([[can't find library providing swapcontext]])
|
||||
+ ])
|
||||
+])
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
||||
diff -Nurp a/libphobos/configure.tgt b/libphobos/configure.tgt
|
||||
--- a/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -22,6 +22,13 @@
|
||||
# Disable the libphobos or libdruntime components on untested or known
|
||||
# broken systems. More targets shall be added after testing.
|
||||
LIBPHOBOS_SUPPORTED=no
|
||||
+
|
||||
+# Check if we require 'ucontext' or if we have a custom solution.
|
||||
+# Most platform uses a custom assembly solution for context switches,
|
||||
+# see `core.thread` and grep for `AsmExternal`.
|
||||
+# Definitions are in config/ARCH/
|
||||
+LIBPHOBOS_NEEDS_UCONTEXT=no
|
||||
+
|
||||
case "${target}" in
|
||||
aarch64*-*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
@@ -37,6 +44,7 @@ case "${target}" in
|
||||
;;
|
||||
s390*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
|
||||
;;
|
||||
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
diff -Nurp a/libphobos/configure b/libphobos/configure
|
||||
--- a/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -13955,6 +13955,76 @@ esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
|
||||
$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target needs to link in swapcontext" >&5
|
||||
+$as_echo_n "checking if target needs to link in swapcontext... " >&6; }
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRUNTIME_NEEDS_UCONTEXT" >&5
|
||||
+$as_echo "$LIBDRUNTIME_NEEDS_UCONTEXT" >&6; }
|
||||
+if test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes; then :
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
|
||||
+$as_echo_n "checking for library containing swapcontext... " >&6; }
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char swapcontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return swapcontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' c ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_swapcontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_swapcontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_swapcontext" >&5
|
||||
+$as_echo "$ac_cv_search_swapcontext" >&6; }
|
||||
+ac_res=$ac_cv_search_swapcontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+else
|
||||
+
|
||||
+ as_fn_error $? "can't find library providing swapcontext" "$LINENO" 5
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
411
cross/gcc-aarch64/404-dlang-zlib.patch
Normal file
411
cross/gcc-aarch64/404-dlang-zlib.patch
Normal file
|
@ -0,0 +1,411 @@
|
|||
diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
|
||||
--- a/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1,7 +1,7 @@
|
||||
// Written in the D programming language.
|
||||
|
||||
/**
|
||||
- * Compress/decompress data using the $(HTTP www._zlib.net, _zlib library).
|
||||
+ * Compress/decompress data using the $(HTTP www.zlib.net, zlib library).
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
@@ -43,12 +43,12 @@
|
||||
* References:
|
||||
* $(HTTP en.wikipedia.org/wiki/Zlib, Wikipedia)
|
||||
*
|
||||
- * Copyright: Copyright Digital Mars 2000 - 2011.
|
||||
+ * Copyright: Copyright The D Language Foundation 2000 - 2011.
|
||||
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
|
||||
* Authors: $(HTTP digitalmars.com, Walter Bright)
|
||||
- * Source: $(PHOBOSSRC std/_zlib.d)
|
||||
+ * Source: $(PHOBOSSRC std/zlib.d)
|
||||
*/
|
||||
-/* Copyright Digital Mars 2000 - 2011.
|
||||
+/* Copyright The D Language Foundation 2000 - 2011.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -75,9 +75,9 @@ enum
|
||||
|
||||
class ZlibException : Exception
|
||||
{
|
||||
- this(int errnum)
|
||||
- { string msg;
|
||||
-
|
||||
+ private static string getmsg(int errnum) nothrow @nogc pure @safe
|
||||
+ {
|
||||
+ string msg;
|
||||
switch (errnum)
|
||||
{
|
||||
case Z_STREAM_END: msg = "stream end"; break;
|
||||
@@ -90,7 +90,12 @@ class ZlibException : Exception
|
||||
case Z_VERSION_ERROR: msg = "version error"; break;
|
||||
default: msg = "unknown error"; break;
|
||||
}
|
||||
- super(msg);
|
||||
+ return msg;
|
||||
+ }
|
||||
+
|
||||
+ this(int errnum)
|
||||
+ {
|
||||
+ super(getmsg(errnum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +109,7 @@ class ZlibException : Exception
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
|
||||
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] b
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
|
||||
@@ -191,13 +196,14 @@ uint crc32(uint crc, const(void)[] buf)
|
||||
ubyte[] compress(const(void)[] srcbuf, int level)
|
||||
in
|
||||
{
|
||||
- assert(-1 <= level && level <= 9);
|
||||
+ assert(-1 <= level && level <= 9, "Compression level needs to be within [-1, 9].");
|
||||
}
|
||||
-body
|
||||
+do
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12;
|
||||
- auto destbuf = new ubyte[destlen];
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destlen);
|
||||
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
|
||||
if (err)
|
||||
{
|
||||
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf,
|
||||
throw new ZlibException(err);
|
||||
}
|
||||
}
|
||||
- assert(0);
|
||||
+ assert(0, "Unreachable code");
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@@ -370,9 +376,9 @@ class Compress
|
||||
this(int level, HeaderFormat header = HeaderFormat.deflate)
|
||||
in
|
||||
{
|
||||
- assert(1 <= level && level <= 9);
|
||||
+ assert(1 <= level && level <= 9, "Legal compression level are in [1, 9].");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
this.level = level;
|
||||
this.gzip = header == HeaderFormat.gzip;
|
||||
@@ -406,6 +412,7 @@ class Compress
|
||||
const(void)[] compress(const(void)[] buf)
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
ubyte[] destbuf;
|
||||
|
||||
@@ -420,7 +427,7 @@ class Compress
|
||||
inited = 1;
|
||||
}
|
||||
|
||||
- destbuf = new ubyte[zs.avail_in + buf.length];
|
||||
+ destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length);
|
||||
zs.next_out = destbuf.ptr;
|
||||
zs.avail_out = to!uint(destbuf.length);
|
||||
|
||||
@@ -461,9 +468,10 @@ class Compress
|
||||
void[] flush(int mode = Z_FINISH)
|
||||
in
|
||||
{
|
||||
- assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH);
|
||||
+ assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH,
|
||||
+ "Mode must be either Z_FINISH, Z_SYNC_FLUSH or Z_FULL_FLUSH.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
import core.memory : GC;
|
||||
ubyte[] destbuf;
|
||||
@@ -523,6 +531,7 @@ class UnCompress
|
||||
z_stream zs;
|
||||
int inited;
|
||||
int done;
|
||||
+ bool inputEnded;
|
||||
size_t destbufsize;
|
||||
|
||||
HeaderFormat format;
|
||||
@@ -571,16 +580,16 @@ class UnCompress
|
||||
const(void)[] uncompress(const(void)[] buf)
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
+ if (inputEnded || !buf.length)
|
||||
+ return null;
|
||||
+
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
- ubyte[] destbuf;
|
||||
-
|
||||
- if (buf.length == 0)
|
||||
- return null;
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
@@ -598,26 +607,152 @@ class UnCompress
|
||||
|
||||
if (!destbufsize)
|
||||
destbufsize = to!uint(buf.length) * 2;
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
-
|
||||
- if (zs.avail_in)
|
||||
- buf = zs.next_in[0 .. zs.avail_in] ~ cast(ubyte[]) buf;
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destbufsize);
|
||||
+ size_t destFill;
|
||||
|
||||
zs.next_in = cast(ubyte*) buf.ptr;
|
||||
zs.avail_in = to!uint(buf.length);
|
||||
|
||||
- err = inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err != Z_STREAM_END && err != Z_OK)
|
||||
+ while (true)
|
||||
{
|
||||
- GC.free(destbuf.ptr);
|
||||
- error(err);
|
||||
+ auto oldAvailIn = zs.avail_in;
|
||||
+
|
||||
+ zs.next_out = destbuf[destFill .. $].ptr;
|
||||
+ zs.avail_out = to!uint(destbuf.length - destFill);
|
||||
+
|
||||
+ err = inflate(&zs, Z_NO_FLUSH);
|
||||
+ if (err == Z_STREAM_END)
|
||||
+ {
|
||||
+ inputEnded = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (err != Z_OK)
|
||||
+ {
|
||||
+ GC.free(destbuf.ptr);
|
||||
+ error(err);
|
||||
+ }
|
||||
+ else if (!zs.avail_in)
|
||||
+ break;
|
||||
+
|
||||
+ /*
|
||||
+ According to the zlib manual inflate() stops when either there's
|
||||
+ no more data to uncompress or the output buffer is full
|
||||
+ So at this point, the output buffer is too full
|
||||
+ */
|
||||
+
|
||||
+ destFill = destbuf.length;
|
||||
+
|
||||
+ if (destbuf.capacity)
|
||||
+ {
|
||||
+ if (destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ {
|
||||
+ auto newLength = GC.extend(destbuf.ptr, destbufsize, destbufsize);
|
||||
+
|
||||
+ if (newLength && destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
}
|
||||
+
|
||||
destbuf.length = destbuf.length - zs.avail_out;
|
||||
return destbuf;
|
||||
}
|
||||
|
||||
+ // Test for issues 3191 and 9505
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ import std.algorithm.comparison;
|
||||
+ import std.array;
|
||||
+ import std.file;
|
||||
+ import std.zlib;
|
||||
+
|
||||
+ // Data that can be easily compressed
|
||||
+ ubyte[1024] originalData;
|
||||
+
|
||||
+ // This should yield a compression ratio of at least 1/2
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+ assert(compressedData.length < originalData.length / 2,
|
||||
+ "The compression ratio is too low to accurately test this situation");
|
||||
+
|
||||
+ auto chunkSize = compressedData.length / 4;
|
||||
+ assert(chunkSize < compressedData.length,
|
||||
+ "The length of the compressed data is too small to accurately test this situation");
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ ubyte[originalData.length] uncompressedData;
|
||||
+ ubyte[] reusedBuf;
|
||||
+ int progress;
|
||||
+
|
||||
+ reusedBuf.length = chunkSize;
|
||||
+
|
||||
+ for (int i = 0; i < compressedData.length; i += chunkSize)
|
||||
+ {
|
||||
+ auto len = min(chunkSize, compressedData.length - i);
|
||||
+ // simulate reading from a stream in small chunks
|
||||
+ reusedBuf[0 .. len] = compressedData[i .. i + len];
|
||||
+
|
||||
+ // decompress using same input buffer
|
||||
+ auto chunk = decompressor.uncompress(reusedBuf);
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+ }
|
||||
+
|
||||
+ auto chunk = decompressor.flush();
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+
|
||||
+ assert(progress == originalData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[1024] invalidData;
|
||||
+ auto decompressor = new UnCompress();
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ auto uncompressedData = decompressor.uncompress(invalidData);
|
||||
+ }
|
||||
+ catch (ZlibException e)
|
||||
+ {
|
||||
+ assert(e.msg == "data error");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ assert(false, "Corrupted data didn't result in an error");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[2014] originalData = void;
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData ~ cast(ubyte[]) "whatever");
|
||||
+
|
||||
+ assert(originalData.length == uncompressedData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(!decompressor.uncompress("whatever").length,
|
||||
+ "Compression continued after the end");
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Decompress and return any remaining data.
|
||||
* The returned data should be appended to that returned by uncompress().
|
||||
@@ -626,48 +761,39 @@ class UnCompress
|
||||
void[] flush()
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed before.");
|
||||
}
|
||||
out
|
||||
{
|
||||
- assert(done);
|
||||
+ assert(done, "Flushing failed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
- import core.memory : GC;
|
||||
- ubyte[] extra;
|
||||
- ubyte[] destbuf;
|
||||
- int err;
|
||||
-
|
||||
done = 1;
|
||||
- if (!inited)
|
||||
- return null;
|
||||
+ return null;
|
||||
+ }
|
||||
|
||||
- L1:
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + 100];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
+ /// Returns true if all input data has been decompressed and no further data
|
||||
+ /// can be decompressed (inflate() returned Z_STREAM_END)
|
||||
+ @property bool empty() const
|
||||
+ {
|
||||
+ return inputEnded;
|
||||
+ }
|
||||
|
||||
- err = etc.c.zlib.inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err == Z_OK && zs.avail_out == 0)
|
||||
- {
|
||||
- extra ~= destbuf;
|
||||
- goto L1;
|
||||
- }
|
||||
- if (err != Z_STREAM_END)
|
||||
- {
|
||||
- GC.free(destbuf.ptr);
|
||||
- if (err == Z_OK)
|
||||
- err = Z_BUF_ERROR;
|
||||
- error(err);
|
||||
- }
|
||||
- destbuf = destbuf.ptr[0 .. zs.next_out - destbuf.ptr];
|
||||
- err = etc.c.zlib.inflateEnd(&zs);
|
||||
- inited = 0;
|
||||
- if (err)
|
||||
- error(err);
|
||||
- if (extra.length)
|
||||
- destbuf = extra ~ destbuf;
|
||||
- return destbuf;
|
||||
+ ///
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ // some random data
|
||||
+ ubyte[1024] originalData = void;
|
||||
+
|
||||
+ // append garbage data (or don't, this works in both cases)
|
||||
+ auto compressedData = cast(ubyte[]) compress(originalData) ~ cast(ubyte[]) "whatever";
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData);
|
||||
+
|
||||
+ assert(uncompressedData[] == originalData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(decompressor.empty, "The UnCompressor reports not being done");
|
||||
}
|
||||
}
|
|
@ -30,11 +30,11 @@ pkgver=9.2.0
|
|||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname="gcc-aarch64"
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="Stage2 cross-compiler for aarch64"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
license="GPL LGPL"
|
||||
license="GPL-2.0-or-later LGPL-2.1-or-later"
|
||||
_gccrel=$pkgver-r$pkgrel
|
||||
depends="isl binutils-aarch64 mpc1"
|
||||
makedepends_build="gcc g++ paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
|
||||
|
@ -43,24 +43,24 @@ subpackages="g++-aarch64:gpp"
|
|||
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
|
||||
replaces="libstdc++ binutils"
|
||||
|
||||
: ${LANG_CXX:=true}
|
||||
: ${LANG_D:=true}
|
||||
: ${LANG_OBJC:=true}
|
||||
: ${LANG_GO:=true}
|
||||
: ${LANG_FORTRAN:=true}
|
||||
: ${LANG_ADA:=true}
|
||||
: "${LANG_CXX:=true}"
|
||||
: "${LANG_D:=true}"
|
||||
: "${LANG_OBJC:=true}"
|
||||
: "${LANG_GO:=true}"
|
||||
: "${LANG_FORTRAN:=true}"
|
||||
: "${LANG_ADA:=true}"
|
||||
|
||||
LIBGOMP="false"
|
||||
LIBGCC="false"
|
||||
LIBATOMIC="false"
|
||||
LIBITM="false"
|
||||
_libgomp=true
|
||||
_libgcc=true
|
||||
_libatomic=true
|
||||
_libitm=true
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
if [ "$BOOTSTRAP" = nolibc ]; then
|
||||
LANG_CXX=false
|
||||
LANG_D=false
|
||||
LANG_ADA=false
|
||||
LIBGCC=false
|
||||
_libgcc=false
|
||||
_builddir="$srcdir/build-cross-pass2"
|
||||
else
|
||||
_builddir="$srcdir/build-cross-final"
|
||||
|
@ -68,9 +68,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
|
|||
LANG_OBJC=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LIBGOMP=false
|
||||
LIBATOMIC=false
|
||||
LIBITM=false
|
||||
_libgomp=false
|
||||
_libatomic=false
|
||||
_libitm=false
|
||||
|
||||
# reset target flags (should be set in crosscreate abuild)
|
||||
# fixup flags. seems gcc treats CPPFLAGS as global without
|
||||
|
@ -121,23 +121,23 @@ fi
|
|||
|
||||
# libitm has TEXTRELs in ARM build, so disable for now
|
||||
case "$CTARGET_ARCH" in
|
||||
arm*) LIBITM=false ;;
|
||||
mips*) LIBITM=false ;;
|
||||
arm*) _libitm=false ;;
|
||||
mips*) _libitm=false ;;
|
||||
esac
|
||||
|
||||
# Fortran uses libquadmath if toolchain has __float128
|
||||
# currently on x86, x86_64 and ia64
|
||||
LIBQUADMATH=$LANG_FORTRAN
|
||||
_libquadmath=$LANG_FORTRAN
|
||||
case "$CTARGET_ARCH" in
|
||||
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
|
||||
*) LIBQUADMATH=false ;;
|
||||
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
|
||||
*) _libquadmath=false ;;
|
||||
esac
|
||||
|
||||
# libatomic is a dependency for openvswitch
|
||||
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $LIBGOMP; then
|
||||
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $_libgomp; then
|
||||
depends="$depends libgomp=$_gccrel"
|
||||
subpackages="$subpackages libgomp::$CTARGET_ARCH"
|
||||
fi
|
||||
|
@ -149,6 +149,7 @@ fi
|
|||
if $LANG_D; then
|
||||
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
|
||||
_languages="$_languages,d"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
|
||||
fi
|
||||
if $LANG_OBJC; then
|
||||
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
|
||||
|
@ -209,14 +210,17 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
|
|||
|
||||
400-dlang-phobos.patch
|
||||
401-dlang-32bits.patch
|
||||
402-dlang-stat.patch
|
||||
403-dlang-ibmz.patch
|
||||
404-dlang-zlib.patch
|
||||
"
|
||||
|
||||
# gcc-4.8-build-args.patch
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
|
||||
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
|
||||
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/$pkgver"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/$pkgver"
|
||||
|
||||
prepare() {
|
||||
cd "$_gccdir"
|
||||
|
@ -288,10 +292,10 @@ build() {
|
|||
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
|
||||
esac
|
||||
|
||||
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
|
||||
msg "Building the following:"
|
||||
echo ""
|
||||
|
@ -316,7 +320,7 @@ build() {
|
|||
--build=${CBUILD} \
|
||||
--host=${CHOST} \
|
||||
--target=${CTARGET} \
|
||||
--with-pkgversion="Alpine ${pkgver}" \
|
||||
--with-pkgversion="Alpine $pkgver" \
|
||||
--enable-checking=release \
|
||||
--disable-fixed-point \
|
||||
--disable-libstdcxx-pch \
|
||||
|
@ -340,36 +344,37 @@ build() {
|
|||
|
||||
package() {
|
||||
cd "$_builddir"
|
||||
make -j1 DESTDIR="${pkgdir}" install
|
||||
make -j1 DESTDIR="$pkgdir" install
|
||||
|
||||
ln -s gcc "$pkgdir"/usr/bin/cc
|
||||
|
||||
# we dont support gcj -static
|
||||
# and saving 35MB is not bad.
|
||||
find "$pkgdir" -name libgtkpeer.a \
|
||||
find "$pkgdir" \( -name libgtkpeer.a \
|
||||
-o -name libgjsmalsa.a \
|
||||
-o -name libgij.a \
|
||||
| xargs rm -f
|
||||
-o -name libgij.a \) \
|
||||
-delete
|
||||
|
||||
# strip debug info from some static libs
|
||||
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f`
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
|
||||
if $LIBGOMP; then
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
if $LIBITM; then
|
||||
if $_libitm; then
|
||||
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
|
||||
# remove ffi
|
||||
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
|
||||
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
|
||||
find "$pkgdir" -name 'ffi*.h' -delete
|
||||
|
||||
local gdblib=${_target:+$CTARGET/}lib
|
||||
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
|
||||
|
@ -392,15 +397,15 @@ package() {
|
|||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# cross-gcc: remove any files that would conflict with the
|
||||
# native gcc package
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
|
||||
# libcc1 does not depend on target, don't ship it
|
||||
rm -rf "$pkgdir"/usr/lib/libcc1.so*
|
||||
|
||||
# fixup gcc library symlinks to be linker scripts so
|
||||
# linker finds the libs from relocated sysroot
|
||||
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
|
||||
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
|
||||
if [ -h "$so" ]; then
|
||||
local _real=$(basename $(readlink "$so"))
|
||||
local _real=$(basename "$(readlink \"$so\")")
|
||||
rm -f "$so"
|
||||
echo "GROUP ($_real)" > "$so"
|
||||
fi
|
||||
|
@ -409,27 +414,27 @@ package() {
|
|||
# add c89/c99 wrapper scripts
|
||||
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c89"
|
||||
_flavor="-std=c89"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-ansi|-std=c89|-std=iso9899:1990) fl="";;
|
||||
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c99"
|
||||
_flavor="-std=c99"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-std=c99|-std=iso9899:1999) fl="";;
|
||||
-std=c99|-std=iso9899:1999) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
chmod 755 "$pkgdir"/usr/bin/c?9
|
||||
fi
|
||||
|
@ -516,13 +521,14 @@ libgphobos() {
|
|||
|
||||
gdc() {
|
||||
pkgdesc="GCC-based D language compiler"
|
||||
depends="gcc=$_gccrel libgphobos=$_gccrel"
|
||||
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
|
||||
"$subpkgdir"/usr/lib \
|
||||
"$subpkgdir"/usr/bin
|
||||
# Copy: The installed `.d` files, the static lib, the binary itself
|
||||
# The shared libs are part of `libgphobos` so one can run program
|
||||
# Copy: The installed '.d' files, the static lib, the binary itself
|
||||
# The shared libs are part of 'libgphobos' so one can run program
|
||||
# without installing the compiler
|
||||
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
|
||||
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
|
||||
|
@ -575,7 +581,7 @@ libquadmath() {
|
|||
gfortran() {
|
||||
pkgdesc="GNU Fortran Compiler"
|
||||
depends="gcc=$_gccrel libgfortran=$_gccrel"
|
||||
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
|
||||
$_libquadmath && depends="$depends libquadmath=$_gccrel"
|
||||
replaces="gcc"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -586,7 +592,7 @@ gfortran() {
|
|||
mv "$pkgdir"/usr/lib/libgfortran.a \
|
||||
"$pkgdir"/usr/lib/libgfortran.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
if $LIBQUADMATH; then
|
||||
if $_libquadmath; then
|
||||
mv "$pkgdir"/usr/lib/libquadmath.a \
|
||||
"$pkgdir"/usr/lib/libquadmath.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
|
@ -606,6 +612,7 @@ libgnat() {
|
|||
gnat() {
|
||||
pkgdesc="Ada support for GCC"
|
||||
depends="gcc=$_gccrel"
|
||||
provides="$pkgname-gnat-bootstrap"
|
||||
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -649,4 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
|
|||
17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7 0016-invalid_tls_model.patch
|
||||
e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa gcc10-pr91920.patch
|
||||
38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df 400-dlang-phobos.patch
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch"
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch
|
||||
9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69 402-dlang-stat.patch
|
||||
fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae 403-dlang-ibmz.patch
|
||||
ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb 404-dlang-zlib.patch"
|
||||
|
|
448
cross/gcc-armhf/402-dlang-stat.patch
Normal file
448
cross/gcc-armhf/402-dlang-stat.patch
Normal file
|
@ -0,0 +1,448 @@
|
|||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -779,7 +779,102 @@ else version (CRuntime_Bionic)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- enum {
|
||||
+ version (X86_64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0,
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ // Note: Definitions for i386 are in arch/generic/bits/fcntl.h
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (ARM)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x020000, // octal 0400000
|
||||
+ O_LARGEFILE = 0x010000, // octal 0200000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert(0, "Platform not supported");
|
||||
+
|
||||
+ enum
|
||||
+ {
|
||||
O_CREAT = 0x40, // octal 0100
|
||||
O_EXCL = 0x80, // octal 0200
|
||||
O_NOCTTY = 0x100, // octal 0400
|
||||
@@ -790,16 +885,11 @@ else version (CRuntime_Musl)
|
||||
O_DSYNC = 0x1000, // octal 010000
|
||||
O_SYNC = 0x101000, // octal 04010000
|
||||
O_RSYNC = O_SYNC,
|
||||
- O_DIRECTORY = 0x10000,
|
||||
- O_NOFOLLOW = 0x20000,
|
||||
O_CLOEXEC = 0x80000,
|
||||
|
||||
O_ASYNC = 0x2000,
|
||||
- O_DIRECT = 0x4000,
|
||||
- O_LARGEFILE = 0,
|
||||
O_NOATIME = 0x40000,
|
||||
O_PATH = 0x200000,
|
||||
- O_TMPFILE = 0x410000,
|
||||
O_NDELAY = O_NONBLOCK,
|
||||
O_SEARCH = O_PATH,
|
||||
O_EXEC = O_PATH,
|
||||
@@ -809,19 +899,19 @@ else version (CRuntime_Musl)
|
||||
O_WRONLY = 01,
|
||||
O_RDWR = 02,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_DUPFD = 0,
|
||||
F_GETFD = 1,
|
||||
F_SETFD = 2,
|
||||
F_GETFL = 3,
|
||||
F_SETFL = 4,
|
||||
- F_GETLK = 5,
|
||||
- F_SETLK = 6,
|
||||
- F_SETLKW = 7,
|
||||
+ // F_GETLK, F_SETLK, F_SETLKW are arch-specific
|
||||
F_SETOWN = 8,
|
||||
F_GETOWN = 9,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_RDLCK = 0,
|
||||
F_WRLCK = 1,
|
||||
F_UNLCK = 2,
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -143,8 +143,10 @@ else version (CRuntime_Bionic)
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
struct sem_t {
|
||||
- int[4*long.sizeof/int.sizeof] __val;
|
||||
+ int[4*c_long.sizeof/int.sizeof] __val;
|
||||
}
|
||||
+
|
||||
+ enum SEM_FAILED = (sem_t*).init;
|
||||
}
|
||||
else version (CRuntime_UClibc)
|
||||
{
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1587,31 +1587,225 @@ else version (CRuntime_Musl)
|
||||
S_ISGID = 0x400, // octal 02000
|
||||
S_ISVTX = 0x200, // octal 01000
|
||||
}
|
||||
- struct stat_t {
|
||||
- dev_t st_dev;
|
||||
- ino_t st_ino;
|
||||
- nlink_t st_nlink;
|
||||
-
|
||||
- mode_t st_mode;
|
||||
- uid_t st_uid;
|
||||
- gid_t st_gid;
|
||||
- uint __pad0;
|
||||
- dev_t st_rdev;
|
||||
- off_t st_size;
|
||||
- blksize_t st_blksize;
|
||||
- blkcnt_t st_blocks;
|
||||
-
|
||||
- timespec st_atim;
|
||||
- timespec st_mtim;
|
||||
- timespec st_ctim;
|
||||
- extern(D) @safe @property inout pure nothrow
|
||||
- {
|
||||
- ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
- ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
- ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ version (ARM)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ c_ulong __pad;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ int __pad2;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ uint[2] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86_64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ mode_t st_mode;
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ uint __pad0;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ c_long[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
}
|
||||
- long[3] __unused;
|
||||
}
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int[3] __pad1;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ uint[2] __pad2;
|
||||
+ off_t st_size;
|
||||
+ int __pad3;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ blksize_t st_blksize;
|
||||
+ uint __pad4;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ int[14] __pad5;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert("Unsupported platform");
|
||||
+
|
||||
private
|
||||
{
|
||||
extern (D) bool S_ISTYPE( mode_t mode, uint mask )
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
@@ -112,8 +112,26 @@ version (CRuntime_Glibc)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- alias c_long blksize_t;
|
||||
- alias c_ulong nlink_t;
|
||||
+ version (AArch64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (RISCV64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias c_ulong nlink_t;
|
||||
+ }
|
||||
alias long dev_t;
|
||||
alias long blkcnt_t;
|
||||
alias ulong ino_t;
|
137
cross/gcc-armhf/403-dlang-ibmz.patch
Normal file
137
cross/gcc-armhf/403-dlang-ibmz.patch
Normal file
|
@ -0,0 +1,137 @@
|
|||
diff -Nurp a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
|
||||
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1084,7 +1084,9 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
|
||||
|
||||
// base offset
|
||||
auto ti = tls_index(mod, 0);
|
||||
- version (IBMZ_Any)
|
||||
+ version (CRuntime_Musl)
|
||||
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
|
||||
+ else version (IBMZ_Any)
|
||||
{
|
||||
auto idx = cast(void *)__tls_get_addr_internal(&ti)
|
||||
+ cast(ulong)__builtin_thread_pointer();
|
||||
diff -Nurp a/libphobos/configure.ac b/libphobos/configure.ac
|
||||
--- a/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -140,6 +140,14 @@ case ${host} in
|
||||
esac
|
||||
AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
|
||||
|
||||
+AC_MSG_CHECKING([if target needs to link in swapcontext])
|
||||
+AC_MSG_RESULT($LIBDRUNTIME_NEEDS_UCONTEXT)
|
||||
+AS_IF([test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes], [
|
||||
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [], [
|
||||
+ AC_MSG_ERROR([[can't find library providing swapcontext]])
|
||||
+ ])
|
||||
+])
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
||||
diff -Nurp a/libphobos/configure.tgt b/libphobos/configure.tgt
|
||||
--- a/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -22,6 +22,13 @@
|
||||
# Disable the libphobos or libdruntime components on untested or known
|
||||
# broken systems. More targets shall be added after testing.
|
||||
LIBPHOBOS_SUPPORTED=no
|
||||
+
|
||||
+# Check if we require 'ucontext' or if we have a custom solution.
|
||||
+# Most platform uses a custom assembly solution for context switches,
|
||||
+# see `core.thread` and grep for `AsmExternal`.
|
||||
+# Definitions are in config/ARCH/
|
||||
+LIBPHOBOS_NEEDS_UCONTEXT=no
|
||||
+
|
||||
case "${target}" in
|
||||
aarch64*-*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
@@ -37,6 +44,7 @@ case "${target}" in
|
||||
;;
|
||||
s390*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
|
||||
;;
|
||||
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
diff -Nurp a/libphobos/configure b/libphobos/configure
|
||||
--- a/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -13955,6 +13955,76 @@ esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
|
||||
$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target needs to link in swapcontext" >&5
|
||||
+$as_echo_n "checking if target needs to link in swapcontext... " >&6; }
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRUNTIME_NEEDS_UCONTEXT" >&5
|
||||
+$as_echo "$LIBDRUNTIME_NEEDS_UCONTEXT" >&6; }
|
||||
+if test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes; then :
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
|
||||
+$as_echo_n "checking for library containing swapcontext... " >&6; }
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char swapcontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return swapcontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' c ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_swapcontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_swapcontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_swapcontext" >&5
|
||||
+$as_echo "$ac_cv_search_swapcontext" >&6; }
|
||||
+ac_res=$ac_cv_search_swapcontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+else
|
||||
+
|
||||
+ as_fn_error $? "can't find library providing swapcontext" "$LINENO" 5
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
411
cross/gcc-armhf/404-dlang-zlib.patch
Normal file
411
cross/gcc-armhf/404-dlang-zlib.patch
Normal file
|
@ -0,0 +1,411 @@
|
|||
diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
|
||||
--- a/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1,7 +1,7 @@
|
||||
// Written in the D programming language.
|
||||
|
||||
/**
|
||||
- * Compress/decompress data using the $(HTTP www._zlib.net, _zlib library).
|
||||
+ * Compress/decompress data using the $(HTTP www.zlib.net, zlib library).
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
@@ -43,12 +43,12 @@
|
||||
* References:
|
||||
* $(HTTP en.wikipedia.org/wiki/Zlib, Wikipedia)
|
||||
*
|
||||
- * Copyright: Copyright Digital Mars 2000 - 2011.
|
||||
+ * Copyright: Copyright The D Language Foundation 2000 - 2011.
|
||||
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
|
||||
* Authors: $(HTTP digitalmars.com, Walter Bright)
|
||||
- * Source: $(PHOBOSSRC std/_zlib.d)
|
||||
+ * Source: $(PHOBOSSRC std/zlib.d)
|
||||
*/
|
||||
-/* Copyright Digital Mars 2000 - 2011.
|
||||
+/* Copyright The D Language Foundation 2000 - 2011.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -75,9 +75,9 @@ enum
|
||||
|
||||
class ZlibException : Exception
|
||||
{
|
||||
- this(int errnum)
|
||||
- { string msg;
|
||||
-
|
||||
+ private static string getmsg(int errnum) nothrow @nogc pure @safe
|
||||
+ {
|
||||
+ string msg;
|
||||
switch (errnum)
|
||||
{
|
||||
case Z_STREAM_END: msg = "stream end"; break;
|
||||
@@ -90,7 +90,12 @@ class ZlibException : Exception
|
||||
case Z_VERSION_ERROR: msg = "version error"; break;
|
||||
default: msg = "unknown error"; break;
|
||||
}
|
||||
- super(msg);
|
||||
+ return msg;
|
||||
+ }
|
||||
+
|
||||
+ this(int errnum)
|
||||
+ {
|
||||
+ super(getmsg(errnum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +109,7 @@ class ZlibException : Exception
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
|
||||
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] b
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
|
||||
@@ -191,13 +196,14 @@ uint crc32(uint crc, const(void)[] buf)
|
||||
ubyte[] compress(const(void)[] srcbuf, int level)
|
||||
in
|
||||
{
|
||||
- assert(-1 <= level && level <= 9);
|
||||
+ assert(-1 <= level && level <= 9, "Compression level needs to be within [-1, 9].");
|
||||
}
|
||||
-body
|
||||
+do
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12;
|
||||
- auto destbuf = new ubyte[destlen];
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destlen);
|
||||
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
|
||||
if (err)
|
||||
{
|
||||
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf,
|
||||
throw new ZlibException(err);
|
||||
}
|
||||
}
|
||||
- assert(0);
|
||||
+ assert(0, "Unreachable code");
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@@ -370,9 +376,9 @@ class Compress
|
||||
this(int level, HeaderFormat header = HeaderFormat.deflate)
|
||||
in
|
||||
{
|
||||
- assert(1 <= level && level <= 9);
|
||||
+ assert(1 <= level && level <= 9, "Legal compression level are in [1, 9].");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
this.level = level;
|
||||
this.gzip = header == HeaderFormat.gzip;
|
||||
@@ -406,6 +412,7 @@ class Compress
|
||||
const(void)[] compress(const(void)[] buf)
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
ubyte[] destbuf;
|
||||
|
||||
@@ -420,7 +427,7 @@ class Compress
|
||||
inited = 1;
|
||||
}
|
||||
|
||||
- destbuf = new ubyte[zs.avail_in + buf.length];
|
||||
+ destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length);
|
||||
zs.next_out = destbuf.ptr;
|
||||
zs.avail_out = to!uint(destbuf.length);
|
||||
|
||||
@@ -461,9 +468,10 @@ class Compress
|
||||
void[] flush(int mode = Z_FINISH)
|
||||
in
|
||||
{
|
||||
- assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH);
|
||||
+ assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH,
|
||||
+ "Mode must be either Z_FINISH, Z_SYNC_FLUSH or Z_FULL_FLUSH.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
import core.memory : GC;
|
||||
ubyte[] destbuf;
|
||||
@@ -523,6 +531,7 @@ class UnCompress
|
||||
z_stream zs;
|
||||
int inited;
|
||||
int done;
|
||||
+ bool inputEnded;
|
||||
size_t destbufsize;
|
||||
|
||||
HeaderFormat format;
|
||||
@@ -571,16 +580,16 @@ class UnCompress
|
||||
const(void)[] uncompress(const(void)[] buf)
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
+ if (inputEnded || !buf.length)
|
||||
+ return null;
|
||||
+
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
- ubyte[] destbuf;
|
||||
-
|
||||
- if (buf.length == 0)
|
||||
- return null;
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
@@ -598,26 +607,152 @@ class UnCompress
|
||||
|
||||
if (!destbufsize)
|
||||
destbufsize = to!uint(buf.length) * 2;
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
-
|
||||
- if (zs.avail_in)
|
||||
- buf = zs.next_in[0 .. zs.avail_in] ~ cast(ubyte[]) buf;
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destbufsize);
|
||||
+ size_t destFill;
|
||||
|
||||
zs.next_in = cast(ubyte*) buf.ptr;
|
||||
zs.avail_in = to!uint(buf.length);
|
||||
|
||||
- err = inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err != Z_STREAM_END && err != Z_OK)
|
||||
+ while (true)
|
||||
{
|
||||
- GC.free(destbuf.ptr);
|
||||
- error(err);
|
||||
+ auto oldAvailIn = zs.avail_in;
|
||||
+
|
||||
+ zs.next_out = destbuf[destFill .. $].ptr;
|
||||
+ zs.avail_out = to!uint(destbuf.length - destFill);
|
||||
+
|
||||
+ err = inflate(&zs, Z_NO_FLUSH);
|
||||
+ if (err == Z_STREAM_END)
|
||||
+ {
|
||||
+ inputEnded = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (err != Z_OK)
|
||||
+ {
|
||||
+ GC.free(destbuf.ptr);
|
||||
+ error(err);
|
||||
+ }
|
||||
+ else if (!zs.avail_in)
|
||||
+ break;
|
||||
+
|
||||
+ /*
|
||||
+ According to the zlib manual inflate() stops when either there's
|
||||
+ no more data to uncompress or the output buffer is full
|
||||
+ So at this point, the output buffer is too full
|
||||
+ */
|
||||
+
|
||||
+ destFill = destbuf.length;
|
||||
+
|
||||
+ if (destbuf.capacity)
|
||||
+ {
|
||||
+ if (destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ {
|
||||
+ auto newLength = GC.extend(destbuf.ptr, destbufsize, destbufsize);
|
||||
+
|
||||
+ if (newLength && destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
}
|
||||
+
|
||||
destbuf.length = destbuf.length - zs.avail_out;
|
||||
return destbuf;
|
||||
}
|
||||
|
||||
+ // Test for issues 3191 and 9505
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ import std.algorithm.comparison;
|
||||
+ import std.array;
|
||||
+ import std.file;
|
||||
+ import std.zlib;
|
||||
+
|
||||
+ // Data that can be easily compressed
|
||||
+ ubyte[1024] originalData;
|
||||
+
|
||||
+ // This should yield a compression ratio of at least 1/2
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+ assert(compressedData.length < originalData.length / 2,
|
||||
+ "The compression ratio is too low to accurately test this situation");
|
||||
+
|
||||
+ auto chunkSize = compressedData.length / 4;
|
||||
+ assert(chunkSize < compressedData.length,
|
||||
+ "The length of the compressed data is too small to accurately test this situation");
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ ubyte[originalData.length] uncompressedData;
|
||||
+ ubyte[] reusedBuf;
|
||||
+ int progress;
|
||||
+
|
||||
+ reusedBuf.length = chunkSize;
|
||||
+
|
||||
+ for (int i = 0; i < compressedData.length; i += chunkSize)
|
||||
+ {
|
||||
+ auto len = min(chunkSize, compressedData.length - i);
|
||||
+ // simulate reading from a stream in small chunks
|
||||
+ reusedBuf[0 .. len] = compressedData[i .. i + len];
|
||||
+
|
||||
+ // decompress using same input buffer
|
||||
+ auto chunk = decompressor.uncompress(reusedBuf);
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+ }
|
||||
+
|
||||
+ auto chunk = decompressor.flush();
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+
|
||||
+ assert(progress == originalData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[1024] invalidData;
|
||||
+ auto decompressor = new UnCompress();
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ auto uncompressedData = decompressor.uncompress(invalidData);
|
||||
+ }
|
||||
+ catch (ZlibException e)
|
||||
+ {
|
||||
+ assert(e.msg == "data error");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ assert(false, "Corrupted data didn't result in an error");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[2014] originalData = void;
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData ~ cast(ubyte[]) "whatever");
|
||||
+
|
||||
+ assert(originalData.length == uncompressedData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(!decompressor.uncompress("whatever").length,
|
||||
+ "Compression continued after the end");
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Decompress and return any remaining data.
|
||||
* The returned data should be appended to that returned by uncompress().
|
||||
@@ -626,48 +761,39 @@ class UnCompress
|
||||
void[] flush()
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed before.");
|
||||
}
|
||||
out
|
||||
{
|
||||
- assert(done);
|
||||
+ assert(done, "Flushing failed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
- import core.memory : GC;
|
||||
- ubyte[] extra;
|
||||
- ubyte[] destbuf;
|
||||
- int err;
|
||||
-
|
||||
done = 1;
|
||||
- if (!inited)
|
||||
- return null;
|
||||
+ return null;
|
||||
+ }
|
||||
|
||||
- L1:
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + 100];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
+ /// Returns true if all input data has been decompressed and no further data
|
||||
+ /// can be decompressed (inflate() returned Z_STREAM_END)
|
||||
+ @property bool empty() const
|
||||
+ {
|
||||
+ return inputEnded;
|
||||
+ }
|
||||
|
||||
- err = etc.c.zlib.inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err == Z_OK && zs.avail_out == 0)
|
||||
- {
|
||||
- extra ~= destbuf;
|
||||
- goto L1;
|
||||
- }
|
||||
- if (err != Z_STREAM_END)
|
||||
- {
|
||||
- GC.free(destbuf.ptr);
|
||||
- if (err == Z_OK)
|
||||
- err = Z_BUF_ERROR;
|
||||
- error(err);
|
||||
- }
|
||||
- destbuf = destbuf.ptr[0 .. zs.next_out - destbuf.ptr];
|
||||
- err = etc.c.zlib.inflateEnd(&zs);
|
||||
- inited = 0;
|
||||
- if (err)
|
||||
- error(err);
|
||||
- if (extra.length)
|
||||
- destbuf = extra ~ destbuf;
|
||||
- return destbuf;
|
||||
+ ///
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ // some random data
|
||||
+ ubyte[1024] originalData = void;
|
||||
+
|
||||
+ // append garbage data (or don't, this works in both cases)
|
||||
+ auto compressedData = cast(ubyte[]) compress(originalData) ~ cast(ubyte[]) "whatever";
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData);
|
||||
+
|
||||
+ assert(uncompressedData[] == originalData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(decompressor.empty, "The UnCompressor reports not being done");
|
||||
}
|
||||
}
|
|
@ -30,11 +30,11 @@ pkgver=9.2.0
|
|||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname="gcc-armhf"
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="Stage2 cross-compiler for armhf"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
license="GPL LGPL"
|
||||
license="GPL-2.0-or-later LGPL-2.1-or-later"
|
||||
_gccrel=$pkgver-r$pkgrel
|
||||
depends="isl binutils-armhf mpc1"
|
||||
makedepends_build="gcc g++ paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
|
||||
|
@ -43,23 +43,24 @@ subpackages="g++-armhf:gpp"
|
|||
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
|
||||
replaces="libstdc++ binutils"
|
||||
|
||||
: ${LANG_CXX:=true}
|
||||
: ${LANG_D:=true}
|
||||
: ${LANG_OBJC:=true}
|
||||
: ${LANG_GO:=true}
|
||||
: ${LANG_FORTRAN:=true}
|
||||
: ${LANG_ADA:=true}
|
||||
: "${LANG_CXX:=true}"
|
||||
: "${LANG_D:=true}"
|
||||
: "${LANG_OBJC:=true}"
|
||||
: "${LANG_GO:=true}"
|
||||
: "${LANG_FORTRAN:=true}"
|
||||
: "${LANG_ADA:=true}"
|
||||
|
||||
LIBGOMP="false"
|
||||
LIBGCC="false"
|
||||
LIBATOMIC="false"
|
||||
LIBITM="false"
|
||||
_libgomp=true
|
||||
_libgcc=true
|
||||
_libatomic=true
|
||||
_libitm=true
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
if [ "$BOOTSTRAP" = nolibc ]; then
|
||||
LANG_CXX=false
|
||||
LANG_D=false
|
||||
LANG_ADA=false
|
||||
LIBGCC=false
|
||||
_libgcc=false
|
||||
_builddir="$srcdir/build-cross-pass2"
|
||||
else
|
||||
_builddir="$srcdir/build-cross-final"
|
||||
|
@ -67,9 +68,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
|
|||
LANG_OBJC=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LIBGOMP=false
|
||||
LIBATOMIC=false
|
||||
LIBITM=false
|
||||
_libgomp=false
|
||||
_libatomic=false
|
||||
_libitm=false
|
||||
|
||||
# reset target flags (should be set in crosscreate abuild)
|
||||
# fixup flags. seems gcc treats CPPFLAGS as global without
|
||||
|
@ -120,23 +121,23 @@ fi
|
|||
|
||||
# libitm has TEXTRELs in ARM build, so disable for now
|
||||
case "$CTARGET_ARCH" in
|
||||
arm*) LIBITM=false ;;
|
||||
mips*) LIBITM=false ;;
|
||||
arm*) _libitm=false ;;
|
||||
mips*) _libitm=false ;;
|
||||
esac
|
||||
|
||||
# Fortran uses libquadmath if toolchain has __float128
|
||||
# currently on x86, x86_64 and ia64
|
||||
LIBQUADMATH=$LANG_FORTRAN
|
||||
_libquadmath=$LANG_FORTRAN
|
||||
case "$CTARGET_ARCH" in
|
||||
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
|
||||
*) LIBQUADMATH=false ;;
|
||||
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
|
||||
*) _libquadmath=false ;;
|
||||
esac
|
||||
|
||||
# libatomic is a dependency for openvswitch
|
||||
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $LIBGOMP; then
|
||||
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $_libgomp; then
|
||||
depends="$depends libgomp=$_gccrel"
|
||||
subpackages="$subpackages libgomp::$CTARGET_ARCH"
|
||||
fi
|
||||
|
@ -148,6 +149,7 @@ fi
|
|||
if $LANG_D; then
|
||||
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
|
||||
_languages="$_languages,d"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
|
||||
fi
|
||||
if $LANG_OBJC; then
|
||||
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
|
||||
|
@ -208,14 +210,17 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
|
|||
|
||||
400-dlang-phobos.patch
|
||||
401-dlang-32bits.patch
|
||||
402-dlang-stat.patch
|
||||
403-dlang-ibmz.patch
|
||||
404-dlang-zlib.patch
|
||||
"
|
||||
|
||||
# gcc-4.8-build-args.patch
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
|
||||
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
|
||||
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/$pkgver"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/$pkgver"
|
||||
|
||||
prepare() {
|
||||
cd "$_gccdir"
|
||||
|
@ -287,10 +292,10 @@ build() {
|
|||
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
|
||||
esac
|
||||
|
||||
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
|
||||
msg "Building the following:"
|
||||
echo ""
|
||||
|
@ -315,7 +320,7 @@ build() {
|
|||
--build=${CBUILD} \
|
||||
--host=${CHOST} \
|
||||
--target=${CTARGET} \
|
||||
--with-pkgversion="Alpine ${pkgver}" \
|
||||
--with-pkgversion="Alpine $pkgver" \
|
||||
--enable-checking=release \
|
||||
--disable-fixed-point \
|
||||
--disable-libstdcxx-pch \
|
||||
|
@ -339,35 +344,37 @@ build() {
|
|||
|
||||
package() {
|
||||
cd "$_builddir"
|
||||
make -j1 DESTDIR="${pkgdir}" install
|
||||
make -j1 DESTDIR="$pkgdir" install
|
||||
|
||||
ln -s gcc "$pkgdir"/usr/bin/cc
|
||||
|
||||
# we dont support gcj -static
|
||||
# and saving 35MB is not bad.
|
||||
find "$pkgdir" -name libgtkpeer.a \
|
||||
find "$pkgdir" \( -name libgtkpeer.a \
|
||||
-o -name libgjsmalsa.a \
|
||||
-o -name libgij.a \
|
||||
| xargs rm -f
|
||||
-o -name libgij.a \) \
|
||||
-delete
|
||||
|
||||
# strip debug info from some static libs
|
||||
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f`
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
|
||||
if $LIBGOMP; then
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
if $LIBITM; then
|
||||
if $_libitm; then
|
||||
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
|
||||
# remove ffi
|
||||
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
|
||||
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
|
||||
find "$pkgdir" -name 'ffi*.h' -delete
|
||||
|
||||
local gdblib=${_target:+$CTARGET/}lib
|
||||
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
|
||||
|
@ -390,15 +397,15 @@ package() {
|
|||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# cross-gcc: remove any files that would conflict with the
|
||||
# native gcc package
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
|
||||
# libcc1 does not depend on target, don't ship it
|
||||
rm -rf "$pkgdir"/usr/lib/libcc1.so*
|
||||
|
||||
# fixup gcc library symlinks to be linker scripts so
|
||||
# linker finds the libs from relocated sysroot
|
||||
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
|
||||
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
|
||||
if [ -h "$so" ]; then
|
||||
local _real=$(basename $(readlink "$so"))
|
||||
local _real=$(basename "$(readlink \"$so\")")
|
||||
rm -f "$so"
|
||||
echo "GROUP ($_real)" > "$so"
|
||||
fi
|
||||
|
@ -407,27 +414,27 @@ package() {
|
|||
# add c89/c99 wrapper scripts
|
||||
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c89"
|
||||
_flavor="-std=c89"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-ansi|-std=c89|-std=iso9899:1990) fl="";;
|
||||
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c99"
|
||||
_flavor="-std=c99"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-std=c99|-std=iso9899:1999) fl="";;
|
||||
-std=c99|-std=iso9899:1999) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
chmod 755 "$pkgdir"/usr/bin/c?9
|
||||
fi
|
||||
|
@ -503,6 +510,33 @@ libgomp() {
|
|||
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgomp.so.* "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
libgphobos() {
|
||||
pkgdesc="D programming language standard library for GCC"
|
||||
depends=
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/libgdruntime.so.* "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/lib/libgphobos.so.* "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gdc() {
|
||||
pkgdesc="GCC-based D language compiler"
|
||||
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
|
||||
"$subpkgdir"/usr/lib \
|
||||
"$subpkgdir"/usr/bin
|
||||
# Copy: The installed '.d' files, the static lib, the binary itself
|
||||
# The shared libs are part of 'libgphobos' so one can run program
|
||||
# without installing the compiler
|
||||
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
|
||||
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
|
||||
}
|
||||
|
||||
|
||||
libgo() {
|
||||
pkgdesc="Go runtime library for GCC"
|
||||
depends=
|
||||
|
@ -547,7 +581,7 @@ libquadmath() {
|
|||
gfortran() {
|
||||
pkgdesc="GNU Fortran Compiler"
|
||||
depends="gcc=$_gccrel libgfortran=$_gccrel"
|
||||
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
|
||||
$_libquadmath && depends="$depends libquadmath=$_gccrel"
|
||||
replaces="gcc"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -558,7 +592,7 @@ gfortran() {
|
|||
mv "$pkgdir"/usr/lib/libgfortran.a \
|
||||
"$pkgdir"/usr/lib/libgfortran.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
if $LIBQUADMATH; then
|
||||
if $_libquadmath; then
|
||||
mv "$pkgdir"/usr/lib/libquadmath.a \
|
||||
"$pkgdir"/usr/lib/libquadmath.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
|
@ -578,6 +612,7 @@ libgnat() {
|
|||
gnat() {
|
||||
pkgdesc="Ada support for GCC"
|
||||
depends="gcc=$_gccrel"
|
||||
provides="$pkgname-gnat-bootstrap"
|
||||
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -621,4 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
|
|||
17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7 0016-invalid_tls_model.patch
|
||||
e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa gcc10-pr91920.patch
|
||||
38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df 400-dlang-phobos.patch
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch"
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch
|
||||
9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69 402-dlang-stat.patch
|
||||
fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae 403-dlang-ibmz.patch
|
||||
ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb 404-dlang-zlib.patch"
|
||||
|
|
448
cross/gcc-armv7/402-dlang-stat.patch
Normal file
448
cross/gcc-armv7/402-dlang-stat.patch
Normal file
|
@ -0,0 +1,448 @@
|
|||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -779,7 +779,102 @@ else version (CRuntime_Bionic)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- enum {
|
||||
+ version (X86_64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0,
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ // Note: Definitions for i386 are in arch/generic/bits/fcntl.h
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (ARM)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 12,
|
||||
+ F_SETLK = 13,
|
||||
+ F_SETLKW = 14,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x010000, // octal 0200000
|
||||
+ O_LARGEFILE = 0x020000, // octal 0400000
|
||||
+ O_TMPFILE = 0x404000, // octal 020040000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x010000, // octal 0200000
|
||||
+ O_NOFOLLOW = 0x020000, // octal 0400000
|
||||
+ O_DIRECT = 0x004000, // octal 040000
|
||||
+ O_LARGEFILE = 0x008000, // octal 0100000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ enum
|
||||
+ {
|
||||
+ O_DIRECTORY = 0x004000, // octal 040000
|
||||
+ O_NOFOLLOW = 0x008000, // octal 0100000
|
||||
+ O_DIRECT = 0x020000, // octal 0400000
|
||||
+ O_LARGEFILE = 0x010000, // octal 0200000
|
||||
+ O_TMPFILE = 0x410000, // octal 020200000
|
||||
+
|
||||
+ F_GETLK = 5,
|
||||
+ F_SETLK = 6,
|
||||
+ F_SETLKW = 7,
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert(0, "Platform not supported");
|
||||
+
|
||||
+ enum
|
||||
+ {
|
||||
O_CREAT = 0x40, // octal 0100
|
||||
O_EXCL = 0x80, // octal 0200
|
||||
O_NOCTTY = 0x100, // octal 0400
|
||||
@@ -790,16 +885,11 @@ else version (CRuntime_Musl)
|
||||
O_DSYNC = 0x1000, // octal 010000
|
||||
O_SYNC = 0x101000, // octal 04010000
|
||||
O_RSYNC = O_SYNC,
|
||||
- O_DIRECTORY = 0x10000,
|
||||
- O_NOFOLLOW = 0x20000,
|
||||
O_CLOEXEC = 0x80000,
|
||||
|
||||
O_ASYNC = 0x2000,
|
||||
- O_DIRECT = 0x4000,
|
||||
- O_LARGEFILE = 0,
|
||||
O_NOATIME = 0x40000,
|
||||
O_PATH = 0x200000,
|
||||
- O_TMPFILE = 0x410000,
|
||||
O_NDELAY = O_NONBLOCK,
|
||||
O_SEARCH = O_PATH,
|
||||
O_EXEC = O_PATH,
|
||||
@@ -809,19 +899,19 @@ else version (CRuntime_Musl)
|
||||
O_WRONLY = 01,
|
||||
O_RDWR = 02,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_DUPFD = 0,
|
||||
F_GETFD = 1,
|
||||
F_SETFD = 2,
|
||||
F_GETFL = 3,
|
||||
F_SETFL = 4,
|
||||
- F_GETLK = 5,
|
||||
- F_SETLK = 6,
|
||||
- F_SETLKW = 7,
|
||||
+ // F_GETLK, F_SETLK, F_SETLKW are arch-specific
|
||||
F_SETOWN = 8,
|
||||
F_GETOWN = 9,
|
||||
}
|
||||
- enum {
|
||||
+ enum
|
||||
+ {
|
||||
F_RDLCK = 0,
|
||||
F_WRLCK = 1,
|
||||
F_UNLCK = 2,
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -143,8 +143,10 @@ else version (CRuntime_Bionic)
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
struct sem_t {
|
||||
- int[4*long.sizeof/int.sizeof] __val;
|
||||
+ int[4*c_long.sizeof/int.sizeof] __val;
|
||||
}
|
||||
+
|
||||
+ enum SEM_FAILED = (sem_t*).init;
|
||||
}
|
||||
else version (CRuntime_UClibc)
|
||||
{
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1587,31 +1587,225 @@ else version (CRuntime_Musl)
|
||||
S_ISGID = 0x400, // octal 02000
|
||||
S_ISVTX = 0x200, // octal 01000
|
||||
}
|
||||
- struct stat_t {
|
||||
- dev_t st_dev;
|
||||
- ino_t st_ino;
|
||||
- nlink_t st_nlink;
|
||||
-
|
||||
- mode_t st_mode;
|
||||
- uid_t st_uid;
|
||||
- gid_t st_gid;
|
||||
- uint __pad0;
|
||||
- dev_t st_rdev;
|
||||
- off_t st_size;
|
||||
- blksize_t st_blksize;
|
||||
- blkcnt_t st_blocks;
|
||||
-
|
||||
- timespec st_atim;
|
||||
- timespec st_mtim;
|
||||
- timespec st_ctim;
|
||||
- extern(D) @safe @property inout pure nothrow
|
||||
- {
|
||||
- ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
- ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
- ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ version (ARM)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (AArch64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ c_ulong __pad;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ int __pad2;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ uint[2] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86_64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ mode_t st_mode;
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ uint __pad0;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ c_long[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (X86)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int __st_dev_padding;
|
||||
+ c_long __st_ino_truncated;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ int __st_rdev_padding;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ ino_t st_ino;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
}
|
||||
- long[3] __unused;
|
||||
}
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ int[3] __pad1;
|
||||
+ ino_t st_ino;
|
||||
+ mode_t st_mode;
|
||||
+ nlink_t st_nlink;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ uint[2] __pad2;
|
||||
+ off_t st_size;
|
||||
+ int __pad3;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ blksize_t st_blksize;
|
||||
+ uint __pad4;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ int[14] __pad5;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (PPC64)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else version (SystemZ)
|
||||
+ {
|
||||
+ struct stat_t
|
||||
+ {
|
||||
+ dev_t st_dev;
|
||||
+ ino_t st_ino;
|
||||
+ nlink_t st_nlink;
|
||||
+ mode_t st_mode;
|
||||
+
|
||||
+ uid_t st_uid;
|
||||
+ gid_t st_gid;
|
||||
+ dev_t st_rdev;
|
||||
+ off_t st_size;
|
||||
+
|
||||
+ timespec st_atim;
|
||||
+ timespec st_mtim;
|
||||
+ timespec st_ctim;
|
||||
+
|
||||
+ blksize_t st_blksize;
|
||||
+ blkcnt_t st_blocks;
|
||||
+ c_ulong[3] __unused;
|
||||
+
|
||||
+ extern(D) @safe @property inout pure nothrow
|
||||
+ {
|
||||
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
|
||||
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
|
||||
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ static assert("Unsupported platform");
|
||||
+
|
||||
private
|
||||
{
|
||||
extern (D) bool S_ISTYPE( mode_t mode, uint mask )
|
||||
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
|
||||
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
|
||||
@@ -112,8 +112,26 @@ version (CRuntime_Glibc)
|
||||
}
|
||||
else version (CRuntime_Musl)
|
||||
{
|
||||
- alias c_long blksize_t;
|
||||
- alias c_ulong nlink_t;
|
||||
+ version (AArch64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (MIPS64)
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else version (RISCV64)
|
||||
+ {
|
||||
+ alias int blksize_t;
|
||||
+ alias uint nlink_t;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ alias c_long blksize_t;
|
||||
+ alias c_ulong nlink_t;
|
||||
+ }
|
||||
alias long dev_t;
|
||||
alias long blkcnt_t;
|
||||
alias ulong ino_t;
|
137
cross/gcc-armv7/403-dlang-ibmz.patch
Normal file
137
cross/gcc-armv7/403-dlang-ibmz.patch
Normal file
|
@ -0,0 +1,137 @@
|
|||
diff -Nurp a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
|
||||
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1084,7 +1084,9 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
|
||||
|
||||
// base offset
|
||||
auto ti = tls_index(mod, 0);
|
||||
- version (IBMZ_Any)
|
||||
+ version (CRuntime_Musl)
|
||||
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
|
||||
+ else version (IBMZ_Any)
|
||||
{
|
||||
auto idx = cast(void *)__tls_get_addr_internal(&ti)
|
||||
+ cast(ulong)__builtin_thread_pointer();
|
||||
diff -Nurp a/libphobos/configure.ac b/libphobos/configure.ac
|
||||
--- a/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -140,6 +140,14 @@ case ${host} in
|
||||
esac
|
||||
AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
|
||||
|
||||
+AC_MSG_CHECKING([if target needs to link in swapcontext])
|
||||
+AC_MSG_RESULT($LIBDRUNTIME_NEEDS_UCONTEXT)
|
||||
+AS_IF([test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes], [
|
||||
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [], [
|
||||
+ AC_MSG_ERROR([[can't find library providing swapcontext]])
|
||||
+ ])
|
||||
+])
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
||||
diff -Nurp a/libphobos/configure.tgt b/libphobos/configure.tgt
|
||||
--- a/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -22,6 +22,13 @@
|
||||
# Disable the libphobos or libdruntime components on untested or known
|
||||
# broken systems. More targets shall be added after testing.
|
||||
LIBPHOBOS_SUPPORTED=no
|
||||
+
|
||||
+# Check if we require 'ucontext' or if we have a custom solution.
|
||||
+# Most platform uses a custom assembly solution for context switches,
|
||||
+# see `core.thread` and grep for `AsmExternal`.
|
||||
+# Definitions are in config/ARCH/
|
||||
+LIBPHOBOS_NEEDS_UCONTEXT=no
|
||||
+
|
||||
case "${target}" in
|
||||
aarch64*-*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
@@ -37,6 +44,7 @@ case "${target}" in
|
||||
;;
|
||||
s390*-linux*)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
|
||||
;;
|
||||
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
|
||||
LIBPHOBOS_SUPPORTED=yes
|
||||
diff -Nurp a/libphobos/configure b/libphobos/configure
|
||||
--- a/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -13955,6 +13955,76 @@ esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
|
||||
$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
|
||||
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target needs to link in swapcontext" >&5
|
||||
+$as_echo_n "checking if target needs to link in swapcontext... " >&6; }
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRUNTIME_NEEDS_UCONTEXT" >&5
|
||||
+$as_echo "$LIBDRUNTIME_NEEDS_UCONTEXT" >&6; }
|
||||
+if test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes; then :
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
|
||||
+$as_echo_n "checking for library containing swapcontext... " >&6; }
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ ac_func_search_save_LIBS=$LIBS
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+/* Override any GCC internal prototype to avoid an error.
|
||||
+ Use char because int might match the return type of a GCC
|
||||
+ builtin and then its argument prototype would still apply. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+#endif
|
||||
+char swapcontext ();
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+return swapcontext ();
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+for ac_lib in '' c ucontext; do
|
||||
+ if test -z "$ac_lib"; then
|
||||
+ ac_res="none required"
|
||||
+ else
|
||||
+ ac_res=-l$ac_lib
|
||||
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
+ fi
|
||||
+ if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ ac_cv_search_swapcontext=$ac_res
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext
|
||||
+ if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+ break
|
||||
+fi
|
||||
+done
|
||||
+if ${ac_cv_search_swapcontext+:} false; then :
|
||||
+
|
||||
+else
|
||||
+ ac_cv_search_swapcontext=no
|
||||
+fi
|
||||
+rm conftest.$ac_ext
|
||||
+LIBS=$ac_func_search_save_LIBS
|
||||
+fi
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_swapcontext" >&5
|
||||
+$as_echo "$ac_cv_search_swapcontext" >&6; }
|
||||
+ac_res=$ac_cv_search_swapcontext
|
||||
+if test "$ac_res" != no; then :
|
||||
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
+
|
||||
+else
|
||||
+
|
||||
+ as_fn_error $? "can't find library providing swapcontext" "$LINENO" 5
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# Decide if it's usable.
|
||||
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
|
||||
*:no) use_libphobos=no ;;
|
411
cross/gcc-armv7/404-dlang-zlib.patch
Normal file
411
cross/gcc-armv7/404-dlang-zlib.patch
Normal file
|
@ -0,0 +1,411 @@
|
|||
diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
|
||||
--- a/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
+++ b/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
|
||||
@@ -1,7 +1,7 @@
|
||||
// Written in the D programming language.
|
||||
|
||||
/**
|
||||
- * Compress/decompress data using the $(HTTP www._zlib.net, _zlib library).
|
||||
+ * Compress/decompress data using the $(HTTP www.zlib.net, zlib library).
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
@@ -43,12 +43,12 @@
|
||||
* References:
|
||||
* $(HTTP en.wikipedia.org/wiki/Zlib, Wikipedia)
|
||||
*
|
||||
- * Copyright: Copyright Digital Mars 2000 - 2011.
|
||||
+ * Copyright: Copyright The D Language Foundation 2000 - 2011.
|
||||
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
|
||||
* Authors: $(HTTP digitalmars.com, Walter Bright)
|
||||
- * Source: $(PHOBOSSRC std/_zlib.d)
|
||||
+ * Source: $(PHOBOSSRC std/zlib.d)
|
||||
*/
|
||||
-/* Copyright Digital Mars 2000 - 2011.
|
||||
+/* Copyright The D Language Foundation 2000 - 2011.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -75,9 +75,9 @@ enum
|
||||
|
||||
class ZlibException : Exception
|
||||
{
|
||||
- this(int errnum)
|
||||
- { string msg;
|
||||
-
|
||||
+ private static string getmsg(int errnum) nothrow @nogc pure @safe
|
||||
+ {
|
||||
+ string msg;
|
||||
switch (errnum)
|
||||
{
|
||||
case Z_STREAM_END: msg = "stream end"; break;
|
||||
@@ -90,7 +90,12 @@ class ZlibException : Exception
|
||||
case Z_VERSION_ERROR: msg = "version error"; break;
|
||||
default: msg = "unknown error"; break;
|
||||
}
|
||||
- super(msg);
|
||||
+ return msg;
|
||||
+ }
|
||||
+
|
||||
+ this(int errnum)
|
||||
+ {
|
||||
+ super(getmsg(errnum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +109,7 @@ class ZlibException : Exception
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
|
||||
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] b
|
||||
* buf = buffer containing input data
|
||||
*
|
||||
* Returns:
|
||||
- * A $(D uint) checksum for the provided input data and starting checksum
|
||||
+ * A `uint` checksum for the provided input data and starting checksum
|
||||
*
|
||||
* See_Also:
|
||||
* $(LINK http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
|
||||
@@ -191,13 +196,14 @@ uint crc32(uint crc, const(void)[] buf)
|
||||
ubyte[] compress(const(void)[] srcbuf, int level)
|
||||
in
|
||||
{
|
||||
- assert(-1 <= level && level <= 9);
|
||||
+ assert(-1 <= level && level <= 9, "Compression level needs to be within [-1, 9].");
|
||||
}
|
||||
-body
|
||||
+do
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12;
|
||||
- auto destbuf = new ubyte[destlen];
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destlen);
|
||||
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
|
||||
if (err)
|
||||
{
|
||||
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf,
|
||||
throw new ZlibException(err);
|
||||
}
|
||||
}
|
||||
- assert(0);
|
||||
+ assert(0, "Unreachable code");
|
||||
}
|
||||
|
||||
@system unittest
|
||||
@@ -370,9 +376,9 @@ class Compress
|
||||
this(int level, HeaderFormat header = HeaderFormat.deflate)
|
||||
in
|
||||
{
|
||||
- assert(1 <= level && level <= 9);
|
||||
+ assert(1 <= level && level <= 9, "Legal compression level are in [1, 9].");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
this.level = level;
|
||||
this.gzip = header == HeaderFormat.gzip;
|
||||
@@ -406,6 +412,7 @@ class Compress
|
||||
const(void)[] compress(const(void)[] buf)
|
||||
{
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
ubyte[] destbuf;
|
||||
|
||||
@@ -420,7 +427,7 @@ class Compress
|
||||
inited = 1;
|
||||
}
|
||||
|
||||
- destbuf = new ubyte[zs.avail_in + buf.length];
|
||||
+ destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length);
|
||||
zs.next_out = destbuf.ptr;
|
||||
zs.avail_out = to!uint(destbuf.length);
|
||||
|
||||
@@ -461,9 +468,10 @@ class Compress
|
||||
void[] flush(int mode = Z_FINISH)
|
||||
in
|
||||
{
|
||||
- assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH);
|
||||
+ assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH,
|
||||
+ "Mode must be either Z_FINISH, Z_SYNC_FLUSH or Z_FULL_FLUSH.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
import core.memory : GC;
|
||||
ubyte[] destbuf;
|
||||
@@ -523,6 +531,7 @@ class UnCompress
|
||||
z_stream zs;
|
||||
int inited;
|
||||
int done;
|
||||
+ bool inputEnded;
|
||||
size_t destbufsize;
|
||||
|
||||
HeaderFormat format;
|
||||
@@ -571,16 +580,16 @@ class UnCompress
|
||||
const(void)[] uncompress(const(void)[] buf)
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
+ if (inputEnded || !buf.length)
|
||||
+ return null;
|
||||
+
|
||||
import core.memory : GC;
|
||||
+ import std.array : uninitializedArray;
|
||||
int err;
|
||||
- ubyte[] destbuf;
|
||||
-
|
||||
- if (buf.length == 0)
|
||||
- return null;
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
@@ -598,26 +607,152 @@ class UnCompress
|
||||
|
||||
if (!destbufsize)
|
||||
destbufsize = to!uint(buf.length) * 2;
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
-
|
||||
- if (zs.avail_in)
|
||||
- buf = zs.next_in[0 .. zs.avail_in] ~ cast(ubyte[]) buf;
|
||||
+ auto destbuf = uninitializedArray!(ubyte[])(destbufsize);
|
||||
+ size_t destFill;
|
||||
|
||||
zs.next_in = cast(ubyte*) buf.ptr;
|
||||
zs.avail_in = to!uint(buf.length);
|
||||
|
||||
- err = inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err != Z_STREAM_END && err != Z_OK)
|
||||
+ while (true)
|
||||
{
|
||||
- GC.free(destbuf.ptr);
|
||||
- error(err);
|
||||
+ auto oldAvailIn = zs.avail_in;
|
||||
+
|
||||
+ zs.next_out = destbuf[destFill .. $].ptr;
|
||||
+ zs.avail_out = to!uint(destbuf.length - destFill);
|
||||
+
|
||||
+ err = inflate(&zs, Z_NO_FLUSH);
|
||||
+ if (err == Z_STREAM_END)
|
||||
+ {
|
||||
+ inputEnded = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (err != Z_OK)
|
||||
+ {
|
||||
+ GC.free(destbuf.ptr);
|
||||
+ error(err);
|
||||
+ }
|
||||
+ else if (!zs.avail_in)
|
||||
+ break;
|
||||
+
|
||||
+ /*
|
||||
+ According to the zlib manual inflate() stops when either there's
|
||||
+ no more data to uncompress or the output buffer is full
|
||||
+ So at this point, the output buffer is too full
|
||||
+ */
|
||||
+
|
||||
+ destFill = destbuf.length;
|
||||
+
|
||||
+ if (destbuf.capacity)
|
||||
+ {
|
||||
+ if (destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ {
|
||||
+ auto newLength = GC.extend(destbuf.ptr, destbufsize, destbufsize);
|
||||
+
|
||||
+ if (newLength && destbuf.length < destbuf.capacity)
|
||||
+ destbuf.length = destbuf.capacity;
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ destbuf.length += destbufsize;
|
||||
}
|
||||
+
|
||||
destbuf.length = destbuf.length - zs.avail_out;
|
||||
return destbuf;
|
||||
}
|
||||
|
||||
+ // Test for issues 3191 and 9505
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ import std.algorithm.comparison;
|
||||
+ import std.array;
|
||||
+ import std.file;
|
||||
+ import std.zlib;
|
||||
+
|
||||
+ // Data that can be easily compressed
|
||||
+ ubyte[1024] originalData;
|
||||
+
|
||||
+ // This should yield a compression ratio of at least 1/2
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+ assert(compressedData.length < originalData.length / 2,
|
||||
+ "The compression ratio is too low to accurately test this situation");
|
||||
+
|
||||
+ auto chunkSize = compressedData.length / 4;
|
||||
+ assert(chunkSize < compressedData.length,
|
||||
+ "The length of the compressed data is too small to accurately test this situation");
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ ubyte[originalData.length] uncompressedData;
|
||||
+ ubyte[] reusedBuf;
|
||||
+ int progress;
|
||||
+
|
||||
+ reusedBuf.length = chunkSize;
|
||||
+
|
||||
+ for (int i = 0; i < compressedData.length; i += chunkSize)
|
||||
+ {
|
||||
+ auto len = min(chunkSize, compressedData.length - i);
|
||||
+ // simulate reading from a stream in small chunks
|
||||
+ reusedBuf[0 .. len] = compressedData[i .. i + len];
|
||||
+
|
||||
+ // decompress using same input buffer
|
||||
+ auto chunk = decompressor.uncompress(reusedBuf);
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+ }
|
||||
+
|
||||
+ auto chunk = decompressor.flush();
|
||||
+ assert(progress + chunk.length <= originalData.length,
|
||||
+ "The uncompressed result is bigger than the original data");
|
||||
+
|
||||
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
|
||||
+ progress += chunk.length;
|
||||
+
|
||||
+ assert(progress == originalData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[1024] invalidData;
|
||||
+ auto decompressor = new UnCompress();
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ auto uncompressedData = decompressor.uncompress(invalidData);
|
||||
+ }
|
||||
+ catch (ZlibException e)
|
||||
+ {
|
||||
+ assert(e.msg == "data error");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ assert(false, "Corrupted data didn't result in an error");
|
||||
+ }
|
||||
+
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ ubyte[2014] originalData = void;
|
||||
+ auto compressedData = compress(originalData, 9);
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData ~ cast(ubyte[]) "whatever");
|
||||
+
|
||||
+ assert(originalData.length == uncompressedData.length,
|
||||
+ "The uncompressed and the original data sizes differ");
|
||||
+ assert(originalData[] == uncompressedData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(!decompressor.uncompress("whatever").length,
|
||||
+ "Compression continued after the end");
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Decompress and return any remaining data.
|
||||
* The returned data should be appended to that returned by uncompress().
|
||||
@@ -626,48 +761,39 @@ class UnCompress
|
||||
void[] flush()
|
||||
in
|
||||
{
|
||||
- assert(!done);
|
||||
+ assert(!done, "Buffer has been flushed before.");
|
||||
}
|
||||
out
|
||||
{
|
||||
- assert(done);
|
||||
+ assert(done, "Flushing failed.");
|
||||
}
|
||||
- body
|
||||
+ do
|
||||
{
|
||||
- import core.memory : GC;
|
||||
- ubyte[] extra;
|
||||
- ubyte[] destbuf;
|
||||
- int err;
|
||||
-
|
||||
done = 1;
|
||||
- if (!inited)
|
||||
- return null;
|
||||
+ return null;
|
||||
+ }
|
||||
|
||||
- L1:
|
||||
- destbuf = new ubyte[zs.avail_in * 2 + 100];
|
||||
- zs.next_out = destbuf.ptr;
|
||||
- zs.avail_out = to!uint(destbuf.length);
|
||||
+ /// Returns true if all input data has been decompressed and no further data
|
||||
+ /// can be decompressed (inflate() returned Z_STREAM_END)
|
||||
+ @property bool empty() const
|
||||
+ {
|
||||
+ return inputEnded;
|
||||
+ }
|
||||
|
||||
- err = etc.c.zlib.inflate(&zs, Z_NO_FLUSH);
|
||||
- if (err == Z_OK && zs.avail_out == 0)
|
||||
- {
|
||||
- extra ~= destbuf;
|
||||
- goto L1;
|
||||
- }
|
||||
- if (err != Z_STREAM_END)
|
||||
- {
|
||||
- GC.free(destbuf.ptr);
|
||||
- if (err == Z_OK)
|
||||
- err = Z_BUF_ERROR;
|
||||
- error(err);
|
||||
- }
|
||||
- destbuf = destbuf.ptr[0 .. zs.next_out - destbuf.ptr];
|
||||
- err = etc.c.zlib.inflateEnd(&zs);
|
||||
- inited = 0;
|
||||
- if (err)
|
||||
- error(err);
|
||||
- if (extra.length)
|
||||
- destbuf = extra ~ destbuf;
|
||||
- return destbuf;
|
||||
+ ///
|
||||
+ @system unittest
|
||||
+ {
|
||||
+ // some random data
|
||||
+ ubyte[1024] originalData = void;
|
||||
+
|
||||
+ // append garbage data (or don't, this works in both cases)
|
||||
+ auto compressedData = cast(ubyte[]) compress(originalData) ~ cast(ubyte[]) "whatever";
|
||||
+
|
||||
+ auto decompressor = new UnCompress();
|
||||
+ auto uncompressedData = decompressor.uncompress(compressedData);
|
||||
+
|
||||
+ assert(uncompressedData[] == originalData[],
|
||||
+ "The uncompressed and the original data differ");
|
||||
+ assert(decompressor.empty, "The UnCompressor reports not being done");
|
||||
}
|
||||
}
|
|
@ -30,11 +30,11 @@ pkgver=9.2.0
|
|||
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
|
||||
|
||||
pkgname="gcc-armv7"
|
||||
pkgrel=4
|
||||
pkgrel=5
|
||||
pkgdesc="Stage2 cross-compiler for armv7"
|
||||
url="https://gcc.gnu.org"
|
||||
arch="x86_64"
|
||||
license="GPL LGPL"
|
||||
license="GPL-2.0-or-later LGPL-2.1-or-later"
|
||||
_gccrel=$pkgver-r$pkgrel
|
||||
depends="isl binutils-armv7 mpc1"
|
||||
makedepends_build="gcc g++ paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
|
||||
|
@ -43,24 +43,24 @@ subpackages="g++-armv7:gpp"
|
|||
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
|
||||
replaces="libstdc++ binutils"
|
||||
|
||||
: ${LANG_CXX:=true}
|
||||
: ${LANG_D:=true}
|
||||
: ${LANG_OBJC:=true}
|
||||
: ${LANG_GO:=true}
|
||||
: ${LANG_FORTRAN:=true}
|
||||
: ${LANG_ADA:=true}
|
||||
: "${LANG_CXX:=true}"
|
||||
: "${LANG_D:=true}"
|
||||
: "${LANG_OBJC:=true}"
|
||||
: "${LANG_GO:=true}"
|
||||
: "${LANG_FORTRAN:=true}"
|
||||
: "${LANG_ADA:=true}"
|
||||
|
||||
LIBGOMP="false"
|
||||
LIBGCC="false"
|
||||
LIBATOMIC="false"
|
||||
LIBITM="false"
|
||||
_libgomp=true
|
||||
_libgcc=true
|
||||
_libatomic=true
|
||||
_libitm=true
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
if [ "$BOOTSTRAP" = nolibc ]; then
|
||||
LANG_CXX=false
|
||||
LANG_D=false
|
||||
LANG_ADA=false
|
||||
LIBGCC=false
|
||||
_libgcc=false
|
||||
_builddir="$srcdir/build-cross-pass2"
|
||||
else
|
||||
_builddir="$srcdir/build-cross-final"
|
||||
|
@ -68,9 +68,9 @@ if [ "$CHOST" != "$CTARGET" ]; then
|
|||
LANG_OBJC=false
|
||||
LANG_GO=false
|
||||
LANG_FORTRAN=false
|
||||
LIBGOMP=false
|
||||
LIBATOMIC=false
|
||||
LIBITM=false
|
||||
_libgomp=false
|
||||
_libatomic=false
|
||||
_libitm=false
|
||||
|
||||
# reset target flags (should be set in crosscreate abuild)
|
||||
# fixup flags. seems gcc treats CPPFLAGS as global without
|
||||
|
@ -121,23 +121,23 @@ fi
|
|||
|
||||
# libitm has TEXTRELs in ARM build, so disable for now
|
||||
case "$CTARGET_ARCH" in
|
||||
arm*) LIBITM=false ;;
|
||||
mips*) LIBITM=false ;;
|
||||
arm*) _libitm=false ;;
|
||||
mips*) _libitm=false ;;
|
||||
esac
|
||||
|
||||
# Fortran uses libquadmath if toolchain has __float128
|
||||
# currently on x86, x86_64 and ia64
|
||||
LIBQUADMATH=$LANG_FORTRAN
|
||||
_libquadmath=$LANG_FORTRAN
|
||||
case "$CTARGET_ARCH" in
|
||||
x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
|
||||
*) LIBQUADMATH=false ;;
|
||||
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
|
||||
*) _libquadmath=false ;;
|
||||
esac
|
||||
|
||||
# libatomic is a dependency for openvswitch
|
||||
$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $LIBGOMP; then
|
||||
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
|
||||
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
|
||||
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
|
||||
if $_libgomp; then
|
||||
depends="$depends libgomp=$_gccrel"
|
||||
subpackages="$subpackages libgomp::$CTARGET_ARCH"
|
||||
fi
|
||||
|
@ -149,6 +149,7 @@ fi
|
|||
if $LANG_D; then
|
||||
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
|
||||
_languages="$_languages,d"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
|
||||
fi
|
||||
if $LANG_OBJC; then
|
||||
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
|
||||
|
@ -209,14 +210,17 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
|
|||
|
||||
400-dlang-phobos.patch
|
||||
401-dlang-32bits.patch
|
||||
402-dlang-stat.patch
|
||||
403-dlang-ibmz.patch
|
||||
404-dlang-zlib.patch
|
||||
"
|
||||
|
||||
# gcc-4.8-build-args.patch
|
||||
|
||||
# we build out-of-tree
|
||||
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
|
||||
_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
|
||||
_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
|
||||
_gcclibdir="/usr/lib/gcc/$CTARGET/$pkgver"
|
||||
_gcclibexec="/usr/libexec/gcc/$CTARGET/$pkgver"
|
||||
|
||||
prepare() {
|
||||
cd "$_gccdir"
|
||||
|
@ -288,10 +292,10 @@ build() {
|
|||
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
|
||||
esac
|
||||
|
||||
$LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
|
||||
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
|
||||
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
|
||||
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
|
||||
|
||||
msg "Building the following:"
|
||||
echo ""
|
||||
|
@ -316,7 +320,7 @@ build() {
|
|||
--build=${CBUILD} \
|
||||
--host=${CHOST} \
|
||||
--target=${CTARGET} \
|
||||
--with-pkgversion="Alpine ${pkgver}" \
|
||||
--with-pkgversion="Alpine $pkgver" \
|
||||
--enable-checking=release \
|
||||
--disable-fixed-point \
|
||||
--disable-libstdcxx-pch \
|
||||
|
@ -340,35 +344,37 @@ build() {
|
|||
|
||||
package() {
|
||||
cd "$_builddir"
|
||||
make -j1 DESTDIR="${pkgdir}" install
|
||||
make -j1 DESTDIR="$pkgdir" install
|
||||
|
||||
ln -s gcc "$pkgdir"/usr/bin/cc
|
||||
|
||||
# we dont support gcj -static
|
||||
# and saving 35MB is not bad.
|
||||
find "$pkgdir" -name libgtkpeer.a \
|
||||
find "$pkgdir" \( -name libgtkpeer.a \
|
||||
-o -name libgjsmalsa.a \
|
||||
-o -name libgij.a \
|
||||
| xargs rm -f
|
||||
-o -name libgij.a \) \
|
||||
-delete
|
||||
|
||||
# strip debug info from some static libs
|
||||
${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
|
||||
-o -name libgphobos.a -o -name libgdruntime.a \
|
||||
-o -name libmudflap.a -o -name libmudflapth.a \
|
||||
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
|
||||
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
|
||||
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
|
||||
-a -type f`
|
||||
-a -type f \
|
||||
-exec ${STRIP_FOR_TARGET} -g {} +
|
||||
|
||||
if $LIBGOMP; then
|
||||
if $_libgomp; then
|
||||
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
if $LIBITM; then
|
||||
if $_libitm; then
|
||||
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
|
||||
fi
|
||||
|
||||
# remove ffi
|
||||
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
|
||||
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
|
||||
find "$pkgdir" -name 'ffi*.h' -delete
|
||||
|
||||
local gdblib=${_target:+$CTARGET/}lib
|
||||
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
|
||||
|
@ -391,15 +397,15 @@ package() {
|
|||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# cross-gcc: remove any files that would conflict with the
|
||||
# native gcc package
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
|
||||
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
|
||||
# libcc1 does not depend on target, don't ship it
|
||||
rm -rf "$pkgdir"/usr/lib/libcc1.so*
|
||||
|
||||
# fixup gcc library symlinks to be linker scripts so
|
||||
# linker finds the libs from relocated sysroot
|
||||
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
|
||||
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
|
||||
if [ -h "$so" ]; then
|
||||
local _real=$(basename $(readlink "$so"))
|
||||
local _real=$(basename "$(readlink \"$so\")")
|
||||
rm -f "$so"
|
||||
echo "GROUP ($_real)" > "$so"
|
||||
fi
|
||||
|
@ -408,27 +414,27 @@ package() {
|
|||
# add c89/c99 wrapper scripts
|
||||
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c89"
|
||||
_flavor="-std=c89"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-ansi|-std=c89|-std=iso9899:1990) fl="";;
|
||||
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
|
||||
#!/bin/sh
|
||||
fl="-std=c99"
|
||||
_flavor="-std=c99"
|
||||
for opt; do
|
||||
case "$opt" in
|
||||
-std=c99|-std=iso9899:1999) fl="";;
|
||||
-std=c99|-std=iso9899:1999) _flavor="";;
|
||||
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
exec gcc $fl ${1+"$@"}
|
||||
exec gcc $_flavor ${1+"$@"}
|
||||
EOF
|
||||
chmod 755 "$pkgdir"/usr/bin/c?9
|
||||
fi
|
||||
|
@ -504,6 +510,33 @@ libgomp() {
|
|||
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgomp.so.* "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
libgphobos() {
|
||||
pkgdesc="D programming language standard library for GCC"
|
||||
depends=
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/libgdruntime.so.* "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/lib/libgphobos.so.* "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gdc() {
|
||||
pkgdesc="GCC-based D language compiler"
|
||||
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
|
||||
[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
|
||||
"$subpkgdir"/usr/lib \
|
||||
"$subpkgdir"/usr/bin
|
||||
# Copy: The installed '.d' files, the static lib, the binary itself
|
||||
# The shared libs are part of 'libgphobos' so one can run program
|
||||
# without installing the compiler
|
||||
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
|
||||
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
|
||||
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
|
||||
}
|
||||
|
||||
|
||||
libgo() {
|
||||
pkgdesc="Go runtime library for GCC"
|
||||
depends=
|
||||
|
@ -548,7 +581,7 @@ libquadmath() {
|
|||
gfortran() {
|
||||
pkgdesc="GNU Fortran Compiler"
|
||||
depends="gcc=$_gccrel libgfortran=$_gccrel"
|
||||
$LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
|
||||
$_libquadmath && depends="$depends libquadmath=$_gccrel"
|
||||
replaces="gcc"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -559,7 +592,7 @@ gfortran() {
|
|||
mv "$pkgdir"/usr/lib/libgfortran.a \
|
||||
"$pkgdir"/usr/lib/libgfortran.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
if $LIBQUADMATH; then
|
||||
if $_libquadmath; then
|
||||
mv "$pkgdir"/usr/lib/libquadmath.a \
|
||||
"$pkgdir"/usr/lib/libquadmath.so \
|
||||
"$subpkgdir"/usr/lib/
|
||||
|
@ -579,6 +612,7 @@ libgnat() {
|
|||
gnat() {
|
||||
pkgdesc="Ada support for GCC"
|
||||
depends="gcc=$_gccrel"
|
||||
provides="$pkgname-gnat-bootstrap"
|
||||
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
|
||||
|
||||
mkdir -p "$subpkgdir"/$_gcclibexec \
|
||||
|
@ -622,4 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
|
|||
17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7 0016-invalid_tls_model.patch
|
||||
e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa gcc10-pr91920.patch
|
||||
38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df 400-dlang-phobos.patch
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch"
|
||||
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch
|
||||
9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69 402-dlang-stat.patch
|
||||
fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae 403-dlang-ibmz.patch
|
||||
ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb 404-dlang-zlib.patch"
|
||||
|
|
Loading…
Reference in a new issue