feat(ghc-libs): link against libandroid-posix-semaphore
GHC unix lib uses `ccall` ffi which ignores include indirection. It directly links against available symbols during compile. Although, directly linking to `libandroid-posix-semaphore` should work too, but that depends upon library load order during runtime, i.e if `libc` is loaded before (very unlikely, unless LD_PRELOAD is set) `libandroid-posix-semaphore`, it would use sem_{open,close,unlink} from it, which isn't implemented. So, to be sure that it always links against `libandroid-posix-semaphore` symbols, I have patched it to use `capi` ffi which considers include indirections. Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
parent
462926e99c
commit
3165e3c2f4
|
@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="The Glasgow Haskell Compiler - Dynamic Libraries"
|
|||
TERMUX_PKG_LICENSE="BSD 2-Clause, BSD 3-Clause, LGPL-2.1"
|
||||
TERMUX_PKG_MAINTAINER="Aditya Alok <dev.aditya.alok@gmail.com>"
|
||||
TERMUX_PKG_VERSION=8.10.7
|
||||
TERMUX_PKG_REVISION=2
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_SRCURL="https://downloads.haskell.org/~ghc/${TERMUX_PKG_VERSION}/ghc-${TERMUX_PKG_VERSION}-src.tar.xz"
|
||||
TERMUX_PKG_SHA256=e3eef6229ce9908dfe1ea41436befb0455fefb1932559e860ad4c606b0d03c9d
|
||||
TERMUX_PKG_DEPENDS="iconv, libffi, ncurses, libgmp"
|
||||
TERMUX_PKG_DEPENDS="iconv, libffi, ncurses, libgmp, libandroid-posix-semaphore"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
--disable-ld-override
|
||||
|
@ -77,7 +77,7 @@ termux_step_pre_configure() {
|
|||
SRC_HC_OPTS = -O -H64m
|
||||
GhcStage1HcOpts = -O
|
||||
GhcStage2HcOpts = ${EXTRA_FLAGS}
|
||||
GhcLibHcOpts = ${EXTRA_FLAGS}
|
||||
GhcLibHcOpts = ${EXTRA_FLAGS} -optl-landroid-posix-semaphore
|
||||
BuildFlavour = quick-cross
|
||||
GhcLibWays = v dyn
|
||||
STRIP_CMD = ${STRIP}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
--- ghc-8.10.7/libraries/unix/System/Posix/Semaphore.hsc 2020-04-19 14:47:09.000000000 +0530
|
||||
+++ ghc-8.10.7-patch/libraries/unix/System/Posix/Semaphore.hsc 2022-04-11 12:43:10.193206043 +0530
|
||||
@@ -3,6 +3,7 @@
|
||||
#else
|
||||
{-# LANGUAGE Trustworthy #-}
|
||||
#endif
|
||||
+{-# LANGUAGE CApiFFI #-}
|
||||
-----------------------------------------------------------------------------
|
||||
-- |
|
||||
-- Module : System.Posix.Semaphore
|
||||
@@ -114,11 +115,11 @@
|
||||
cint <- peek ptr
|
||||
return $ fromEnum cint
|
||||
|
||||
-foreign import ccall safe "sem_open"
|
||||
+foreign import capi safe "semaphore.h sem_open"
|
||||
sem_open :: CString -> CInt -> CMode -> CUInt -> IO (Ptr ())
|
||||
-foreign import ccall safe "sem_close"
|
||||
+foreign import capi safe "semaphore.h sem_close"
|
||||
sem_close :: Ptr () -> IO CInt
|
||||
-foreign import ccall safe "sem_unlink"
|
||||
+foreign import capi safe "semaphore.h sem_unlink"
|
||||
sem_unlink :: CString -> IO CInt
|
||||
|
||||
foreign import ccall safe "sem_wait"
|
Loading…
Reference in New Issue