[arch-commits] Commit in ihaskell/repos (3 files)

Felix Yan felixonmars at gemini.archlinux.org
Wed Aug 31 20:26:44 UTC 2022


    Date: Wednesday, August 31, 2022 @ 20:26:44
  Author: felixonmars
Revision: 1289380

archrelease: copy trunk to community-staging-x86_64

Added:
  ihaskell/repos/community-staging-x86_64/
  ihaskell/repos/community-staging-x86_64/PKGBUILD
    (from rev 1289379, ihaskell/trunk/PKGBUILD)
  ihaskell/repos/community-staging-x86_64/enable-dynamic-way.patch
    (from rev 1289379, ihaskell/trunk/enable-dynamic-way.patch)

--------------------------+
 PKGBUILD                 |   68 +++++++++++++++++++++++++++++++++
 enable-dynamic-way.patch |   92 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+)

Copied: ihaskell/repos/community-staging-x86_64/PKGBUILD (from rev 1289379, ihaskell/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2022-08-31 20:26:44 UTC (rev 1289380)
@@ -0,0 +1,68 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Martin Rodriguez Reboredo <yakoyoku at gmail.com>
+
+pkgname=ihaskell
+pkgver=0.10.2.2
+pkgrel=11
+pkgdesc="A Haskell backend kernel for the IPython project."
+url="http://github.com/gibiansky/IHaskell"
+license=("MIT")
+arch=('x86_64')
+depends=('ghc-libs' 'ipython' 'python-jupyter_client' 'haskell-aeson' 'haskell-base64-bytestring'
+         'haskell-cmdargs' 'haskell-ghc' 'haskell-ghc-parser' 'haskell-ghc-paths' 'hlint'
+         'haskell-http-client' 'haskell-http-client-tls' 'haskell-ipython-kernel' 'haskell-random'
+         'haskell-shelly' 'haskell-split' 'haskell-strict' 'haskell-unordered-containers'
+         'haskell-utf8-string' 'haskell-vector')
+makedepends=('ghc' 'haskell-hunit' 'haskell-here' 'haskell-hspec' 'haskell-hspec-contrib'
+             'haskell-raw-strings-qq' 'haskell-setenv')
+source=("https://hackage.haskell.org/packages/archive/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz"
+        enable-dynamic-way.patch)
+sha256sums=('09f10f3007d892d811a5de2567399078e9ef1e612e0c4997619c909d82849ed1'
+            '043a8c6f32f48923127216e337d0b8a6b63207dbd9c4ccac7029535dc874cab8')
+
+prepare() {
+  cd $pkgname-$pkgver
+  patch -p1 -i ../enable-dynamic-way.patch
+}
+
+build() {
+  cd $pkgname-$pkgver
+
+  runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
+    --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname --enable-tests \
+    --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm \
+    --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
+    --ghc-option='-pie' \
+    -fuse-hlint
+
+  runhaskell Setup build $MAKEFLAGS
+  runhaskell Setup register --gen-script
+  runhaskell Setup unregister --gen-script
+  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+check() {
+  cd $pkgname-$pkgver
+  GHC_PACKAGE_PATH="$PWD/dist/package.conf.inplace:$(ghc --print-global-package-db)" \
+    runhaskell Setup test --show-details=direct
+}
+
+package() {
+  cd $pkgname-$pkgver
+
+  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
+  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
+  runhaskell Setup copy --destdir="$pkgdir"
+  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
+  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
+
+  PATH="$pkgdir/usr/bin:$PATH" \
+  LD_LIBRARY_PATH="$pkgdir"/usr/lib \
+  ihaskell_datadir="$pkgdir"/usr/share/ihaskell \
+    "$pkgdir"/usr/bin/ihaskell install --prefix="$pkgdir"/usr
+  sed -i "s|$pkgdir||" "$pkgdir"/usr/share/jupyter/kernels/haskell/kernel.json
+
+  install -dm755 "$pkgdir"/usr/share/jupyter/labextensions
+  ln -s /usr/share/ihaskell/jupyterlab-ihaskell/labextension "$pkgdir"/usr/share/jupyter/labextensions/jupyterlab-ihaskell
+}

Copied: ihaskell/repos/community-staging-x86_64/enable-dynamic-way.patch (from rev 1289379, ihaskell/trunk/enable-dynamic-way.patch)
===================================================================
--- community-staging-x86_64/enable-dynamic-way.patch	                        (rev 0)
+++ community-staging-x86_64/enable-dynamic-way.patch	2022-08-31 20:26:44 UTC (rev 1289380)
@@ -0,0 +1,92 @@
+commit d03b9eb85f7a32683806f0bb1e29fac856a451e1
+Author: Martin Reboredo <yakoyoku at gmail.com>
+Date:   Tue Jul 19 18:05:17 2022 -0300
+
+    Dynamic way for dynamically linked RTS
+
+diff --git a/src/IHaskell/Eval/Util.hs b/src/IHaskell/Eval/Util.hs
+index dea936d..f2579f0 100644
+--- a/src/IHaskell/Eval/Util.hs
++++ b/src/IHaskell/Eval/Util.hs
+@@ -9,6 +9,7 @@ module IHaskell.Eval.Util (
+     setExtension,
+     ExtFlag(..),
+     setFlags,
++    setWayDynFlag,
+ 
+     -- * Code Evaluation
+     evalImport,
+@@ -42,6 +43,7 @@ import           GHC.Driver.Monad (modifySession)
+ import           GHC.Driver.Ppr
+ import           GHC.Driver.Session
+ import           GHC.Driver.Env.Types
++import           GHC.Platform.Ways (Way(..), hostIsDynamic)
+ import           GHC.Runtime.Context
+ import           GHC.Types.Name (pprInfixName)
+ import           GHC.Types.Name.Set
+@@ -58,6 +60,7 @@ import           GHC.Driver.CmdLine
+ import           GHC.Driver.Monad (modifySession)
+ import           GHC.Driver.Session
+ import           GHC.Driver.Types
++import           GHC.Driver.Ways (Way(..), hostIsDynamic)
+ import           GHC.Types.Name (pprInfixName)
+ import           GHC.Types.Name.Set
+ import qualified GHC.Driver.Session as DynFlags
+@@ -119,6 +122,24 @@ extensionFlag ext =
+     -- Check if a FlagSpec matches "No<ExtensionName>". In that case, we disable the extension.
+     flagMatchesNo ex fs = ex == "No" ++ flagSpecName fs
+ 
++-- | Consult the RTS to find if GHC has been built with dynamic linking and then turn on the
++-- dynamic way for GHC. Otherwise it does nothing.
++setWayDynFlag :: DynFlags
++              -> DynFlags
++setWayDynFlag =
++  if hostIsDynamic
++  then addWay WayDyn
++  else id
++#if MIN_VERSION_ghc(9,2,0)
++#else
++  where
++    addWay = addWay'
++#if MIN_VERSION_ghc(9,0,0)
++#else
++    hostIsDynamic = dynamicGhc
++#endif
++#endif
++
+ -- | Pretty-print dynamic flags (taken from 'InteractiveUI' module of `ghc-bin`)
+ pprDynFlags :: Bool       -- ^ Whether to include flags which are on by default
+             -> DynFlags
+@@ -332,7 +353,7 @@ initGhci sandboxPackages = do
+ #endif
+   let flag = flip xopt_set
+       unflag = flip xopt_unset
+-      dflags = flag ExtendedDefaultRules . unflag MonomorphismRestriction $ originalFlags
++      dflags = flag ExtendedDefaultRules . unflag MonomorphismRestriction $ setWayDynFlag originalFlags
+ #if MIN_VERSION_ghc(8,2,0)
+       pkgFlags =
+         case sandboxPackages of
+diff --git a/src/tests/IHaskell/Test/Completion.hs b/src/tests/IHaskell/Test/Completion.hs
+index e70629e..8892bf2 100644
+--- a/src/tests/IHaskell/Test/Completion.hs
++++ b/src/tests/IHaskell/Test/Completion.hs
+@@ -30,6 +30,7 @@ import           Shelly (toTextIgnore, (</>), shelly, fromText, get_env_text, Fi
+ import           IHaskell.Eval.Evaluate (Interpreter, liftIO)
+ import           IHaskell.Eval.Completion (complete, CompletionType(..), completionType,
+                                            completionTarget)
++import           IHaskell.Eval.Util (setWayDynFlag)
+ import           IHaskell.Test.Util (replace, shouldBeAmong, ghc)
+ 
+ -- | @readCompletePrompt "xs*ys"@ return @(xs, i)@ where i is the location of
+@@ -67,9 +68,9 @@ initCompleter :: Interpreter ()
+ initCompleter = do
+   flags <- getSessionDynFlags
+ #if MIN_VERSION_ghc(9,2,0)
+-  _ <- setSessionDynFlags $ flags { backend = Interpreter, ghcLink = LinkInMemory }
++  _ <- setSessionDynFlags $ setWayDynFlag flags { backend = Interpreter, ghcLink = LinkInMemory }
+ #else
+-  _ <- setSessionDynFlags $ flags { hscTarget = HscInterpreted, ghcLink = LinkInMemory }
++  _ <- setSessionDynFlags $ setWayDynFlag flags { hscTarget = HscInterpreted, ghcLink = LinkInMemory }
+ #endif
+ 
+   -- Import modules.



More information about the arch-commits mailing list