On Tue, Jan 19, 2016 at 08:43:17PM +0100, Matthias Kilian wrote: > > Below is a hopefully correct and more complete diff. Again without > > bump because I'll also merge -main and -doc. > > Famous last words. I missed the plist changes. Will send a new diff > later (at the moment i'm rebuilding ghc).
Here it is. Works fine for me, so I'm going to commit this in a few hours. Index: Makefile =================================================================== RCS file: /cvs/ports/lang/ghc/Makefile,v retrieving revision 1.131 diff -u -p -r1.131 Makefile --- Makefile 28 Dec 2015 19:18:52 -0000 1.131 +++ Makefile 20 Jan 2016 04:24:09 -0000 @@ -157,6 +157,11 @@ PORTHOME = ${WRKDIR} TEST_DEPENDS = print/ghostscript/gnu +post-extract: + cd ${WRKSRC}/libraries/unix && \ + mkdir -p System/OpenBSD && \ + install -m 644 ${FILESDIR}/Process.hsc System/OpenBSD + post-patch: # - Install a precompiled binary. cd ${WRKDIR}/ghc-${BIN_VER} && \ Index: files/Process.hsc =================================================================== RCS file: files/Process.hsc diff -N files/Process.hsc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/Process.hsc 20 Jan 2016 04:24:09 -0000 @@ -0,0 +1,26 @@ +{-# LANGUAGE Safe #-} + +module System.OpenBSD.Process ( pledge ) where + +import Foreign +import Foreign.C +import System.Posix.Internals ( withFilePath ) + +pledge :: String -> Maybe [FilePath] -> IO () + +pledge promises paths = + withCString promises $ \cproms -> + withPaths2Array0 paths $ \paths_arr -> + throwErrnoIfMinus1_ "pledge" (c_pledge cproms paths_arr) + +withPaths2Array0 :: Maybe [FilePath] -> (Ptr (Ptr CChar) -> IO a) -> IO a + +withPaths2Array0 Nothing f = f nullPtr + +withPaths2Array0 (Just paths) f = + withMany withFilePath paths $ \cstrs -> + withArray0 nullPtr cstrs $ \paths_arr -> + f paths_arr + +foreign import ccall unsafe "unistd.h pledge" + c_pledge :: CString -> Ptr CString -> IO CInt Index: patches/patch-libraries_unix_unix_cabal =================================================================== RCS file: patches/patch-libraries_unix_unix_cabal diff -N patches/patch-libraries_unix_unix_cabal --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-libraries_unix_unix_cabal 20 Jan 2016 04:24:09 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- libraries/unix/unix.cabal.orig Sun Jan 4 23:56:26 2015 ++++ libraries/unix/unix.cabal Tue Jan 19 00:42:33 2016 +@@ -109,6 +109,8 @@ library + System.Posix.Terminal + System.Posix.Terminal.ByteString + ++ System.OpenBSD.Process ++ + other-modules: + System.Posix.Directory.Common + System.Posix.DynamicLinker.Common Index: pkg/PLIST-main =================================================================== RCS file: /cvs/ports/lang/ghc/pkg/PLIST-main,v retrieving revision 1.17 diff -u -p -r1.17 PLIST-main --- pkg/PLIST-main 2 Nov 2015 21:31:26 -0000 1.17 +++ pkg/PLIST-main 20 Jan 2016 04:24:09 -0000 @@ -2228,6 +2228,9 @@ lib/ghc/trans_${TRANSFORMERS_KEY}/libHSt lib/ghc/unix_${UNIX_KEY}/ lib/ghc/unix_${UNIX_KEY}/HSunix-${UNIX_VER}-${UNIX_KEY}.o lib/ghc/unix_${UNIX_KEY}/System/ +lib/ghc/unix_${UNIX_KEY}/System/OpenBSD/ +lib/ghc/unix_${UNIX_KEY}/System/OpenBSD/Process.hi +lib/ghc/unix_${UNIX_KEY}/System/OpenBSD/Process.p_hi lib/ghc/unix_${UNIX_KEY}/System/Posix/ lib/ghc/unix_${UNIX_KEY}/System/Posix.hi lib/ghc/unix_${UNIX_KEY}/System/Posix.p_hi