Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry-packages
html
Commits
8ae55c54
Commit
8ae55c54
authored
Sep 18, 2019
by
Michael Hanus
Browse files
Parameter "--system=path" added to enable selection of Curry system for compilation of web script
parent
71a60e33
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/MakeCGI.curry
View file @
8ae55c54
...
...
@@ -8,21 +8,36 @@
--- which does all the work.
---
--- @author Michael Hanus
--- @version
Nov
ember 201
8
--- @version
Sept
ember 201
9
------------------------------------------------------------------------------
module MakeCGI
where
import Directory ( doesFileExist )
import Distribution ( installDir )
import FilePath ( (</>) )
import FilePath ( (</>) )
import List ( isPrefixOf )
import System
import HTML.CGI.PackageConfig ( packagePath )
main :: IO ()
main = do
args <- getArgs
args0 <- getArgs
-- check whether option `--system=xxx` is provided:
let (args1,args2) = break ("--system=" `isPrefixOf`) args0
(root,args) = if null args2
then (installDir, args1)
else (drop 9 (head args2), args1 ++ tail args2)
checkCurrySystem root
rc <- system (unwords ((packagePath </> "scripts" </> "makecgi.sh") :
map (\s -> '"' : s ++ "\"") (
installDir
: args)))
map (\s -> '"' : s ++ "\"") (
root
: args)))
exitWith rc
checkCurrySystem :: String -> IO ()
checkCurrySystem currydir = do
let currybin = currydir </> "bin" </> "curry"
isexec <- doesFileExist currybin
unless isexec $
error $ "Curry system executable '" ++ currybin ++ "' does not exist!"
scripts/makecgi.sh
View file @
8ae55c54
...
...
@@ -83,7 +83,9 @@ if [ $# != 1 -a $# != 3 ] ; then
echo
"<curry> : name of the Curry program (without suffix) containing the script"
echo
echo
"FURTHER OPTIONS:"
echo
'-Dname=val : define (curry)rc property "name" as "val"'
echo
"--system=path: set path to the root of Curry system"
echo
" (then 'path/bin/curry' is invoked to compile script)"
echo
'-Dname=val : define (curry)rc property "name" as "val"'
echo
"--cpmexec <c>: set the command to execute programs with the Curry Package"
echo
" Manager (default: 'cypm exec')"
echo
"--compact : reduce size of generated cgi program by deleting unused functions"
...
...
@@ -177,7 +179,7 @@ else
fi
# compile main module:
echo
"Generating
saved stat
e for initial expression:
$MAIN
"
echo
"Generating
executabl
e for initial expression:
$MAIN
"
$CPMEXEC
$CURRYROOT
/bin/curry
--nocypm
$CURRYDOPTIONS
$CURRYOPTIONS
:l
$MAINMOD
:save
$MAINCALL
:q
# now the file $MAINMOD should contain the executable computing the HTML form:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment