[commit: ghc] wip/angerman/win32-cross-2: Adds iserv-slave (via CLI) (8fc0614)

git at git.haskell.org git at git.haskell.org
Wed Mar 7 05:39:12 UTC 2018


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

On branch  : wip/angerman/win32-cross-2
Link       : http://ghc.haskell.org/trac/ghc/changeset/8fc0614f46434b786cc3a746e329ccc403bff72f/ghc

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

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

    Adds iserv-slave (via CLI)


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

8fc0614f46434b786cc3a746e329ccc403bff72f
 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