Files
haikuports/dev-lang/ghc/patches/ghc-8.10.2.patchset
Adrien Destugues 7c0aa72549 Add recipe for ghc 8.10
Finally we are up to date with the latest version of ghc!
2021-01-02 20:02:30 +01:00

288 lines
13 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From 64193eeed28f47ae055848f0824bd75dc8e0a822 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 2 Jan 2021 17:20:24 +0100
Subject: Import patches from ghc 8.6.5.
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 03bb529..3632fd9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -4632,6 +4632,7 @@ default_PIC :: Platform -> [GeneralFlag]
default_PIC platform =
case (platformOS platform, platformArch platform) of
(OSDarwin, ArchX86_64) -> [Opt_PIC]
+ (OSHaiku, _) -> [Opt_PIC]
(OSOpenBSD, ArchX86_64) -> [Opt_PIC] -- Due to PIE support in
-- OpenBSD since 5.3 release
-- (1 May 2013) we need to
diff --git a/configure.ac b/configure.ac
index f706506..4665ed4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -706,11 +706,11 @@ dnl --------------------------------------------------------------
dnl ** Copy the files from the "fs" utility into the right folders.
dnl --------------------------------------------------------------
AC_MSG_NOTICE([Creating links for in-tree file handling routines.])
-ln -f utils/fs/fs.* utils/lndir/
-ln -f utils/fs/fs.* utils/unlit/
-ln -f utils/fs/fs.* rts/
-ln -f utils/fs/fs.h libraries/base/include/
-ln -f utils/fs/fs.c libraries/base/cbits/
+cp utils/fs/fs.* utils/lndir/
+cp utils/fs/fs.* utils/unlit/
+cp utils/fs/fs.* rts/
+cp utils/fs/fs.h libraries/base/include/
+cp utils/fs/fs.c libraries/base/cbits/
AC_MSG_NOTICE([Routines in place. Packages can now be build normally.])
dnl --------------------------------------------------------------
@@ -1232,7 +1232,7 @@ dnl ** Use MMAP in the runtime linker?
dnl --------------------------------------------------------------
case ${TargetOS} in
- linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
+ linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2|haiku)
RtsLinkerUseMmap=1
;;
darwin|ios|watchos|tvos)
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs b/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
index abad0b2..d4aae8e 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
@@ -1730,6 +1730,7 @@ getRPaths lbi clbi | supportRPaths hostOS = do
supportRPaths OpenBSD   = False
supportRPaths NetBSD   = False
supportRPaths DragonFly = False
+ supportRPaths Haiku = True
supportRPaths Solaris = False
supportRPaths AIX = False
supportRPaths HPUX = False
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs b/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
index da405c6..bbb1f3c 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
@@ -193,6 +193,7 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
else case buildOS of
Windows -> do windowsProgramFilesDir <- getWindowsProgramFilesDir
return (windowsProgramFilesDir </> "Haskell")
+ Haiku -> return "/boot/system/non-packaged"
_ -> return "/usr/local"
installLibDir <-
case buildOS of
@@ -212,17 +213,22 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
flibdir = "$libdir",
libexecdir = case buildOS of
Windows -> "$prefix" </> "$libname"
+ Haiku -> "$libdir"
_other -> "$prefix" </> "libexec",
includedir = "$libdir" </> "$libsubdir" </> "include",
datadir = case buildOS of
Windows -> "$prefix"
_other -> "$prefix" </> "share",
datasubdir = "$abi" </> "$pkgid",
- docdir = "$datadir" </> "doc" </> "$abi" </> "$pkgid",
- mandir = "$datadir" </> "man",
+ docdir = case buildOS of
+ Haiku -> "$prefix" </> "documentation" </> "ghc"
+ _ -> "$datadir" </> "doc" </> "$abi" </> "$pkgid",
+ mandir = "$docdir" </> "man",
htmldir = "$docdir" </> "html",
haddockdir = "$htmldir",
- sysconfdir = "$prefix" </> "etc"
+ sysconfdir = case buildOS of
+ Haiku -> "boot" </> "home" </> "config" </> "settings"
+ _ -> "$prefix" </> "etc"
}
-- ---------------------------------------------------------------------------
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs b/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs
index e9dc66b..ed702b9 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs
@@ -629,6 +629,7 @@ platformDefines lbi =
OpenBSD -> ["openbsd"]
NetBSD -> ["netbsd"]
DragonFly -> ["dragonfly"]
+ Haiku -> ["haiku"]
Solaris -> ["solaris2"]
AIX -> ["aix"]
HPUX -> ["hpux"]
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs b/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
index 96c8406..ab8c175 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
@@ -1166,7 +1166,7 @@ createDirectoryIfMissingVerbose verbosity create_parents path0
-- the case that the dir did exist but another process deletes the
-- directory and creates a file in its place before we can check
-- that the directory did indeed exist.
- | isAlreadyExistsError e -> (do
+ | isAlreadyExistsError e || isPermissionError e -> (do
isDir <- doesDirectoryExist dir
unless isDir $ throwIO e
) `catchIO` ((\_ -> return ()) :: IOException -> IO ())
diff --git a/libraries/Cabal/Cabal/Distribution/System.hs b/libraries/Cabal/Cabal/Distribution/System.hs
index c480d24..5d1c07d 100644
--- a/libraries/Cabal/Cabal/Distribution/System.hs
+++ b/libraries/Cabal/Cabal/Distribution/System.hs
@@ -78,7 +78,7 @@ data ClassificationStrictness = Permissive | Compat | Strict
-- ------------------------------------------------------------
-- | These are the known OS names: Linux, Windows, OSX
--- ,FreeBSD, OpenBSD, NetBSD, DragonFly
+-- ,FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku
-- ,Solaris, AIX, HPUX, IRIX
-- ,HaLVM ,Hurd ,IOS, Android,Ghcjs
--
@@ -91,7 +91,7 @@ data ClassificationStrictness = Permissive | Compat | Strict
--
data OS = Linux | Windows | OSX -- tier 1 desktop OSs
| FreeBSD | OpenBSD | NetBSD -- other free Unix OSs
- | DragonFly
+ | DragonFly | Haiku
| Solaris | AIX | HPUX | IRIX -- ageing Unix OSs
| HaLVM -- bare metal / VMs / hypervisors
| Hurd -- GNU's microkernel
@@ -106,7 +106,7 @@ instance NFData OS where rnf = genericRnf
knownOSs :: [OS]
knownOSs = [Linux, Windows, OSX
- ,FreeBSD, OpenBSD, NetBSD, DragonFly
+ ,FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku
,Solaris, AIX, HPUX, IRIX
,HaLVM
,Hurd
@@ -118,6 +118,7 @@ osAliases Permissive Windows = ["mingw32", "win32", "cygwin32"]
osAliases Compat Windows = ["mingw32", "win32"]
osAliases _ OSX = ["darwin"]
osAliases _ Hurd = ["gnu"]
+osAliases _ Haiku = ["haiku"]
osAliases Permissive FreeBSD = ["kfreebsdgnu"]
osAliases Compat FreeBSD = ["kfreebsdgnu"]
osAliases Permissive Solaris = ["solaris2"]
diff --git a/libraries/Cabal/Cabal/Makefile b/libraries/Cabal/Cabal/Makefile
index 4a814fb..be42c92 100644
--- a/libraries/Cabal/Cabal/Makefile
+++ b/libraries/Cabal/Cabal/Makefile
@@ -4,7 +4,7 @@ VERSION=3.2.0.0
KIND=rc
#KIND=cabal-latest
-PREFIX=/usr/local
+PREFIX=/boot/system
HC=ghc
GHCFLAGS=-Wall -threaded
SSH_USER=$(USER)
diff --git a/libraries/Cabal/cabal-install/bootstrap.sh b/libraries/Cabal/cabal-install/bootstrap.sh
index 077d7f4..00aa5a2 100755
--- a/libraries/Cabal/cabal-install/bootstrap.sh
+++ b/libraries/Cabal/cabal-install/bootstrap.sh
@@ -122,7 +122,7 @@ while [ "$#" -gt 0 ]; do
shift;;
"--global")
SCOPE_OF_INSTALLATION="${1}"
- DEFAULT_PREFIX="/usr/local"
+ DEFAULT_PREFIX="/boot/system"
shift;;
"--sandbox")
shift
diff --git a/libraries/directory/System/Directory/Internal/Posix.hsc b/libraries/directory/System/Directory/Internal/Posix.hsc
index ba67480..bea9b74 100644
--- a/libraries/directory/System/Directory/Internal/Posix.hsc
+++ b/libraries/directory/System/Directory/Internal/Posix.hsc
@@ -305,7 +305,11 @@ getXdgDirectoryListFallback xdgDirs =
getAppUserDataDirectoryInternal :: FilePath -> IO FilePath
getAppUserDataDirectoryInternal appName =
+# if defined(haiku_HOST_OS)
+ (\ home -> home <> ("/config/settings/." ++ appName)) <$> getHomeDirectoryInternal
+# else
(\ home -> home <> ('/' : '.' : appName)) <$> getHomeDirectoryInternal
+# endif
getUserDocumentsDirectoryInternal :: IO FilePath
getUserDocumentsDirectoryInternal = getHomeDirectoryInternal
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 57de094..07ae5e0 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -205,7 +205,7 @@ GhcThreadedRts = @GhcThreadedRts@
# Whether to include GHCi in the compiler. Depends on whether the RTS linker
# has support for this OS/ARCH combination.
-OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu)))
+OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu,haiku)))
ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm aarch64)))
ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index 26798f2..b528caf 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -367,7 +367,7 @@ void freeSegments(ObjectCode *oc);
|| defined(linux_android_HOST_OS) \
|| defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) \
|| defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \
-|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
+|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) || defined(haiku_HOST_OS)
# define OBJFORMAT_ELF
# include "linker/ElfTypes.h"
#elif defined(mingw32_HOST_OS)
diff --git a/rts/Task.h b/rts/Task.h
index 17bcbe2..784a380 100644
--- a/rts/Task.h
+++ b/rts/Task.h
@@ -321,7 +321,7 @@ typedef StgWord64 TaskId;
//
#if defined(THREADED_RTS)
INLINE_HEADER TaskId serialiseTaskId (OSThreadId taskID) {
-#if defined(freebsd_HOST_OS) || defined(darwin_HOST_OS)
+#if defined(freebsd_HOST_OS) || defined(darwin_HOST_OS) || defined(haiku_HOST_OS)
// Here OSThreadId is a pthread_t and pthread_t is a pointer, but within
// the process we can still use that pointer value as a unique id.
return (TaskId) (size_t) taskID;
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index be62800..ab4ddf8 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -4,7 +4,7 @@
|| defined(linux_android_HOST_OS) \
|| defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) \
|| defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \
-|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
+|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) || defined(haiku_HOST_OS)
// It is essential that this is included before any <elf.h> is included. <elf.h>
// defines R_XXX relocations, which would interfere with the COMPAT_R_XXX
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index 15f1b62..cfa3846 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -245,6 +245,10 @@ my_mmap (void *addr, W_ size, int operation)
// See #7500.
ret = linux_retry_mmap(operation, size, ret, addr, prot, flags);
}
+#elif defined(haiku_HOST_OS)
+ // Retry without address constraint
+ if (ret == (void *)-1 && errno == EFAULT)
+ ret = mmap(0, size, prot, MAP_ANON | MAP_PRIVATE, -1, 0);
# endif
if (ret == MAP_FAILED) {
return NULL;
diff --git a/rules/library-path.mk b/rules/library-path.mk
index 9a398ee..8c7801e 100644
--- a/rules/library-path.mk
+++ b/rules/library-path.mk
@@ -15,6 +15,8 @@ ifeq "$(TargetOS_CPP)" "mingw32"
prependLibraryPath = $(error Do not know how to prependLibraryPath on Windows)
else ifeq "$(TargetOS_CPP)" "darwin"
prependLibraryPath = export DYLD_LIBRARY_PATH="$1$${DYLD_LIBRARY_PATH:+:$$DYLD_LIBRARY_PATH}"
+else ifeq "$(TargetOS_CPP)" "haiku"
+prependLibraryPath = export LIBRARY_PATH="$1:$$LIBRARY_PATH"
else
prependLibraryPath = export LD_LIBRARY_PATH="$1$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}"
endif
--
2.28.0