ghc 8.6: add patches provided by Donn Cave.

Atempt to enable the recipe, but the previous version of ghc (2.2)
crashes during the build for me. Let's see if the buildbot does better.
This commit is contained in:
Adrien Destugues
2021-01-02 12:58:44 +01:00
parent d69b1e6d8f
commit e9819ea44c
2 changed files with 104 additions and 22 deletions

View File

@@ -14,29 +14,8 @@ SOURCE_DIR="ghc-$portVersion"
CHECKSUM_SHA256="4d4aa1e96f4001b934ac6193ab09af5d6172f41f5a5d39d8e43393b9aafee361"
PATCHES="ghc-8.6.5.patchset"
# Disabled because this patch from 8.2.2 has not been applied:
#
#--- a/libraries/directory/System/Directory.hs
#+++ b/libraries/directory/System/Directory.hs
#@@ -1872,6 +1872,9 @@ getAppUserDataDirectory appName = do
# #if defined(mingw32_HOST_OS)
# s <- Win32.sHGetFolderPath nullPtr Win32.cSIDL_APPDATA nullPtr 0
# return (s++'\\':appName)
#+#elif defined(haiku_HOST_OS)
#+ path <- getEnv "HOME"
#+ return (path ++ "/config/settings/" ++ appName)
# #else
# path <- getEnv "HOME"
# return (path++'/':'.':appName)
#
# Anyone with some Haskell knowledge is welcome to provide an update of this
# patch to the code in Haskell 8.2 (it has been refactored, the patch does not
# apply directly)
#
# Without this patch, Haskell apps would put their settings at the wrong place,
# including Cabal, which is annoying and will result in some confusion.
ARCHITECTURES="!x86"
SECONDARY_ARCHITECTURES="!x86"
SECONDARY_ARCHITECTURES="x86"
GLOBAL_WRITABLE_FILES="
settings/ghc directory keep-old

View File

@@ -206,3 +206,106 @@ index dbfd4be..49e04ae 100644
--
2.28.0
From 3c64f217dc939acaa70389c978cb10d6ae991ae8 Mon Sep 17 00:00:00 2001
From: Donn Cave <donn@avvanta.com>
Date: Sat, 2 Jan 2021 11:22:50 +0100
Subject: Patch for better Haiku support
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs b/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
index 1d4a97a..ca828aa 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
@@ -1633,6 +1633,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/Utils.hs b/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
index 871a3e9..db768a0 100644
--- a/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/Utils.hs
@@ -1167,7 +1167,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/Makefile b/libraries/Cabal/Cabal/Makefile
index e2bb10b..779c993 100644
--- a/libraries/Cabal/Cabal/Makefile
+++ b/libraries/Cabal/Cabal/Makefile
@@ -5,7 +5,7 @@ VERSION=2.4.0.1
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 7246ae9..0bbed8f 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 5a4d5dc..9ed01dc 100644
--- a/libraries/directory/System/Directory/Internal/Posix.hsc
+++ b/libraries/directory/System/Directory/Internal/Posix.hsc
@@ -294,7 +294,11 @@ getXdgDirectoryListInternal 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 c112a5f..76ae7f0 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -199,7 +199,7 @@ GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised
# 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/Task.h b/rts/Task.h
index 0410407..d9b61c8 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;
--
2.28.0