[arch-commits] Commit in haskell-cmark-gfm/trunk (PKGBUILD system-cmark-gfm.patch)

Felix Yan felixonmars at archlinux.org
Mon Aug 20 06:47:37 UTC 2018


    Date: Monday, August 20, 2018 @ 06:47:37
  Author: felixonmars
Revision: 372819

add a patch for using system cmark-gfm

Added:
  haskell-cmark-gfm/trunk/system-cmark-gfm.patch
Modified:
  haskell-cmark-gfm/trunk/PKGBUILD

------------------------+
 PKGBUILD               |    6 +++--
 system-cmark-gfm.patch |   55 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-08-20 06:41:41 UTC (rev 372818)
+++ PKGBUILD	2018-08-20 06:47:37 UTC (rev 372819)
@@ -12,12 +12,14 @@
 arch=('x86_64')
 depends=('ghc-libs' 'cmark-gfm')
 makedepends=('ghc' 'haskell-hunit')
-source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz")
+source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+        system-cmark-gfm.patch)
 sha512sums=('34e914039b385b66859b9438330619c9d0895ed8a71b4de38c66a3bbcc8bf1fafb663afb5e3c8d2ae897351c5fba204ddf44017644860578721946f1a184ecd3')
 
 prepare() {
+    cd $_hkgname-$pkgver
     # https://github.com/kivikakk/cmark-gfm-hs/issues/8
-    sed -i 's/pkgconfig-depends: libcmark-gfm/Extra-Libraries: cmark-gfm cmark-gfmextensions/' $_hkgname-$pkgver/$_hkgname.cabal
+    patch -p1 -i ../system-cmark-gfm.patch
 }
 
 build() {

Added: system-cmark-gfm.patch
===================================================================
--- system-cmark-gfm.patch	                        (rev 0)
+++ system-cmark-gfm.patch	2018-08-20 06:47:37 UTC (rev 372819)
@@ -0,0 +1,55 @@
+commit ff75a191f067ceac00f4edc065cc1317d69d81ba
+Author: Felix Yan <felixonmars at archlinux.org>
+Date:   Mon Aug 20 14:44:55 2018 +0800
+
+    Fix build with system cmark-gfm (fixes #8)
+    
+    Use the public interface cmark_get_default_mem_allocator instead of
+    private CMARK_DEFAULT_MEM_ALLOCATOR.
+
+diff --git a/CMarkGFM.hsc b/CMarkGFM.hsc
+index 6bd4fce..a39579c 100644
+--- a/CMarkGFM.hsc
++++ b/CMarkGFM.hsc
+@@ -58,7 +58,7 @@ ensurePluginsRegistered = c_core_extensions_ensure_registered
+ 
+ -- | Frees a cmark linked list, produced by extsToLlist.
+ freeLlist :: LlistPtr a -> IO ()
+-freeLlist = c_cmark_llist_free c_CMARK_DEFAULT_MEM_ALLOCATOR
++freeLlist = c_cmark_llist_free c_cmark_mem
+ 
+ -- | Converts a list of resolved extension pointers to a single cmark
+ -- linked list, which can be passed to functions requiring a list of
+@@ -67,7 +67,7 @@ extsToLlist :: [ExtensionPtr] -> IO (LlistPtr ExtensionPtr)
+ extsToLlist [] = return nullPtr
+ extsToLlist (h:t) = do
+   t' <- extsToLlist t
+-  c_cmark_llist_append c_CMARK_DEFAULT_MEM_ALLOCATOR t' (castPtr h)
++  c_cmark_llist_append c_cmark_mem t' (castPtr h)
+ 
+ -- | Resolves CMarkExtensions to pointers.
+ resolveExts :: [CMarkExtension] -> IO [ExtensionPtr]
+@@ -633,8 +633,8 @@ foreign import ccall "cmark.h cmark_llist_append"
+ foreign import ccall "cmark.h cmark_llist_free"
+     c_cmark_llist_free :: MemPtr -> LlistPtr a -> IO ()
+ 
+-foreign import ccall "cmark.h &CMARK_DEFAULT_MEM_ALLOCATOR"
+-    c_CMARK_DEFAULT_MEM_ALLOCATOR :: MemPtr
++foreign import ccall "cmark.h cmark_get_default_mem_allocator"
++    c_cmark_mem :: MemPtr
+ 
+ foreign import ccall "cmark_extension_api.h cmark_parser_attach_syntax_extension"
+     c_cmark_parser_attach_syntax_extension :: ParserPtr -> ExtensionPtr -> IO ()
+diff --git a/cmark-gfm.cabal b/cmark-gfm.cabal
+index afe9d1c..6dec4a8 100644
+--- a/cmark-gfm.cabal
++++ b/cmark-gfm.cabal
+@@ -74,7 +74,7 @@ library
+   default-language:    Haskell2010
+   ghc-options:         -Wall -fno-warn-unused-do-bind
+   if flag(pkgconfig)
+-    pkgconfig-depends: libcmark-gfm
++    Extra-Libraries: cmark-gfm cmark-gfmextensions
+   else
+     cc-options:        -Wall -std=c99
+     Include-dirs:      cbits



More information about the arch-commits mailing list