mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
Add recipe for ghc 8.2.
This commit is contained in:
131
dev-lang/ghc/ghc8.2-8.2.2.recipe
Normal file
131
dev-lang/ghc/ghc8.2-8.2.2.recipe
Normal file
@@ -0,0 +1,131 @@
|
||||
SUMMARY="The Glasgow Haskell Compiler"
|
||||
DESCRIPTION="
|
||||
The Glorious Glasgow Haskell Compilation system (GHC) is a compiler for Haskell.
|
||||
|
||||
Haskell is \"the\" standard lazy functional programming language.
|
||||
"
|
||||
HOMEPAGE="https://www.haskell.org/ghc/"
|
||||
COPYRIGHT="The Glasgow Haskell Team"
|
||||
LICENSE="BSD (3-clause)
|
||||
GNU LGPL v2.1"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://www.haskell.org/ghc/dist/$portVersion/ghc-$portVersion-src.tar.xz"
|
||||
SOURCE_DIR="ghc-$portVersion"
|
||||
CHECKSUM_SHA256="bb8ec3634aa132d09faa270bbd604b82dfa61f04855655af6f9d14a9eedc05fc"
|
||||
PATCHES="ghc-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="!x86"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
GLOBAL_WRITABLE_FILES="
|
||||
settings/ghc directory keep-old
|
||||
"
|
||||
|
||||
PROVIDES="
|
||||
ghc78$secondaryArchSuffix = $portVersion
|
||||
cmd:ghc = $portVersion compat >= 8.2
|
||||
cmd:ghc_$portVersion
|
||||
cmd:ghc_pkg
|
||||
cmd:ghc_pkg_$portVersion
|
||||
cmd:ghci
|
||||
cmd:ghci_$portVersion
|
||||
cmd:haddock
|
||||
cmd:haddock_ghc_$portVersion
|
||||
cmd:hp2ps
|
||||
cmd:hpc
|
||||
cmd:hsc2hs
|
||||
cmd:runghc
|
||||
cmd:runghc_$portVersion
|
||||
cmd:runhaskell
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix >= $haikuVersion
|
||||
lib:libiconv$secondaryArchSuffix
|
||||
lib:libncursesw$secondaryArchSuffix >= 6
|
||||
lib:libz$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel >= $haikuVersion
|
||||
haiku_devel >= $haikuVersion
|
||||
devel:libgmp$secondaryArchSuffix
|
||||
devel:libiconv$secondaryArchSuffix
|
||||
devel:libncursesw$secondaryArchSuffix >= 6
|
||||
devel:libz$secondaryArchSuffix
|
||||
docbook_xml_dtd
|
||||
docbook_xsl_stylesheets
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:autoconf
|
||||
cmd:awk
|
||||
cmd:find
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:ghc_7.10.3
|
||||
cmd:ghc_pkg_7.10.3
|
||||
cmd:git
|
||||
cmd:grep
|
||||
cmd:ld$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:patch
|
||||
cmd:perl
|
||||
cmd:sed
|
||||
cmd:sort
|
||||
cmd:tar
|
||||
cmd:xsltproc
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
# 2. Build GHC using the bootstrap compiler; we create a "dyn" only install
|
||||
echo "Building GHC proper..."
|
||||
|
||||
cat > mk/build.mk <<-EOF
|
||||
V = 0
|
||||
GhcLibWays = v dyn
|
||||
SRC_HC_OPTS = -O -H64m
|
||||
GhcStage1HcOpts = -O -fasm
|
||||
GhcStage2HcOpts = -O2 -fasm
|
||||
GhcHcOpts = -Rghc-timing
|
||||
GhcLibHcOpts = -O2
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = YES
|
||||
DYNAMIC_TOO = YES
|
||||
|
||||
NoFibWays =
|
||||
STRIP_CMD = :
|
||||
EOF
|
||||
|
||||
# Workaround for haikuporter bug #207
|
||||
mkdir -p /system/settings/ghc
|
||||
cp -r /system/lib/x86/ghc-*/package.conf.d /system/settings/ghc/
|
||||
|
||||
export HOME=/boot/home
|
||||
|
||||
autoconf
|
||||
|
||||
# haikuporter's buildspec confuses GHC, so we omit it, and we can't
|
||||
# have a gcc2 GHC, so just install directly into $prefix/bin
|
||||
runConfigure --omit-buildspec --omit-dirs binDir configure --bindir=$prefix/bin GHC=/bin/ghc-7.10.3 CC=/bin/gcc-x86
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
export HOME=/boot/home
|
||||
|
||||
export GHC_PACKAGE_PATH=$settingsDir/ghc/package.conf.d
|
||||
ghc-pkg init $GHC_PACKAGE_PATH
|
||||
unset GHC_PACKAGE_PATH
|
||||
# 1. Install our new GHC
|
||||
echo "Installing GHC!"
|
||||
make install
|
||||
|
||||
# 2. Move package.conf.d to settings
|
||||
sed -i -e '/^PKGCONF=/c\
|
||||
PKGCONF='"$settingsDir"'/ghc/package.conf.d' $prefix/bin/ghc-pkg-$portVersion
|
||||
unset GHC_PACKAGE_PATH
|
||||
|
||||
# move package.conf.d files to the right place...
|
||||
mv $libDir/ghc-$portVersion/package.conf.d/*.conf $settingsDir/ghc/package.conf.d/
|
||||
$prefix/bin/ghc-pkg recache
|
||||
}
|
||||
233
dev-lang/ghc/patches/ghc-8.2.2.patchset
Normal file
233
dev-lang/ghc/patches/ghc-8.2.2.patchset
Normal file
@@ -0,0 +1,233 @@
|
||||
From d412c455642284288f66c26c52a71b05a68efb3f Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Tue, 29 Dec 2020 15:33:18 +0100
|
||||
Subject: Rebase Haiku patches from ghc 7.10
|
||||
|
||||
|
||||
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
|
||||
index 40e6a8d..71a1725 100644
|
||||
--- a/compiler/main/DriverPipeline.hs
|
||||
+++ b/compiler/main/DriverPipeline.hs
|
||||
@@ -2227,6 +2227,9 @@ joinObjectFiles dflags o_files output_fn = do
|
||||
then [SysTools.Option "-no-pie"]
|
||||
else [])
|
||||
|
||||
+ ++ (if osInfo == OSHaiku
|
||||
+ then [SysTools.Option "-r"]
|
||||
+ else [])
|
||||
++ (if any (cc ==) [Clang, AppleClang, AppleClang51]
|
||||
then []
|
||||
else [SysTools.Option "-nodefaultlibs"])
|
||||
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
|
||||
index f5f5f00..0c03454 100644
|
||||
--- a/compiler/main/DynFlags.hs
|
||||
+++ b/compiler/main/DynFlags.hs
|
||||
@@ -4020,6 +4020,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 8fc0dc6..6b87fc7 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1091,7 +1091,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)
|
||||
diff --git a/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs b/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
|
||||
index 14a2bf8..3fcf1a9 100644
|
||||
--- a/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
|
||||
+++ b/libraries/Cabal/Cabal/Distribution/Simple/InstallDirs.hs
|
||||
@@ -183,6 +183,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
|
||||
@@ -208,17 +209,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 6835cf5..f0f51aa 100644
|
||||
--- a/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs
|
||||
+++ b/libraries/Cabal/Cabal/Distribution/Simple/PreProcess.hs
|
||||
@@ -580,6 +580,7 @@ platformDefines lbi =
|
||||
OpenBSD -> ["openbsd"]
|
||||
NetBSD -> ["netbsd"]
|
||||
DragonFly -> ["dragonfly"]
|
||||
+ Haiku -> ["haiku"]
|
||||
Solaris -> ["solaris2"]
|
||||
AIX -> ["aix"]
|
||||
HPUX -> ["hpux"]
|
||||
diff --git a/libraries/Cabal/Cabal/Distribution/System.hs b/libraries/Cabal/Cabal/Distribution/System.hs
|
||||
index aa25624..4e635de 100644
|
||||
--- a/libraries/Cabal/Cabal/Distribution/System.hs
|
||||
+++ b/libraries/Cabal/Cabal/Distribution/System.hs
|
||||
@@ -74,7 +74,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
|
||||
--
|
||||
@@ -87,7 +87,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
|
||||
@@ -100,7 +100,7 @@ instance Binary OS
|
||||
|
||||
knownOSs :: [OS]
|
||||
knownOSs = [Linux, Windows, OSX
|
||||
- ,FreeBSD, OpenBSD, NetBSD, DragonFly
|
||||
+ ,FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku
|
||||
,Solaris, AIX, HPUX, IRIX
|
||||
,HaLVM
|
||||
,Hurd
|
||||
@@ -111,6 +111,7 @@ osAliases :: ClassificationStrictness -> OS -> [String]
|
||||
osAliases Permissive Windows = ["mingw32", "win32", "cygwin32"]
|
||||
osAliases Compat Windows = ["mingw32", "win32"]
|
||||
osAliases _ OSX = ["darwin"]
|
||||
+osAliases _ Haiku = ["haiku"]
|
||||
osAliases _ Hurd = ["gnu"]
|
||||
osAliases Permissive FreeBSD = ["kfreebsdgnu"]
|
||||
osAliases Compat FreeBSD = ["kfreebsdgnu"]
|
||||
diff --git a/libraries/directory/System/Directory.hs b/libraries/directory/System/Directory.hs
|
||||
index f4475c4..83bb3ab 100644
|
||||
--- 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)
|
||||
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
|
||||
index 76497df..b6c6d8c 100644
|
||||
--- a/rts/LinkerInternals.h
|
||||
+++ b/rts/LinkerInternals.h
|
||||
@@ -299,7 +299,7 @@ char *cstring_from_section_name(
|
||||
#endif
|
||||
|
||||
/* Which object file format are we targetting? */
|
||||
-#if defined(linux_HOST_OS) || defined(solaris2_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)
|
||||
+#if defined(linux_HOST_OS) || defined(solaris2_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(haiku_HOST_OS)
|
||||
# define OBJFORMAT_ELF
|
||||
#elif defined (mingw32_HOST_OS)
|
||||
# define OBJFORMAT_PEi386
|
||||
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
|
||||
index df35604..1c70941 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)
|
||||
|
||||
#include "RtsUtils.h"
|
||||
#include "RtsSymbolInfo.h"
|
||||
@@ -98,6 +98,26 @@
|
||||
# define R_X86_64_PC64 24
|
||||
# endif
|
||||
|
||||
+# ifndef SHT_INIT_ARRAY
|
||||
+# define SHT_INIT_ARRAY 14
|
||||
+# endif
|
||||
+
|
||||
+#ifndef R_386_NONE
|
||||
+#define R_386_NONE 0
|
||||
+#define R_386_32 1 /* add symbol value */
|
||||
+#define R_386_PC32 2 /* add PC relative symbol value */
|
||||
+#define R_386_GOT32 3 /* add PC relative GOT offset */
|
||||
+#define R_386_PLT32 4 /* add PC relative PLT offset */
|
||||
+#define R_386_COPY 5 /* copy data from shared object */
|
||||
+#define R_386_GLOB_DAT 6 /* set GOT entry to data address */
|
||||
+#define R_386_JMP_SLOT 7 /* set GOT entry to code address */
|
||||
+#define R_386_RELATIVE 8 /* add load address of shared object */
|
||||
+#define R_386_GOTOFF 9 /* add GOT relative symbol address */
|
||||
+#define R_386_GOTPC 10 /* add PC relative GOT table address */
|
||||
+#define R_386_TLS_DTPMOD32 35
|
||||
+#define R_386_TLS_DTPOFF32 36
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Workaround for libc implementations (e.g. eglibc) with incomplete
|
||||
* relocation lists
|
||||
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
|
||||
index d25aaf8..f4590e1 100644
|
||||
--- a/rts/posix/OSMem.c
|
||||
+++ b/rts/posix/OSMem.c
|
||||
@@ -191,6 +191,11 @@ my_mmap (void *addr, W_ size, int operation)
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
+#elif haiku_HOST_OS
|
||||
+ ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
+ // Retry without address constraint
|
||||
+ if (ret == (void *)-1 && errno == EFAULT)
|
||||
+ ret = mmap(0, size, prot, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#else
|
||||
ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
diff --git a/rules/library-path.mk b/rules/library-path.mk
|
||||
index dbfd4be..49e04ae 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
|
||||
|
||||
Reference in New Issue
Block a user