Hey, These patches are for libraries/unix. They may need some discussing, because I am not sure if this is the right thing.
1. On android the passwd struct does not define pw_gecos. The first patch therefor sets it to the empty string. 2. The android ndk does not define _POSIX_VDISABLE, but it defines _PC_VDISABLE. The second patch defines _POSIX_VDISABLE to _PC_VIDISABLE, which is (as I undestand it) what the POSIX programmer guide suggests. 3. The android ndk does not define telldir and seekdir. The third patch removes them when compiling for android.
>From 3d849692967fe4cd400f8579aa155136d21e72d9 Mon Sep 17 00:00:00 2001 From: Nathan <nathan.hues...@posteo.de> Date: Thu, 24 Jan 2013 15:38:20 +0100 Subject: [PATCH] Set pw_gecos to empty string on android, because it does not exist --- System/Posix/User.hsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index a62648d..2cf0dae 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -453,7 +453,11 @@ unpackUserEntry ptr = do passwd <- (#peek struct passwd, pw_passwd) ptr >>= peekCAString uid <- (#peek struct passwd, pw_uid) ptr gid <- (#peek struct passwd, pw_gid) ptr +#ifndef __ANDROID__ gecos <- (#peek struct passwd, pw_gecos) ptr >>= peekCAString +#else + gecos <- return "" -- pw_gecos does not exist on android +#endif dir <- (#peek struct passwd, pw_dir) ptr >>= peekCAString shell <- (#peek struct passwd, pw_shell) ptr >>= peekCAString return (UserEntry name passwd uid gid gecos dir shell) -- 1.7.10.4
>From cfcbd62cc3decb517eaf5082fdc3e6720f473210 Mon Sep 17 00:00:00 2001 From: Nathan <nathan.hues...@posteo.de> Date: Thu, 24 Jan 2013 15:39:52 +0100 Subject: [PATCH] Set _POSIX_VDISABLE to _PC_VDISABLE on android, because the former does not exist --- System/Posix/Terminal/Common.hsc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 5d718a8..74c1f44 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -267,6 +267,11 @@ data ControlCharacter | Stop -- VSTOP | Suspend -- VSUSP +#ifdef __ANDROID__ +-- the android ndk does not define this symbol +#define _POSIX_VDISABLE _PC_VDISABLE +#endif + controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char controlChar termios cc = unsafePerformIO $ do withTerminalAttributes termios $ \p -> do -- 1.7.10.4
>From e785f32384f12324e88b1f273fb6179f5426c75e Mon Sep 17 00:00:00 2001 From: Nathan <nathan.hues...@posteo.de> Date: Thu, 24 Jan 2013 15:40:52 +0100 Subject: [PATCH] Remove telldir and seekdir for android, because they do not exist --- System/Posix/Directory.hsc | 3 +++ System/Posix/Directory/ByteString.hsc | 3 +++ System/Posix/Directory/Common.hsc | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc index 71a70ce..5fcdca3 100644 --- a/System/Posix/Directory.hsc +++ b/System/Posix/Directory.hsc @@ -29,8 +29,11 @@ module System.Posix.Directory ( rewindDirStream, closeDirStream, DirStreamOffset, + -- no telldir/seekdir support on android +#ifndef __ANDROID__ tellDirStream, seekDirStream, +#endif -- * The working dirctory getWorkingDirectory, diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc index 3ac642b..1b191a2 100644 --- a/System/Posix/Directory/ByteString.hsc +++ b/System/Posix/Directory/ByteString.hsc @@ -29,8 +29,11 @@ module System.Posix.Directory.ByteString ( rewindDirStream, closeDirStream, DirStreamOffset, + -- No telldir/seekdir support on android +#ifndef __ANDROID__ tellDirStream, seekDirStream, +#endif -- * The working dirctory getWorkingDirectory, diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc index a608be3..4d78670 100644 --- a/System/Posix/Directory/Common.hsc +++ b/System/Posix/Directory/Common.hsc @@ -22,8 +22,11 @@ module System.Posix.Directory.Common ( DirStream(..), CDir, CDirent, DirStreamOffset(..), rewindDirStream, closeDirStream, + -- no telldir/seekdir support on android +#ifndef __ANDROID__ seekDirStream, tellDirStream, +#endif changeWorkingDirectoryFd, ) where @@ -57,6 +60,8 @@ foreign import ccall unsafe "closedir" newtype DirStreamOffset = DirStreamOffset COff +-- not supported on android +#ifndef __ANDROID__ seekDirStream :: DirStream -> DirStreamOffset -> IO () seekDirStream (DirStream dirp) (DirStreamOffset off) = c_seekdir dirp off @@ -71,6 +76,7 @@ tellDirStream (DirStream dirp) = do foreign import ccall unsafe "telldir" c_telldir :: Ptr CDir -> IO COff +#endif changeWorkingDirectoryFd :: Fd -> IO () changeWorkingDirectoryFd (Fd fd) = -- 1.7.10.4
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs