[commit: ghc] wip/angerman/win32-cross: Adds iserv-slave (via CLI) (6faf0e6)

git at git.haskell.org git at git.haskell.org
Tue Mar 13 04:15:09 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/angerman/win32-cross
Link       : http://ghc.haskell.org/trac/ghc/changeset/6faf0e6650bc9b8217d541be32f01dc2b092ab8e/ghc

>---------------------------------------------------------------

commit 6faf0e6650bc9b8217d541be32f01dc2b092ab8e
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Wed Mar 7 13:38:09 2018 +0800

    Adds iserv-slave (via CLI)


>---------------------------------------------------------------

6faf0e6650bc9b8217d541be32f01dc2b092ab8e
 utils/{iserv-proxy => iserv-slave}/cabal.project |  0
 utils/iserv-slave/iserv-slave.cabal              | 20 ++++++++++++++++
 utils/iserv-slave/src/Cli.hs                     | 30 ++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/utils/iserv-proxy/cabal.project b/utils/iserv-slave/cabal.project
similarity index 100%
copy from utils/iserv-proxy/cabal.project
copy to utils/iserv-slave/cabal.project
diff --git a/utils/iserv-slave/iserv-slave.cabal b/utils/iserv-slave/iserv-slave.cabal
new file mode 100644
index 0000000..66a2a32
--- /dev/null
+++ b/utils/iserv-slave/iserv-slave.cabal
@@ -0,0 +1,20 @@
+Name: iserv-slave
+Version: 8.5
+Copyright: XXX
+License: BSD3
+-- XXX License-File: LICENSE
+Author: XXX
+Maintainer: XXX
+Synopsis: iserv allows GHC to delegate Tempalte Haskell computations
+Description:
+Category: Development
+build-type: Simple
+cabal-version: >=1.10
+
+Executable iserv-slave
+   Default-Language: Haskell2010
+   Main-Is: Cli.hs
+   Hs-Source-Dirs: src
+   Build-Depends:
+                  base       >= 4   && < 5,
+                  libiserv   == 8.5
diff --git a/utils/iserv-slave/src/Cli.hs b/utils/iserv-slave/src/Cli.hs
new file mode 100644
index 0000000..8a3a34f
--- /dev/null
+++ b/utils/iserv-slave/src/Cli.hs
@@ -0,0 +1,30 @@
+module Main where
+
+import System.Environment (getProgName, getArgs)
+import System.Exit        (die)
+import Remote.Slave       (startSlave')
+
+main :: IO ()
+main = getArgs >>= startSlave
+
+dieWithUsage :: IO a
+dieWithUsage = do
+	prog <- getProgName
+	die $ prog  ++ ": " ++ msg
+  where
+  	msg = "usage: iserv-slave /path/to/storage PORT [-v]"
+
+startSlave :: [String] -> IO ()
+startSlave args0
+	| "--help" `elem` args0 = dieWithUsage
+	| otherwise = do
+		(path, port, rest) <- case args0 of
+			arg0:arg1:rest -> return (arg0, read arg1, rest)
+			_              -> dieWithUsage
+		verbose <- case rest of
+			["-v"] -> return True
+			[]     -> return False
+			_      -> dieWithUsage
+
+		startSlave' verbose path port
+



More information about the ghc-commits mailing list