Merge pull request #85926 from NixOS/haskell-updates
Update Haskell package set to LTS 15.9 (plus other fixes)wip/yesman
commit
7d30b4d1b5
@ -1,236 +0,0 @@ |
||||
{ stdenv, pkgsBuildTarget, targetPackages |
||||
|
||||
# build-tools |
||||
, bootPkgs |
||||
, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx |
||||
, bash |
||||
|
||||
, libiconv ? null, ncurses |
||||
|
||||
, # GHC can be built with system libffi or a bundled one. |
||||
libffi ? null |
||||
|
||||
, useLLVM ? !stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isiOS |
||||
, # LLVM is conceptually a run-time-only depedendency, but for |
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a |
||||
# build-time dependency too. |
||||
buildLlvmPackages, llvmPackages |
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slower integer-simple |
||||
# library instead of the faster but GPLed integer-gmp library. |
||||
enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp |
||||
|
||||
, # If enabled, use -fPIC when compiling static libs. |
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform |
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target |
||||
# platform). Static libs are always built. |
||||
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt |
||||
|
||||
, # Whetherto build terminfo. |
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows |
||||
|
||||
, # What flavour to build. An empty string indicates no |
||||
# specific flavour and falls back to ghc default values. |
||||
ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) |
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg") |
||||
|
||||
, # Whether to disable the large address space allocator |
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ |
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64 |
||||
}: |
||||
|
||||
assert !enableIntegerSimple -> gmp != null; |
||||
|
||||
let |
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform; |
||||
|
||||
inherit (bootPkgs) ghc; |
||||
|
||||
# TODO(@Ericson2314) Make unconditional |
||||
targetPrefix = stdenv.lib.optionalString |
||||
(targetPlatform != hostPlatform) |
||||
"${targetPlatform.config}-"; |
||||
|
||||
buildMK = '' |
||||
BuildFlavour = ${ghcFlavour} |
||||
ifneq \"\$(BuildFlavour)\" \"\" |
||||
include mk/flavours/\$(BuildFlavour).mk |
||||
endif |
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} |
||||
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"} |
||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' |
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} |
||||
CrossCompilePrefix = ${targetPrefix} |
||||
HADDOCK_DOCS = NO |
||||
BUILD_SPHINX_HTML = NO |
||||
BUILD_SPHINX_PDF = NO |
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs '' |
||||
GhcLibHcOpts += -fPIC |
||||
GhcRtsHcOpts += -fPIC |
||||
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' |
||||
EXTRA_CC_OPTS += -std=gnu99 |
||||
''; |
||||
|
||||
# Splicer will pull out correct variations |
||||
libDeps = platform: stdenv.lib.optional enableTerminfo ncurses |
||||
++ [libffi] |
||||
++ stdenv.lib.optional (!enableIntegerSimple) gmp |
||||
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; |
||||
|
||||
toolsForTarget = [ |
||||
pkgsBuildTarget.targetPackages.stdenv.cc |
||||
] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; |
||||
|
||||
targetCC = builtins.head toolsForTarget; |
||||
|
||||
# ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 |
||||
# see #84670 and #49071 for more background. |
||||
useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl; |
||||
|
||||
in |
||||
stdenv.mkDerivation (rec { |
||||
version = "8.8.1"; |
||||
name = "${targetPrefix}ghc-${version}"; |
||||
|
||||
src = fetchurl { |
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"; |
||||
sha256 = "06kj4fhvijinjafiy4s873n60qly323rdlz9bmc79nhlp3cq72lh"; |
||||
}; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
outputs = [ "out" "doc" ]; |
||||
|
||||
postPatch = "patchShebangs ."; |
||||
|
||||
# GHC is a bit confused on its cross terminology. |
||||
preConfigure = '' |
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do |
||||
export "''${env#TARGET_}=''${!env}" |
||||
done |
||||
# GHC is a bit confused on its cross terminology, as these would normally be |
||||
# the *host* tools. |
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" |
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" |
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 |
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" |
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" |
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" |
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" |
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" |
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" |
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" |
||||
|
||||
echo -n "${buildMK}" > mk/build.mk |
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure |
||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) '' |
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" |
||||
'' + stdenv.lib.optionalString stdenv.isDarwin '' |
||||
export NIX_LDFLAGS+=" -no_dtrace_dof" |
||||
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' |
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets |
||||
'' + stdenv.lib.optionalString targetPlatform.isMusl '' |
||||
echo "patching llvm-targets for musl targets..." |
||||
echo "Cloning these existing '*-linux-gnu*' targets:" |
||||
grep linux-gnu llvm-targets | sed 's/^/ /' |
||||
echo "(go go gadget sed)" |
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets |
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:" |
||||
grep linux-musl llvm-targets | sed 's/^/ /' |
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'" |
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen) |
||||
for x in configure aclocal.m4; do |
||||
substituteInPlace $x \ |
||||
--replace '*-android*|*-gnueabi*)' \ |
||||
'*-android*|*-gnueabi*|*-musleabi*)' |
||||
done |
||||
''; |
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix. |
||||
configurePlatforms = [ "build" "host" ] |
||||
++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; |
||||
# `--with` flags for libraries needed for RTS linker |
||||
configureFlags = [ |
||||
"--datadir=$doc/share/doc/ghc" |
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" |
||||
] ++ stdenv.lib.optionals (libffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" |
||||
] ++ stdenv.lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [ |
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" |
||||
] ++ stdenv.lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ |
||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" |
||||
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ |
||||
"--enable-bootstrap-with-devel-snapshot" |
||||
] ++ stdenv.lib.optionals useLdGold [ |
||||
"CFLAGS=-fuse-ld=gold" |
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" |
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" |
||||
] ++ stdenv.lib.optionals (disableLargeAddressSpace) [ |
||||
"--disable-large-address-space" |
||||
]; |
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatability. |
||||
strictDeps = true; |
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself. |
||||
dontAddExtraLibs = true; |
||||
|
||||
nativeBuildInputs = [ |
||||
perl autoconf automake m4 python3 sphinx |
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour |
||||
]; |
||||
|
||||
# For building runtime libs |
||||
depsBuildTarget = toolsForTarget; |
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform); |
||||
|
||||
propagatedBuildInputs = [ targetPackages.stdenv.cc ] |
||||
++ stdenv.lib.optional useLLVM llvmPackages.llvm; |
||||
|
||||
depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); |
||||
depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); |
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and |
||||
# that in turn causes GHCi to abort |
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; |
||||
|
||||
checkTarget = "test"; |
||||
|
||||
hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; |
||||
|
||||
postInstall = '' |
||||
# Install the bash completion file. |
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc |
||||
|
||||
# Patch scripts to include "readelf" and "cat" in $PATH. |
||||
for i in "$out/bin/"*; do |
||||
test ! -h $i || continue |
||||
egrep --quiet '^#!' <(head -n 1 $i) || continue |
||||
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i |
||||
done |
||||
''; |
||||
|
||||
passthru = { |
||||
inherit bootPkgs targetPrefix; |
||||
|
||||
inherit llvmPackages; |
||||
inherit enableShared; |
||||
|
||||
# Our Cabal compiler name |
||||
haskellCompilerName = "ghc-${version}"; |
||||
}; |
||||
|
||||
meta = { |
||||
homepage = "http://haskell.org/ghc"; |
||||
description = "The Glasgow Haskell Compiler"; |
||||
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ]; |
||||
inherit (ghc.meta) license platforms; |
||||
}; |
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { |
||||
dontStrip = true; |
||||
dontPatchELF = true; |
||||
noAuditTmpdir = true; |
||||
}) |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,333 @@ |
||||
From 2490fa65eeba52699a7c0e303aa5cb9b78c2b1cf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
|
||||
Date: Fri, 17 Apr 2020 20:49:23 +0200
|
||||
Subject: [PATCH] Compile against GHC 8.8
|
||||
|
||||
---
|
||||
Setup.hs | 15 ---------------
|
||||
src/Darcs/Patch/Depends.hs | 2 +-
|
||||
src/Darcs/Patch/Match.hs | 12 ++++++------
|
||||
src/Darcs/Patch/PatchInfoAnd.hs | 2 +-
|
||||
src/Darcs/Patch/Prim/V1/Apply.hs | 6 +++---
|
||||
src/Darcs/Patch/Prim/V1/Commute.hs | 1 +
|
||||
src/Darcs/Patch/ReadMonads.hs | 1 +
|
||||
src/Darcs/Patch/V1/Commute.hs | 1 +
|
||||
src/Darcs/Repository/Diff.hs | 2 +-
|
||||
src/Darcs/Repository/Match.hs | 2 +-
|
||||
src/Darcs/Util/Tree/Monad.hs | 4 ++--
|
||||
12 files changed, 30 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/Setup.hs b/Setup.hs
|
||||
index f5cc3e8..05caac4 100644
|
||||
--- a/Setup.hs
|
||||
+++ b/Setup.hs
|
||||
@@ -75,21 +75,6 @@
|
||||
postInst = \ _ flags pkg lbi ->
|
||||
installManpage pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest,
|
||||
|
||||
- sDistHook = \ pkg lbi hooks flags -> do
|
||||
- let pkgVer = packageVersion pkg
|
||||
- verb = fromFlag $ sDistVerbosity flags
|
||||
- x <- versionPatches verb pkgVer
|
||||
- y <- context verb
|
||||
- rewriteFileEx silent "release/distributed-version" $ show x
|
||||
- rewriteFileEx silent "release/distributed-context" $ show y
|
||||
- putStrLn "about to hand over"
|
||||
- let pkg' = pkg { library = sanity (library pkg) }
|
||||
- sanity (Just lib) = Just $ lib { libBuildInfo = sanity' $ libBuildInfo lib }
|
||||
- sanity _ = error "eh"
|
||||
- sanity' bi = bi { otherModules = [ m | m <- otherModules bi, toFilePath m /= "Version" ] }
|
||||
-
|
||||
- sDistHook simpleUserHooks pkg' lbi hooks flags
|
||||
- ,
|
||||
postConf = \_ _ _ _ -> return () --- Usually this checked for external C
|
||||
--- dependencies, but we already have performed such
|
||||
--- check in the confHook
|
||||
--- a/darcs.cabal 1970-01-01 01:00:01.000000000 +0100
|
||||
+++ b/darcs.cabal 2020-04-18 10:26:07.605129733 +0200
|
||||
@@ -1,6 +1,5 @@
|
||||
Name: darcs
|
||||
version: 2.14.2
|
||||
-x-revision: 1
|
||||
License: GPL-2
|
||||
License-file: COPYING
|
||||
Author: David Roundy <droundy@darcs.net>, <darcs-devel@darcs.net>
|
||||
@@ -75,7 +74,7 @@
|
||||
description: Use libcurl for HTTP support.
|
||||
|
||||
-- in future this could extend to any other external libraries,
|
||||
--- e.g. libiconv
|
||||
+-- e.g. libiconv
|
||||
flag pkgconfig
|
||||
description: Use pkgconfig to configure libcurl
|
||||
default: False
|
||||
@@ -113,7 +112,7 @@
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
custom-setup
|
||||
- setup-depends: base >= 4.9 && < 4.13,
|
||||
+ setup-depends: base >= 4.9 && <5,
|
||||
Cabal >= 1.24,
|
||||
process >= 1.2.3.0 && < 1.7,
|
||||
filepath >= 1.4.1 && < 1.5.0.0,
|
||||
@@ -381,7 +380,7 @@
|
||||
else
|
||||
build-depends: unix >= 2.7.1.0 && < 2.8
|
||||
|
||||
- build-depends: base >= 4.9 && < 4.13,
|
||||
+ build-depends: base >= 4.9 && <5,
|
||||
stm >= 2.1 && < 2.6,
|
||||
binary >= 0.5 && < 0.10,
|
||||
containers >= 0.5.6.2 && < 0.7,
|
||||
@@ -402,19 +401,19 @@
|
||||
tar >= 0.5 && < 0.6,
|
||||
data-ordlist == 0.4.*,
|
||||
attoparsec >= 0.13.0.1 && < 0.14,
|
||||
- zip-archive >= 0.3 && < 0.5,
|
||||
+ zip-archive >= 0.3 && <1,
|
||||
async >= 2.0.2 && < 2.3,
|
||||
- sandi >= 0.4 && < 0.6,
|
||||
+ sandi >= 0.4 && <1,
|
||||
unix-compat >= 0.4.2 && < 0.6,
|
||||
bytestring >= 0.10.6 && < 0.11,
|
||||
old-time >= 1.1.0.3 && < 1.2,
|
||||
time >= 1.5.0.1 && < 1.10,
|
||||
- text >= 1.2.1.3 && < 1.3,
|
||||
+ text >= 1.2.1.3 && <2,
|
||||
directory >= 1.2.6.2 && < 1.4,
|
||||
process >= 1.2.3.0 && < 1.7,
|
||||
array >= 0.5.1.0 && < 0.6,
|
||||
random >= 1.1 && < 1.2,
|
||||
- hashable >= 1.2.3.3 && < 1.3,
|
||||
+ hashable >= 1.2.3.3 && <2,
|
||||
mmap >= 0.5.9 && < 0.6,
|
||||
zlib >= 0.6.1.2 && < 0.7.0.0,
|
||||
network-uri == 2.6.*,
|
||||
@@ -443,7 +442,7 @@
|
||||
|
||||
-- The terminfo package cannot be built on Windows.
|
||||
if flag(terminfo) && !os(windows)
|
||||
- build-depends: terminfo >= 0.4.0.2 && < 0.5
|
||||
+ build-depends: terminfo >= 0.4.0.2 && <1
|
||||
cpp-options: -DHAVE_TERMINFO
|
||||
|
||||
default-extensions:
|
||||
@@ -500,7 +499,7 @@
|
||||
cc-options: -D_REENTRANT
|
||||
|
||||
build-depends: darcs,
|
||||
- base >= 4.9 && < 4.13
|
||||
+ base >= 4.9 && <5
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- unit test driver
|
||||
@@ -518,7 +517,7 @@
|
||||
build-depends: Win32 >= 2.3.1 && < 2.4
|
||||
|
||||
build-depends: darcs,
|
||||
- base >= 4.9 && < 4.13,
|
||||
+ base >= 4.9 && <5,
|
||||
array >= 0.5.1.0 && < 0.6,
|
||||
bytestring >= 0.10.6 && < 0.11,
|
||||
cmdargs >= 0.10.10 && < 0.11,
|
||||
@@ -527,15 +526,15 @@
|
||||
mtl >= 2.2.1 && < 2.3,
|
||||
shelly >= 1.6.8 && < 1.9,
|
||||
split >= 0.2.2 && < 0.3,
|
||||
- text >= 1.2.1.3 && < 1.3,
|
||||
+ text >= 1.2.1.3 && <2,
|
||||
directory >= 1.2.6.2 && < 1.4,
|
||||
FindBin >= 0.0.5 && < 0.1,
|
||||
- QuickCheck >= 2.8.2 && < 2.13,
|
||||
+ QuickCheck >= 2.8.2 && <3,
|
||||
HUnit >= 1.3 && < 1.7,
|
||||
test-framework >= 0.8.1.1 && < 0.9,
|
||||
test-framework-hunit >= 0.3.0.2 && < 0.4,
|
||||
test-framework-quickcheck2 >= 0.3.0.3 && < 0.4,
|
||||
- zip-archive >= 0.3 && < 0.5
|
||||
+ zip-archive >= 0.3 && <1
|
||||
|
||||
-- https://github.com/yesodweb/Shelly.hs/issues/177
|
||||
if os(windows)
|
||||
diff --git a/src/Darcs/Patch/Depends.hs b/src/Darcs/Patch/Depends.hs
|
||||
index 8531294..a4c71cb 100644
|
||||
--- a/src/Darcs/Patch/Depends.hs
|
||||
+++ b/src/Darcs/Patch/Depends.hs
|
||||
@@ -251,7 +251,7 @@ splitOnTag _ (PatchSet NilRL NilRL) = Nothing
|
||||
unwrapOneTagged :: (Monad m) => PatchSet rt p wX wY -> m (PatchSet rt p wX wY)
|
||||
unwrapOneTagged (PatchSet (ts :<: Tagged t _ tps) ps) =
|
||||
return $ PatchSet ts (tps :<: t +<+ ps)
|
||||
-unwrapOneTagged _ = fail "called unwrapOneTagged with no Tagged's in the set"
|
||||
+unwrapOneTagged _ = error "called unwrapOneTagged with no Tagged's in the set"
|
||||
|
||||
-- | @getUncovered ps@ returns the 'PatchInfo' for all the patches in
|
||||
-- @ps@ that are not depended on by anything else *through explicit
|
||||
diff --git a/src/Darcs/Patch/Match.hs b/src/Darcs/Patch/Match.hs
|
||||
index aba6c7a..2b6f53a 100644
|
||||
--- a/src/Darcs/Patch/Match.hs
|
||||
+++ b/src/Darcs/Patch/Match.hs
|
||||
@@ -421,7 +421,7 @@ getNonrangeMatchS fs repo =
|
||||
Just m -> if nonrangeMatcherIsTag fs
|
||||
then getTagS m repo
|
||||
else getMatcherS Exclusive m repo
|
||||
- Nothing -> fail "Pattern not specified in getNonrangeMatch."
|
||||
+ Nothing -> error "Pattern not specified in getNonrangeMatch."
|
||||
|
||||
-- | @firstMatch fs@ tells whether @fs@ implies a "first match", that
|
||||
-- is if we match against patches from a point in the past on, rather
|
||||
@@ -441,7 +441,7 @@ getFirstMatchS fs repo =
|
||||
Just (_,b) -> unpullLastN repo b -- b is chronologically earlier than a
|
||||
Nothing ->
|
||||
case firstMatcher fs of
|
||||
- Nothing -> fail "Pattern not specified in getFirstMatchS."
|
||||
+ Nothing -> error "Pattern not specified in getFirstMatchS."
|
||||
Just m -> if firstMatcherIsTag fs
|
||||
then getTagS m repo
|
||||
else getMatcherS Inclusive m repo
|
||||
@@ -462,7 +462,7 @@ checkMatchSyntax :: [MatchFlag] -> IO ()
|
||||
checkMatchSyntax opts =
|
||||
case getMatchPattern opts of
|
||||
Nothing -> return ()
|
||||
- Just p -> either fail (const $ return ()) (parseMatch p::Either String (MatchFun rt DummyPatch))
|
||||
+ Just p -> either error (const $ return ()) (parseMatch p::Either String (MatchFun rt DummyPatch))
|
||||
|
||||
getMatchPattern :: [MatchFlag] -> Maybe String
|
||||
getMatchPattern [] = Nothing
|
||||
@@ -718,7 +718,7 @@ getMatcherS :: (ApplyMonad (ApplyState p) m, Matchable p) =>
|
||||
getMatcherS ioe m repo =
|
||||
if matchExists m repo
|
||||
then applyInvToMatcher ioe m repo
|
||||
- else fail $ "Couldn't match pattern "++ show m
|
||||
+ else error $ "Couldn't match pattern "++ show m
|
||||
|
||||
getTagS :: (ApplyMonad (ApplyState p) m, MonadProgress m, Matchable p) =>
|
||||
Matcher rt p -> PatchSet rt p Origin wX -> m ()
|
||||
diff --git a/src/Darcs/Patch/PatchInfoAnd.hs b/src/Darcs/Patch/PatchInfoAnd.hs
|
||||
index 2da7ec8..1147410 100644
|
||||
--- a/src/Darcs/Patch/PatchInfoAnd.hs
|
||||
+++ b/src/Darcs/Patch/PatchInfoAnd.hs
|
||||
@@ -167,7 +167,7 @@ conscientiously er (PIAP pinf hp) =
|
||||
|
||||
-- | @hopefullyM@ is a version of @hopefully@ which calls @fail@ in a
|
||||
-- monad instead of erroring.
|
||||
-hopefullyM :: Monad m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB)
|
||||
+hopefullyM :: MonadFail m => PatchInfoAnd rt p wA wB -> m (WrappedNamed rt p wA wB)
|
||||
hopefullyM (PIAP pinf hp) = case hopefully2either hp of
|
||||
Right p -> return p
|
||||
Left e -> fail $ renderString
|
||||
diff --git a/src/Darcs/Patch/Prim/V1/Apply.hs b/src/Darcs/Patch/Prim/V1/Apply.hs
|
||||
index bea7e41..7984d21 100644
|
||||
--- a/src/Darcs/Patch/Prim/V1/Apply.hs
|
||||
+++ b/src/Darcs/Patch/Prim/V1/Apply.hs
|
||||
@@ -41,13 +41,13 @@ instance Apply Prim where
|
||||
apply (FP f (TokReplace t o n)) = mModifyFilePS f doreplace
|
||||
where doreplace fc =
|
||||
case tryTokReplace t (BC.pack o) (BC.pack n) fc of
|
||||
- Nothing -> fail $ "replace patch to " ++ fn2fp f
|
||||
+ Nothing -> error $ "replace patch to " ++ fn2fp f
|
||||
++ " couldn't apply."
|
||||
Just fc' -> return fc'
|
||||
apply (FP f (Binary o n)) = mModifyFilePS f doapply
|
||||
where doapply oldf = if o == oldf
|
||||
then return n
|
||||
- else fail $ "binary patch to " ++ fn2fp f
|
||||
+ else error $ "binary patch to " ++ fn2fp f
|
||||
++ " couldn't apply."
|
||||
apply (DP d AddDir) = mCreateDirectory d
|
||||
apply (DP d RmDir) = mRemoveDirectory d
|
||||
@@ -115,7 +115,7 @@ applyHunk f h fc =
|
||||
case applyHunkLines h fc of
|
||||
Right fc' -> return fc'
|
||||
Left msg ->
|
||||
- fail $
|
||||
+ error $
|
||||
"### Error applying:\n" ++ renderHunk h ++
|
||||
"\n### to file " ++ fn2fp f ++ ":\n" ++ BC.unpack fc ++
|
||||
"### Reason: " ++ msg
|
||||
diff --git a/src/Darcs/Patch/Prim/V1/Commute.hs b/src/Darcs/Patch/Prim/V1/Commute.hs
|
||||
index 7639dbd..e1432e6 100644
|
||||
--- a/src/Darcs/Patch/Prim/V1/Commute.hs
|
||||
+++ b/src/Darcs/Patch/Prim/V1/Commute.hs
|
||||
@@ -58,6 +58,7 @@ instance Monad Perhaps where
|
||||
Failed >>= _ = Failed
|
||||
Unknown >>= _ = Unknown
|
||||
return = Succeeded
|
||||
+instance MonadFail Perhaps where
|
||||
fail _ = Unknown
|
||||
|
||||
instance Alternative Perhaps where
|
||||
diff --git a/src/Darcs/Patch/ReadMonads.hs b/src/Darcs/Patch/ReadMonads.hs
|
||||
index 62a4f81..e1cb149 100644
|
||||
--- a/src/Darcs/Patch/ReadMonads.hs
|
||||
+++ b/src/Darcs/Patch/ReadMonads.hs
|
||||
@@ -237,6 +237,7 @@ failSM _ = SM (\_ -> Nothing)
|
||||
instance Monad SM where
|
||||
(>>=) = bindSM
|
||||
return = returnSM
|
||||
+instance MonadFail SM where
|
||||
fail = failSM
|
||||
|
||||
instance ParserM SM where
|
||||
diff --git a/src/Darcs/Patch/V1/Commute.hs b/src/Darcs/Patch/V1/Commute.hs
|
||||
index 0bb41a3..c6c3382 100644
|
||||
--- a/src/Darcs/Patch/V1/Commute.hs
|
||||
+++ b/src/Darcs/Patch/V1/Commute.hs
|
||||
@@ -93,6 +93,7 @@ instance Monad Perhaps where
|
||||
Failed >>= _ = Failed
|
||||
Unknown >>= _ = Unknown
|
||||
return = Succeeded
|
||||
+instance MonadFail Perhaps where
|
||||
fail _ = Unknown
|
||||
|
||||
instance Alternative Perhaps where
|
||||
diff --git a/src/Darcs/Repository/Diff.hs b/src/Darcs/Repository/Diff.hs
|
||||
index 8078d49..e0e2341 100644
|
||||
--- a/src/Darcs/Repository/Diff.hs
|
||||
+++ b/src/Darcs/Repository/Diff.hs
|
||||
@@ -138,7 +138,7 @@ treeDiff da ft t1 t2 = do
|
||||
do rmDirP <- diff p (Removed subtree)
|
||||
addFileP <- diff p (Changed (File emptyBlob) b')
|
||||
return $ joinGap (+>+) rmDirP addFileP
|
||||
- diff p _ = fail $ "Missing case at path " ++ show p
|
||||
+ diff p _ = error $ "Missing case at path " ++ show p
|
||||
|
||||
text_diff p a b
|
||||
| BL.null a && BL.null b = emptyGap NilFL
|
||||
diff --git a/src/Darcs/Repository/Match.hs b/src/Darcs/Repository/Match.hs
|
||||
index 08c9f13..f33cabe 100644
|
||||
--- a/src/Darcs/Repository/Match.hs
|
||||
+++ b/src/Darcs/Repository/Match.hs
|
||||
@@ -60,7 +60,7 @@ getNonrangeMatch :: (ApplyMonad (ApplyState p) DefaultIO, IsRepoType rt, RepoPat
|
||||
getNonrangeMatch r = withRecordedMatch r . getMatch where
|
||||
getMatch fs = case hasIndexRange fs of
|
||||
Just (n, m) | n == m -> applyNInv (n-1)
|
||||
- | otherwise -> fail "Index range is not allowed for this command."
|
||||
+ | otherwise -> error "Index range is not allowed for this command."
|
||||
_ -> getNonrangeMatchS fs
|
||||
|
||||
getOnePatchset :: (IsRepoType rt, RepoPatch p)
|
||||
diff --git a/src/Darcs/Util/Tree/Monad.hs b/src/Darcs/Util/Tree/Monad.hs
|
||||
index 0e01d9b..296fdc4 100644
|
||||
--- a/src/Darcs/Util/Tree/Monad.hs
|
||||
+++ b/src/Darcs/Util/Tree/Monad.hs
|
||||
@@ -216,7 +216,7 @@ instance (Monad m) => TreeRO (TreeMonad m) where
|
||||
t <- gets tree
|
||||
let f = findFile t p'
|
||||
case f of
|
||||
- Nothing -> fail $ "No such file " ++ show p'
|
||||
+ Nothing -> error $ "No such file " ++ show p'
|
||||
Just x -> lift (readBlob x)
|
||||
|
||||
currentDirectory = ask
|
||||
@@ -251,7 +251,7 @@ instance (Monad m) => TreeRW (TreeMonad m) where
|
||||
let item = find tr from'
|
||||
found_to = find tr to'
|
||||
unless (isNothing found_to) $
|
||||
- fail $ "Error renaming: destination " ++ show to ++ " exists."
|
||||
+ error $ "Error renaming: destination " ++ show to ++ " exists."
|
||||
unless (isNothing item) $ do
|
||||
modifyItem from Nothing
|
||||
modifyItem to item
|
||||
--
|
||||
2.23.1
|
||||
|
@ -0,0 +1,120 @@ |
||||
--- darcs-2.14.2/Setup.hs 2019-01-27 03:14:51.000000000 +1300
|
||||
+++ darcs.net/Setup.hs 2019-10-18 02:41:57.000000000 +1300
|
||||
@@ -11,7 +11,9 @@
|
||||
, TestSuite(testBuildInfo)
|
||||
, updatePackageDescription
|
||||
, cppOptions, ccOptions
|
||||
- , library, libBuildInfo, otherModules )
|
||||
+ , library, libBuildInfo, otherModules
|
||||
+ , ComponentName(CExeName)
|
||||
+ )
|
||||
import Distribution.Package
|
||||
( packageVersion )
|
||||
import Distribution.Version( Version )
|
||||
@@ -21,24 +23,27 @@
|
||||
import Distribution.Simple.Setup
|
||||
(buildVerbosity, copyDest, copyVerbosity, fromFlag,
|
||||
haddockVerbosity, installVerbosity, sDistVerbosity, replVerbosity )
|
||||
-import Distribution.Simple.BuildPaths ( autogenModulesDir )
|
||||
+import Distribution.Simple.BuildPaths ( autogenPackageModulesDir )
|
||||
import Distribution.System
|
||||
( OS(Windows), buildOS )
|
||||
import Distribution.Simple.Utils
|
||||
(copyFiles, createDirectoryIfMissingVerbose, rawSystemStdout,
|
||||
- rewriteFile )
|
||||
+ rewriteFileEx)
|
||||
+import Distribution.Types.UnqualComponentName
|
||||
import Distribution.Verbosity
|
||||
- ( Verbosity )
|
||||
+ ( Verbosity, silent )
|
||||
import Distribution.Text
|
||||
( display )
|
||||
-import Control.Monad ( unless, void )
|
||||
|
||||
+import Control.Monad ( unless, when, void )
|
||||
import System.Directory
|
||||
( doesDirectoryExist, doesFileExist )
|
||||
import System.IO
|
||||
( openFile, IOMode(..) )
|
||||
import System.Process (runProcess)
|
||||
import Data.List( isInfixOf, lines )
|
||||
+import qualified Data.Map as M
|
||||
+import Data.Maybe ( isJust )
|
||||
import System.FilePath ( (</>) )
|
||||
import Foreign.Marshal.Utils ( with )
|
||||
import Foreign.Storable ( peek )
|
||||
@@ -75,8 +80,8 @@
|
||||
verb = fromFlag $ sDistVerbosity flags
|
||||
x <- versionPatches verb pkgVer
|
||||
y <- context verb
|
||||
- rewriteFile "release/distributed-version" $ show x
|
||||
- rewriteFile "release/distributed-context" $ show y
|
||||
+ rewriteFileEx silent "release/distributed-version" $ show x
|
||||
+ rewriteFileEx silent "release/distributed-context" $ show y
|
||||
putStrLn "about to hand over"
|
||||
let pkg' = pkg { library = sanity (library pkg) }
|
||||
sanity (Just lib) = Just $ lib { libBuildInfo = sanity' $ libBuildInfo lib }
|
||||
@@ -105,8 +110,7 @@
|
||||
littleEndian <- testEndianness
|
||||
let args = ("-DPACKAGE_VERSION=" ++ show' version) :
|
||||
[arg | (arg, True) <- -- include fst iff snd.
|
||||
- [-- We have MAPI iff building on/for Windows.
|
||||
- ("-DHAVE_MAPI", buildOS == Windows),
|
||||
+ [
|
||||
("-DLITTLEENDIAN", littleEndian),
|
||||
("-DBIGENDIAN", not littleEndian)]]
|
||||
bi = emptyBuildInfo { cppOptions = args, ccOptions = args }
|
||||
@@ -133,20 +137,26 @@
|
||||
-- man page
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
+hasDarcsExe :: LocalBuildInfo -> Bool
|
||||
+hasDarcsExe = isJust . M.lookup darcsExe . componentNameMap where
|
||||
+ darcsExe = CExeName (mkUnqualComponentName "darcs")
|
||||
+
|
||||
buildManpage :: LocalBuildInfo -> IO ()
|
||||
-buildManpage lbi = do
|
||||
- let darcs = buildDir lbi </> "darcs/darcs"
|
||||
- manpage = buildDir lbi </> "darcs/darcs.1"
|
||||
- manpageHandle <- openFile manpage WriteMode
|
||||
- void $ runProcess darcs ["help","manpage"]
|
||||
- Nothing Nothing Nothing (Just manpageHandle) Nothing
|
||||
+buildManpage lbi =
|
||||
+ when (hasDarcsExe lbi) $ do
|
||||
+ let darcs = buildDir lbi </> "darcs/darcs"
|
||||
+ manpage = buildDir lbi </> "darcs/darcs.1"
|
||||
+ manpageHandle <- openFile manpage WriteMode
|
||||
+ void $ runProcess darcs ["help","manpage"]
|
||||
+ Nothing Nothing Nothing (Just manpageHandle) Nothing
|
||||
|
||||
-installManpage :: PackageDescription -> LocalBuildInfo
|
||||
- -> Verbosity -> CopyDest -> IO ()
|
||||
+installManpage :: PackageDescription -> LocalBuildInfo -> Verbosity -> CopyDest -> IO ()
|
||||
installManpage pkg lbi verbosity copy =
|
||||
- copyFiles verbosity
|
||||
- (mandir (absoluteInstallDirs pkg lbi copy) </> "man1")
|
||||
- [(buildDir lbi </> "darcs", "darcs.1")]
|
||||
+ when (hasDarcsExe lbi) $
|
||||
+ copyFiles
|
||||
+ verbosity
|
||||
+ (mandir (absoluteInstallDirs pkg lbi copy) </> "man1")
|
||||
+ [(buildDir lbi </> "darcs", "darcs.1")]
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- version module
|
||||
@@ -187,12 +197,13 @@
|
||||
generateVersionModule :: Verbosity -> LocalBuildInfo
|
||||
-> String -> String -> IO ()
|
||||
generateVersionModule verbosity lbi version state = do
|
||||
- let dir = autogenModulesDir lbi
|
||||
+ let dir = autogenPackageModulesDir lbi
|
||||
createDirectoryIfMissingVerbose verbosity True dir
|
||||
ctx <- context verbosity
|
||||
hash <- weakhash verbosity
|
||||
- rewriteFile (dir </> "Version.hs") $ unlines
|
||||
+ rewriteFileEx silent (dir </> "Version.hs") $ unlines
|
||||
["module Version where"
|
||||
+ ,"import Darcs.Prelude"
|
||||
,"version, weakhash, context :: String"
|
||||
,"version = \"" ++ version ++ " (" ++ state ++ ")\""
|
||||
,"weakhash = " ++ case hash of
|
Loading…
Reference in new issue