Debian > Debian GNU > Debian GNU/Hurd


This page attempts to be a reference for all resources related to Debian GNU/Hurd that can be useful for users and developers. Feel free to add more stuff as you see fit.

"In a discussion with the Debian Hurd porters it was decided that the Hurd port stays on FTPMaster until Wheezy is released. Should they have managed to get the port into a state that it is released together with all the others (probably as a technology preview), it is kept in the archive. Should they not manage this the port will be removed from the main archive and move fully to debian-ports.org."1

What is Debian GNU/Hurd ?

Debian GNU/Hurd is an operating system from Debian, but which uses GNU Hurd, which a set of servers, running on top of the GNU Mach microkernel instead of the kernel named Linux (thus the name Debian GNU/Hurd). Some day, most applications will exist both in Debian GNU/Hurd and in Debian GNU/Linux.

Basic info

Goals for releasing in wheezy

ghc

Follow http://hackage.haskell.org/trac/ghc/wiki/Building/Porting

Make sure to use the same path in the host and in the target for the compilation.

For the triplet, use i386-unknown-gnu. Better cross-build from an i386 host.

Don't use perl boot: the package is already "booted".

After having run make in the host and transferred the files to the target, fixes are needed in files libraries/unix/dist-install/build/System/Posix/*.hs, basically all lines postfixed by {-# LINE 334 "librari...}

Notably: the offsets in ./libraries/unix/dist-install/build/System/Posix/Files.hs, use the following instead, and fix allocation from 96 to 128.

    deviceID (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 4))
    {-# LINE 314 "libraries/unix/./System/Posix/Files.hsc" #-}
    fileID (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 12))
    {-# LINE 316 "libraries/unix/./System/Posix/Files.hsc" #-}
    fileMode (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 28))
    {-# LINE 318 "libraries/unix/./System/Posix/Files.hsc" #-}
    linkCount (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 32))
    {-# LINE 320 "libraries/unix/./System/Posix/Files.hsc" #-}
    fileOwner (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 36))
    {-# LINE 322 "libraries/unix/./System/Posix/Files.hsc" #-}
    fileGroup (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 40))
    {-# LINE 324 "libraries/unix/./System/Posix/Files.hsc" #-}
    specialDeviceID (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 24))
    {-# LINE 326 "libraries/unix/./System/Posix/Files.hsc" #-}
    fileSize (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 44))
    {-# LINE 328 "libraries/unix/./System/Posix/Files.hsc" #-}
    accessTime (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 52))
    {-# LINE 330 "libraries/unix/./System/Posix/Files.hsc" #-}
    modificationTime (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 60))
    {-# LINE 332 "libraries/unix/./System/Posix/Files.hsc" #-}
    statusChangeTime (FileStatus stat) =
      unsafePerformIO $ withForeignPtr stat $ ((\hsc_ptr -> peekByteOff hsc_ptr 68))
    {-# LINE 334 "libraries/unix/./System/Posix/Files.hsc" #-}

the values in libraries/unix/dist-install/build/System/Posix/IO.hs, use the following instead:

        flags =
           (if appendFlag    then (256)   else 0) .|.
    {-# LINE 189 "libraries/unix/./System/Posix/IO.hsc" #-}
           (if exclusiveFlag then (32)     else 0) .|.
    {-# LINE 190 "libraries/unix/./System/Posix/IO.hsc" #-}
           (if nocttyFlag    then (0)   else 0) .|.
    {-# LINE 191 "libraries/unix/./System/Posix/IO.hsc" #-}
           (if nonBlockFlag  then (8) else 0) .|.
    {-# LINE 192 "libraries/unix/./System/Posix/IO.hsc" #-}
           (if truncateFlag  then (65536)    else 0)
    {-# LINE 193 "libraries/unix/./System/Posix/IO.hsc" #-}
    
        (creat, mode_w) = case maybe_mode of
                            Nothing -> (0,0)
                            Just x  -> ((64), x)
    {-# LINE 197 "libraries/unix/./System/Posix/IO.hsc" #-}
    
        open_mode = case how of
                       ReadOnly  -> (1)
    {-# LINE 200 "libraries/unix/./System/Posix/IO.hsc" #-}
                       WriteOnly -> (2)
    {-# LINE 201 "libraries/unix/./System/Posix/IO.hsc" #-}
                       ReadWrite -> (3)
    {-# LINE 202 "libraries/unix/./System/Posix/IO.hsc" #-}

    fdOption2Int :: FdOption -> CInt
    fdOption2Int CloseOnExec       = (1)
    {-# LINE 320 "libraries/unix/./System/Posix/IO.hsc" #-}
    fdOption2Int AppendOnWrite     = (256)
    {-# LINE 321 "libraries/unix/./System/Posix/IO.hsc" #-}
    fdOption2Int NonBlockingRead   = (8)
    {-# LINE 322 "libraries/unix/./System/Posix/IO.hsc" #-}
    fdOption2Int SynchronousWrites = (1024)
    {-# LINE 323 "libraries/unix/./System/Posix/IO.hsc" #-}

    throwErrnoIfMinus1_ "getLock" (c_fcntl_lock fd (7) p_flock)

    allocaLock (lockreq, mode, start, len) io =
      allocaBytes (20) $ \p -> do
    {-# LINE 395 "libraries/unix/./System/Posix/IO.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 0))   p (lockReq2Int lockreq :: CShort)
    {-# LINE 396 "libraries/unix/./System/Posix/IO.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p (fromIntegral (mode2Int mode) :: CShort)
    {-# LINE 397 "libraries/unix/./System/Posix/IO.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 8))  p start
    {-# LINE 398 "libraries/unix/./System/Posix/IO.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 12))    p len
    {-# LINE 399 "libraries/unix/./System/Posix/IO.hsc" #-}
        io p

    lockReq2Int :: LockRequest -> CShort
    lockReq2Int ReadLock  = (1)
    {-# LINE 403 "libraries/unix/./System/Posix/IO.hsc" #-}
    lockReq2Int WriteLock = (2)
    {-# LINE 404 "libraries/unix/./System/Posix/IO.hsc" #-}
    lockReq2Int Unlock    = (3)
    {-# LINE 405 "libraries/unix/./System/Posix/IO.hsc" #-}

bytes2ProcessIDAndLock p = do
  req   <- ((\hsc_ptr -> peekByteOff hsc_ptr 0))   p
{-# LINE 409 "libraries/unix/./System/Posix/IO.hsc" #-}
  mode  <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
{-# LINE 410 "libraries/unix/./System/Posix/IO.hsc" #-}
  start <- ((\hsc_ptr -> peekByteOff hsc_ptr 8))  p
{-# LINE 411 "libraries/unix/./System/Posix/IO.hsc" #-}
  len   <- ((\hsc_ptr -> peekByteOff hsc_ptr 12))    p
{-# LINE 412 "libraries/unix/./System/Posix/IO.hsc" #-}
  pid   <- ((\hsc_ptr -> peekByteOff hsc_ptr 16))    p
{-# LINE 413 "libraries/unix/./System/Posix/IO.hsc" #-}
  return (pid, (int2req req, int2mode mode, start, len))

  int2req :: CShort -> LockRequest
  int2req (1) = ReadLock
{-# LINE 417 "libraries/unix/./System/Posix/IO.hsc" #-}
  int2req (2) = WriteLock
{-# LINE 418 "libraries/unix/./System/Posix/IO.hsc" #-}
  int2req (3) = Unlock
{-# LINE 419 "libraries/unix/./System/Posix/IO.hsc" #-}
  int2req _ = error $ "int2req: bad argument"

    throwErrnoIfMinus1_ "setLock" (c_fcntl_lock fd (8) p_flock)

        (c_fcntl_lock fd (9) p_flock)

libraries/unix/dist-install/build/System/Posix/Resource.hs

    hard <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p_rlimit

    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p_rlimit (packRLimit hard False)

packResource ResourceOpenFiles     = (8)

packResource ResourceTotalMemory   = (10)

unpackRLimit :: CRLim -> ResourceLimit
unpackRLimit (2147483647)  = ResourceLimitInfinity
{-# LINE 102 "libraries/unix/./System/Posix/Resource.hsc" #-}

{-# LINE 103 "libraries/unix/./System/Posix/Resource.hsc" #-}
-- unpackRLimit (4294967295) = ResourceLimitUnknown
{-# LINE 104 "libraries/unix/./System/Posix/Resource.hsc" #-}
-- unpackRLimit (4294967295) = ResourceLimitUnknown
{-# LINE 105 "libraries/unix/./System/Posix/Resource.hsc" #-}

packRLimit :: ResourceLimit -> Bool -> CRLim
packRLimit ResourceLimitInfinity _     = (2147483647)
{-# LINE 110 "libraries/unix/./System/Posix/Resource.hsc" #-}

{-# LINE 111 "libraries/unix/./System/Posix/Resource.hsc" #-}
--packRLimit ResourceLimitUnknown  True  = (4294967295)
{-# LINE 112 "libraries/unix/./System/Posix/Resource.hsc" #-}
--packRLimit ResourceLimitUnknown  False = (4294967295)
{-# LINE 113 "libraries/unix/./System/Posix/Resource.hsc" #-}

libraries/unix/dist-install/build/System/Posix/Semaphore.hs

    let cflags = (if semCreate flags then 16 else 0) .|.
{-# LINE 51 "libraries/unix/./System/Posix/Semaphore.hsc" #-}
                 (if semExclusive flags then 32 else 0)
{-# LINE 52 "libraries/unix/./System/Posix/Semaphore.hsc" #-}

libraries/unix/dist-install/build/System/Posix/Signals.hs

                    wstat <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) p

libraries/unix/dist-install/build/System/Posix/Terminal.hs

withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withoutMode termios InterruptOnBreak = clearInputFlag (2) termios
{-# LINE 148 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios MapCRtoLF = clearInputFlag (256) termios
{-# LINE 149 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios IgnoreBreak = clearInputFlag (1) termios
{-# LINE 150 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios IgnoreCR = clearInputFlag (128) termios
{-# LINE 151 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios IgnoreParityErrors = clearInputFlag (4) termios
{-# LINE 152 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios MapLFtoCR = clearInputFlag (64) termios
{-# LINE 153 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios CheckParity = clearInputFlag (16) termios
{-# LINE 154 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios StripHighBit = clearInputFlag (32) termios
{-# LINE 155 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios StartStopInput = clearInputFlag (1024) termios
{-# LINE 156 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios StartStopOutput = clearInputFlag (512) termios
{-# LINE 157 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios MarkParityErrors = clearInputFlag (8) termios
{-# LINE 158 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios ProcessOutput = clearOutputFlag (1) termios
{-# LINE 159 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios LocalMode = clearControlFlag (32768) termios
{-# LINE 160 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios ReadEnable = clearControlFlag (2048) termios
{-# LINE 161 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios TwoStopBits = clearControlFlag (1024) termios
{-# LINE 162 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios HangupOnClose = clearControlFlag (16384) termios
{-# LINE 163 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios EnableParity = clearControlFlag (4096) termios
{-# LINE 164 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios OddParity = clearControlFlag (8192) termios
{-# LINE 165 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios EnableEcho = clearLocalFlag (8) termios
{-# LINE 166 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios EchoErase = clearLocalFlag (2) termios
{-# LINE 167 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios EchoKill = clearLocalFlag (4) termios
{-# LINE 168 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios EchoLF = clearLocalFlag (16) termios
{-# LINE 169 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios ProcessInput = clearLocalFlag (256) termios
{-# LINE 170 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios ExtendedFunctions = clearLocalFlag (1024) termios
{-# LINE 171 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios KeyboardInterrupts = clearLocalFlag (128) termios
{-# LINE 172 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios NoFlushOnInterrupt = setLocalFlag (2147483648) termios
{-# LINE 173 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withoutMode termios BackgroundWriteInterrupt = clearLocalFlag (4194304) termios
{-# LINE 174 "libraries/unix/./System/Posix/Terminal.hsc" #-}

withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode termios InterruptOnBreak = setInputFlag (2) termios
{-# LINE 177 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios MapCRtoLF = setInputFlag (256) termios
{-# LINE 178 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios IgnoreBreak = setInputFlag (1) termios
{-# LINE 179 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios IgnoreCR = setInputFlag (128) termios
{-# LINE 180 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios IgnoreParityErrors = setInputFlag (4) termios
{-# LINE 181 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios MapLFtoCR = setInputFlag (64) termios
{-# LINE 182 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios CheckParity = setInputFlag (16) termios
{-# LINE 183 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios StripHighBit = setInputFlag (32) termios
{-# LINE 184 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios StartStopInput = setInputFlag (1024) termios
{-# LINE 185 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios StartStopOutput = setInputFlag (512) termios
{-# LINE 186 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios MarkParityErrors = setInputFlag (8) termios
{-# LINE 187 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios ProcessOutput = setOutputFlag (1) termios
{-# LINE 188 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios LocalMode = setControlFlag (32768) termios
{-# LINE 189 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios ReadEnable = setControlFlag (2048) termios
{-# LINE 190 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios TwoStopBits = setControlFlag (1024) termios
{-# LINE 191 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios HangupOnClose = setControlFlag (16384) termios
{-# LINE 192 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios EnableParity = setControlFlag (4096) termios
{-# LINE 193 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios OddParity = setControlFlag (8192) termios
{-# LINE 194 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios EnableEcho = setLocalFlag (8) termios
{-# LINE 195 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios EchoErase = setLocalFlag (2) termios
{-# LINE 196 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios EchoKill = setLocalFlag (4) termios
{-# LINE 197 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios EchoLF = setLocalFlag (16) termios
{-# LINE 198 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios ProcessInput = setLocalFlag (245) termios
{-# LINE 199 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios ExtendedFunctions = setLocalFlag (1024) termios
{-# LINE 200 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios KeyboardInterrupts = setLocalFlag (128) termios
{-# LINE 201 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios NoFlushOnInterrupt = clearLocalFlag (2147483648) termios
{-# LINE 202 "libraries/unix/./System/Posix/Terminal.hsc" #-}
withMode termios BackgroundWriteInterrupt = setLocalFlag (4194304) termios
{-# LINE 203 "libraries/unix/./System/Posix/Terminal.hsc" #-}

terminalMode :: TerminalMode -> TerminalAttributes -> Bool
terminalMode InterruptOnBreak = testInputFlag (2)
{-# LINE 206 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode MapCRtoLF = testInputFlag (256)
{-# LINE 207 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode IgnoreBreak = testInputFlag (1)
{-# LINE 208 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode IgnoreCR = testInputFlag (128)
{-# LINE 209 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode IgnoreParityErrors = testInputFlag (4)
{-# LINE 210 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode MapLFtoCR = testInputFlag (64)
{-# LINE 211 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode CheckParity = testInputFlag (16)
{-# LINE 212 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode StripHighBit = testInputFlag (32)
{-# LINE 213 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode StartStopInput = testInputFlag (1024)
{-# LINE 214 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode StartStopOutput = testInputFlag (512)
{-# LINE 215 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode MarkParityErrors = testInputFlag (8)
{-# LINE 216 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode ProcessOutput = testOutputFlag (1)
{-# LINE 217 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode LocalMode = testControlFlag (32768)
{-# LINE 218 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode ReadEnable = testControlFlag (2048)
{-# LINE 219 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode TwoStopBits = testControlFlag (1024)
{-# LINE 220 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode HangupOnClose = testControlFlag (16384)
{-# LINE 221 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode EnableParity = testControlFlag (4096)
{-# LINE 222 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode OddParity = testControlFlag (8192)
{-# LINE 223 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode EnableEcho = testLocalFlag (8)
{-# LINE 224 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode EchoErase = testLocalFlag (2)
{-# LINE 225 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode EchoKill = testLocalFlag (4)
{-# LINE 226 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode EchoLF = testLocalFlag (16)
{-# LINE 227 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode ProcessInput = testLocalFlag (256)
{-# LINE 228 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode ExtendedFunctions = testLocalFlag (1024)
{-# LINE 229 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode KeyboardInterrupts = testLocalFlag (128)
{-# LINE 230 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode NoFlushOnInterrupt = not . testLocalFlag (2147483648)
{-# LINE 231 "libraries/unix/./System/Posix/Terminal.hsc" #-}
terminalMode BackgroundWriteInterrupt = testLocalFlag (4194304)
{-# LINE 232 "libraries/unix/./System/Posix/Terminal.hsc" #-}

    return $! (word2Bits (cflag .&. (768)))
{-# LINE 238 "libraries/unix/./System/Posix/Terminal.hsc" #-}
  where
    word2Bits :: CTcflag -> Int
    word2Bits x =
        if x == (0) then 5
{-# LINE 242 "libraries/unix/./System/Posix/Terminal.hsc" #-}
        else if x == (256) then 6
{-# LINE 243 "libraries/unix/./System/Posix/Terminal.hsc" #-}
        else if x == (512) then 7
{-# LINE 244 "libraries/unix/./System/Posix/Terminal.hsc" #-}
        else if x == (768) then 8
{-# LINE 245 "libraries/unix/./System/Posix/Terminal.hsc" #-}
        else 0

    mask :: Int -> CTcflag
    mask 5 = (0)
{-# LINE 256 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    mask 6 = (256)
{-# LINE 257 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    mask 7 = (512)
{-# LINE 258 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    mask 8 = (768)
{-# LINE 259 "libraries/unix/./System/Posix/Terminal.hsc" #-}

controlChar termios cc = unsafePerformIO $ do
  withTerminalAttributes termios $ \p -> do
    let c_cc = ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p
{-# LINE 276 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    val <- peekElemOff c_cc (cc2Word cc)
    if val == ((255)::CCc)
{-# LINE 278 "libraries/unix/./System/Posix/Terminal.hsc" #-}
       then return Nothing
       else return (Just (chr (fromEnum val)))

withCC :: TerminalAttributes
       -> (ControlCharacter, Char)
       -> TerminalAttributes
withCC termios (cc, c) = unsafePerformIO $ do
  withNewTermios termios $ \p -> do
    let c_cc = ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p
{-# LINE 287 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    pokeElemOff c_cc (cc2Word cc) (fromIntegral (ord c) :: CCc)

withoutCC :: TerminalAttributes
          -> ControlCharacter
          -> TerminalAttributes
withoutCC termios cc = unsafePerformIO $ do
  withNewTermios termios $ \p -> do
    let c_cc = ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p
{-# LINE 295 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    pokeElemOff c_cc (cc2Word cc) ((255) :: CCc)
{-# LINE 296 "libraries/unix/./System/Posix/Terminal.hsc" #-}

inputTime :: TerminalAttributes -> Int
inputTime termios = unsafePerformIO $ do
  withTerminalAttributes termios $ \p -> do
    c <- peekElemOff (((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p) (17)
{-# LINE 301 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    return (fromEnum (c :: CCc))

withTime :: TerminalAttributes -> Int -> TerminalAttributes
withTime termios time = unsafePerformIO $ do
  withNewTermios termios $ \p -> do
    let c_cc = ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p
{-# LINE 307 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    pokeElemOff c_cc (17) (fromIntegral time :: CCc)
{-# LINE 308 "libraries/unix/./System/Posix/Terminal.hsc" #-}

minInput :: TerminalAttributes -> Int
minInput termios = unsafePerformIO $ do
  withTerminalAttributes termios $ \p -> do
    c <- peekElemOff (((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p) (16)
{-# LINE 313 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    return (fromEnum (c :: CCc))

withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
withMinInput termios count = unsafePerformIO $ do
  withNewTermios termios $ \p -> do
    let c_cc = ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) p
{-# LINE 319 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    pokeElemOff c_cc (16) (fromIntegral count :: CCc)
{-# LINE 320 "libraries/unix/./System/Posix/Terminal.hsc" #-}

    queue2Int :: QueueSelector -> CInt
    queue2Int InputQueue  = (1)
{-# LINE 444 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    queue2Int OutputQueue = (2)
{-# LINE 445 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    queue2Int BothQueues  = (3)
{-# LINE 446 "libraries/unix/./System/Posix/Terminal.hsc" #-}

    action2Int :: FlowAction -> CInt
    action2Int SuspendOutput = (1)
{-# LINE 465 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    action2Int RestartOutput = (2)
{-# LINE 466 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    action2Int TransmitStop  = (3)
{-# LINE 467 "libraries/unix/./System/Posix/Terminal.hsc" #-}
    action2Int TransmitStart = (4)
{-# LINE 468 "libraries/unix/./System/Posix/Terminal.hsc" #-}

cc2Word EndOfFile = (0)
{-# LINE 613 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word EndOfLine = (1)
{-# LINE 614 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Erase     = (3)
{-# LINE 615 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Interrupt = (8)
{-# LINE 616 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Kill      = (5)
{-# LINE 617 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Quit      = (9)
{-# LINE 618 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Suspend   = (10)
{-# LINE 619 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Start     = (12)
{-# LINE 620 "libraries/unix/./System/Posix/Terminal.hsc" #-}
cc2Word Stop      = (13)
{-# LINE 621 "libraries/unix/./System/Posix/Terminal.hsc" #-}

baud2Word :: BaudRate -> CSpeed
baud2Word B0 = (0)
{-# LINE 626 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B50 = (50)
{-# LINE 627 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B75 = (75)
{-# LINE 628 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B110 = (110)
{-# LINE 629 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B134 = (134)
{-# LINE 630 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B150 = (150)
{-# LINE 631 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B200 = (200)
{-# LINE 632 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B300 = (300)
{-# LINE 633 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B600 = (600)
{-# LINE 634 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B1200 = (1200)
{-# LINE 635 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B1800 = (1800)
{-# LINE 636 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B2400 = (2400)
{-# LINE 637 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B4800 = (4800)
{-# LINE 638 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B9600 = (9600)
{-# LINE 639 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B19200 = (19200)
{-# LINE 640 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B38400 = (38400)
{-# LINE 641 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B57600 = (57600)
{-# LINE 642 "libraries/unix/./System/Posix/Terminal.hsc" #-}
baud2Word B115200 = (115200)
{-# LINE 643 "libraries/unix/./System/Posix/Terminal.hsc" #-}

word2Baud :: CSpeed -> BaudRate
word2Baud x =
    if x == (0) then B0
    else if x == (50) then B50
    else if x == (75) then B75
    else if x == (110) then B110
    else if x == (134) then B134
    else if x == (150) then B150
    else if x == (200) then B200
    else if x == (300) then B300
    else if x == (600) then B600
    else if x == (1200) then B1200
    else if x == (1800) then B1800
    else if x == (2400) then B2400
    else if x == (4800) then B4800
    else if x == (9600) then B9600
    else if x == (19200) then B19200
    else if x == (38400) then B38400
    else if x == (57600) then B57600
    else if x == (115200) then B115200
    else error "unknown baud rate"

libraries/unix/dist-install/build/System/Posix/Unistd.hs

  allocaBytes (5120) $ \p_sid -> do
{-# LINE 73 "libraries/unix/./System/Posix/Unistd.hsc" #-}
    throwErrnoIfMinus1_ "getSystemID" (c_uname p_sid)
    sysN <- peekCString (((\hsc_ptr -> hsc_ptr `plusPtr` 0)) p_sid)
{-# LINE 75 "libraries/unix/./System/Posix/Unistd.hsc" #-}
    node <- peekCString (((\hsc_ptr -> hsc_ptr `plusPtr` 1024)) p_sid)
{-# LINE 76 "libraries/unix/./System/Posix/Unistd.hsc" #-}
    rel  <- peekCString (((\hsc_ptr -> hsc_ptr `plusPtr` 2048)) p_sid)
{-# LINE 77 "libraries/unix/./System/Posix/Unistd.hsc" #-}
    ver  <- peekCString (((\hsc_ptr -> hsc_ptr `plusPtr` 3072)) p_sid)
{-# LINE 78 "libraries/unix/./System/Posix/Unistd.hsc" #-}
    mach <- peekCString (((\hsc_ptr -> hsc_ptr `plusPtr` 4096)) p_sid)

And then run make again, and copy ./libraries/unix/dist-install/build/System/Posix/*.hc (but only these files) to the target.

In <T>/mk/build.mk, append -lffi to ghc_stage2_v_EXTRA_CC_OPTS and -lffi -lncurses -ltermcap to utils/ghc-pkg_dist-install_v_EXTRA_CC_OPTS

Goals for later

Developer info


CategoryPermalink

  1. http://lists.debian.org/debian-devel-announce/2011/03/msg00015.html - Debian pushes development of the Hurd port (1)