forked from GitHub/gf-core
move gf.cabal and all compiler dependent files into src/compiler
This commit is contained in:
35
Makefile
35
Makefile
@@ -18,22 +18,31 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
dist/setup-config: gf.cabal Setup.hs WebSetup.hs
|
||||
ifneq ($(STACK),1)
|
||||
cabal ${CMD_PFX}configure
|
||||
endif
|
||||
|
||||
build: dist/setup-config
|
||||
${CMD} ${CMD_PFX}build
|
||||
|
||||
install:
|
||||
all: src/runtime/c/libpgf.la src/runtime/haskell/dist/setup-config src/compiler/dist/setup-config
|
||||
ifeq ($(STACK),1)
|
||||
stack install
|
||||
else
|
||||
cabal ${CMD_PFX}copy
|
||||
cabal ${CMD_PFX}register
|
||||
(cd src/runtime/haskell; ${CMD} ${CMD_PFX}install)
|
||||
(cd src/compiler; ${CMD} ${CMD_PFX}install)
|
||||
endif
|
||||
|
||||
src/runtime/c/libpgf.la: src/runtime/c/Makefile
|
||||
(cd src/runtime/c; make; sudo make install)
|
||||
|
||||
src/runtime/c/Makefile: src/runtime/c/Makefile.in src/runtime/c/configure
|
||||
(cd src/runtime/c; ./configure)
|
||||
|
||||
src/runtime/c/Makefile.in src/runtime/c/configure: src/runtime/c/configure.ac src/runtime/c/Makefile.am
|
||||
(cd src/runtime/c; autoreconf -i)
|
||||
|
||||
src/runtime/haskell/dist/setup-config: src/runtime/c/libpgf.la src/runtime/haskell/pgf2.cabal
|
||||
ifneq ($(STACK),1)
|
||||
(cd src/runtime/haskell; cabal ${CMD_PFX}configure)
|
||||
endif
|
||||
|
||||
src/compiler/dist/setup-config: src/compiler/gf.cabal src/compiler/Setup.hs src/compiler/WebSetup.hs
|
||||
ifneq ($(STACK),1)
|
||||
(cd src/compiler; cabal ${CMD_PFX}configure)
|
||||
endif
|
||||
|
||||
doc:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- | A file cache to avoid reading and parsing the same file many times
|
||||
module Cache (Cache,newCache,flushCache,expireCache,listCache,readCache,readCache') where
|
||||
module GF.Infra.Cache (Cache,newCache,flushCache,expireCache,listCache,readCache,readCache') where
|
||||
|
||||
import Control.Concurrent.MVar
|
||||
import Data.Map (Map)
|
||||
@@ -32,7 +32,7 @@ import Network.URI(URI(..))
|
||||
import Network.Shed.Httpd(initServer,Request(..),Response(..),noCache)
|
||||
--import qualified Network.FastCGI as FCGI -- from hackage direct-fastcgi
|
||||
import Network.CGI(handleErrors,liftIO)
|
||||
import CGIUtils(handleCGIErrors)--,outputJSONP,stderrToFile
|
||||
import GF.Server.CGIUtils(handleCGIErrors)--,outputJSONP,stderrToFile
|
||||
import Text.JSON(encode,showJSON,makeObj)
|
||||
--import System.IO.Silently(hCapture)
|
||||
import System.Process(readProcessWithExitCode)
|
||||
@@ -41,13 +41,13 @@ import Codec.Binary.UTF8.String(decodeString,encodeString)
|
||||
import GF.Infra.UseIO(readBinaryFile,writeBinaryFile,ePutStrLn)
|
||||
import GF.Infra.SIO(captureSIO)
|
||||
import GF.Data.Utilities(apSnd,mapSnd)
|
||||
import qualified PGFService as PS
|
||||
import qualified GF.Server.PGFService as PS
|
||||
import Data.Version(showVersion)
|
||||
import Paths_gf(getDataDir,version)
|
||||
import GF.Infra.BuildInfo (buildInfo)
|
||||
import SimpleEditor.Convert(parseModule)
|
||||
import RunHTTP(cgiHandler)
|
||||
import URLEncoding(decodeQuery)
|
||||
import GF.Server.SimpleEditor.Convert(parseModule)
|
||||
import GF.Server.RunHTTP(cgiHandler)
|
||||
import GF.Server.URLEncoding(decodeQuery)
|
||||
|
||||
--logFile :: FilePath
|
||||
--logFile = "pgf-error.log"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- | Isolate dependencies on the problematic cgi package to this module
|
||||
module CGI(module C) where
|
||||
module GF.Server.CGI(module C) where
|
||||
import Network.CGI as C(
|
||||
CGI,ContentType(..),Accept(..),Language(..),
|
||||
getVarWithDefault,readInput,negotiate,requestAcceptLanguage,getInput,
|
||||
@@ -1,10 +1,10 @@
|
||||
{-# LANGUAGE DeriveDataTypeable, CPP #-}
|
||||
-- | CGI utility functions for output, error handling and logging
|
||||
module CGIUtils (throwCGIError, handleCGIErrors,
|
||||
stderrToFile,logError,
|
||||
outputJSONP,outputEncodedJSONP,
|
||||
outputPNG,outputBinary,outputBinary',
|
||||
outputHTML,outputPlain,outputText) where
|
||||
module GF.Server.CGIUtils (throwCGIError, handleCGIErrors,
|
||||
stderrToFile,logError,
|
||||
outputJSONP,outputEncodedJSONP,
|
||||
outputPNG,outputBinary,outputBinary',
|
||||
outputHTML,outputPlain,outputText) where
|
||||
|
||||
import Control.Exception(Exception(..),SomeException(..),throw)
|
||||
import Data.Typeable(Typeable,cast)
|
||||
@@ -14,8 +14,8 @@ import System.IO(hPutStrLn,stderr)
|
||||
import System.Posix
|
||||
#endif
|
||||
|
||||
import CGI(CGI,CGIResult,setHeader,output,outputFPS,outputError,
|
||||
getInput)
|
||||
import GF.Server.CGI(CGI,CGIResult,setHeader,output,outputFPS,outputError,
|
||||
getInput)
|
||||
|
||||
import Text.JSON
|
||||
import qualified Codec.Binary.UTF8.String as UTF8 (encodeString)
|
||||
@@ -1,19 +1,19 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
module PGFService(cgiMain,cgiMain',getPath,
|
||||
logFile,stderrToFile,
|
||||
Caches,pgfCache,newPGFCache,flushPGFCache,listPGFCache) where
|
||||
module GF.Server.PGFService(cgiMain,cgiMain',getPath,
|
||||
logFile,stderrToFile,
|
||||
Caches,pgfCache,newPGFCache,flushPGFCache,listPGFCache) where
|
||||
|
||||
import PGF2
|
||||
import PGF2.Transactions
|
||||
import GF.Text.Lexing
|
||||
import Cache
|
||||
import CGIUtils(outputJSONP,outputPlain,outputHTML,outputText,
|
||||
outputBinary,outputBinary',
|
||||
logError,handleCGIErrors,throwCGIError,stderrToFile)
|
||||
import CGI(CGI,readInput,getInput,getVarWithDefault,
|
||||
CGIResult,requestAcceptLanguage,handleErrors,setHeader,
|
||||
Accept(..),Language(..),negotiate,liftIO)
|
||||
import URLEncoding
|
||||
import GF.Infra.Cache
|
||||
import GF.Server.CGIUtils(outputJSONP,outputPlain,outputHTML,outputText,
|
||||
outputBinary,outputBinary',
|
||||
logError,handleCGIErrors,throwCGIError,stderrToFile)
|
||||
import GF.Server.CGI(CGI,readInput,getInput,getVarWithDefault,
|
||||
CGIResult,requestAcceptLanguage,handleErrors,setHeader,
|
||||
Accept(..),Language(..),negotiate,liftIO)
|
||||
import GF.Server.URLEncoding
|
||||
|
||||
import Data.Time.Clock(UTCTime)
|
||||
import Data.Time.Format(formatTime)
|
||||
@@ -1,13 +1,14 @@
|
||||
module RunHTTP(runHTTP,Options(..),cgiHandler) where
|
||||
module GF.Server.RunHTTP(runHTTP,Options(..),cgiHandler) where
|
||||
|
||||
import GF.Server.CGI(ContentType(..),
|
||||
CGIResult(..),CGIRequest(..),Input(..),
|
||||
Headers,HeaderName(..),
|
||||
runCGIT)
|
||||
import GF.Server.URLEncoding(decodeQuery)
|
||||
import Network.URI(uriPath,uriQuery)
|
||||
import CGI(ContentType(..))
|
||||
import CGI(CGIResult(..),CGIRequest(..),Input(..),
|
||||
Headers,HeaderName(..))
|
||||
import CGI(runCGIT)
|
||||
import Network.Shed.Httpd(initServer,Request(..),Response(..))
|
||||
import qualified Data.ByteString.Lazy.Char8 as BS(pack,unpack,empty)
|
||||
import qualified Data.Map as M(fromList)
|
||||
import URLEncoding(decodeQuery)
|
||||
|
||||
data Options = Options { documentRoot :: String, port :: Int } deriving Show
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{-# LANGUAGE NoMonomorphismRestriction #-}
|
||||
module SimpleEditor.Convert where
|
||||
module GF.Server.SimpleEditor.Convert where
|
||||
|
||||
import Control.Monad(unless,foldM,ap,mplus)
|
||||
import Data.List(sortBy)
|
||||
@@ -19,8 +19,8 @@ import GF.Grammar.Lexer(Posn(..))
|
||||
import GF.Data.ErrM
|
||||
import PGF2(Literal(LStr))
|
||||
|
||||
import SimpleEditor.Syntax as S
|
||||
import SimpleEditor.JSON
|
||||
import GF.Server.SimpleEditor.Syntax as S
|
||||
import GF.Server.SimpleEditor.JSON
|
||||
|
||||
|
||||
parseModule (path,source) =
|
||||
@@ -1,8 +1,8 @@
|
||||
module SimpleEditor.JSON where
|
||||
module GF.Server.SimpleEditor.JSON where
|
||||
|
||||
import Text.JSON
|
||||
|
||||
import SimpleEditor.Syntax
|
||||
import GF.Server.SimpleEditor.Syntax
|
||||
|
||||
|
||||
instance JSON Grammar where
|
||||
@@ -2,7 +2,7 @@
|
||||
Abstract syntax for the small subset of GF grammars supported
|
||||
in gfse, the JavaScript-based simple grammar editor.
|
||||
-}
|
||||
module SimpleEditor.Syntax where
|
||||
module GF.Server.SimpleEditor.Syntax where
|
||||
|
||||
type Id = String -- all sorts of identifiers
|
||||
type ModId = Id -- module name
|
||||
@@ -1,4 +1,4 @@
|
||||
module URLEncoding(urlDecodeUnicode,decodeQuery) where
|
||||
module GF.Server.URLEncoding(urlDecodeUnicode,decodeQuery) where
|
||||
|
||||
import Data.Bits (shiftL, (.|.))
|
||||
import Data.Char (chr,digitToInt,isHexDigit)
|
||||
@@ -118,7 +118,7 @@ setupWeb dest (pkg,lbi) = do
|
||||
|
||||
copyGFLogo =
|
||||
do createDirectoryIfMissing True logo_dir
|
||||
copyFile ("doc"</>"Logos"</>gf_logo) (logo_dir</>gf_logo)
|
||||
copyFile (".."</>".."</>"doc"</>"Logos"</>gf_logo) (logo_dir</>gf_logo)
|
||||
|
||||
-- | Run an arbitrary system command, returning False on failure
|
||||
execute :: String -> [String] -> IO Bool
|
||||
@@ -13,12 +13,6 @@ homepage: https://www.grammaticalframework.org/
|
||||
bug-reports: https://github.com/GrammaticalFramework/gf-core/issues
|
||||
tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2
|
||||
|
||||
data-dir: src
|
||||
extra-source-files:
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
WebSetup.hs
|
||||
doc/Logos/gf0.png
|
||||
data-files:
|
||||
www/*.html
|
||||
www/*.css
|
||||
@@ -69,7 +63,6 @@ flag network-uri
|
||||
default: True
|
||||
|
||||
executable gf
|
||||
hs-source-dirs: src/programs, src/compiler
|
||||
main-is: gf-main.hs
|
||||
default-language: Haskell2010
|
||||
build-depends: pgf2,
|
||||
@@ -171,6 +164,7 @@ executable gf
|
||||
GF.Infra.Ident
|
||||
GF.Infra.Location
|
||||
GF.Infra.SIO
|
||||
GF.Infra.Cache
|
||||
GF.JavaScript.AbsJS
|
||||
GF.JavaScript.PrintJS
|
||||
GF.Quiz
|
||||
@@ -232,18 +226,14 @@ executable gf
|
||||
cpp-options: -DSERVER_MODE
|
||||
other-modules:
|
||||
GF.Server
|
||||
PGFService
|
||||
RunHTTP
|
||||
SimpleEditor.Convert
|
||||
SimpleEditor.JSON
|
||||
SimpleEditor.Syntax
|
||||
URLEncoding
|
||||
CGI
|
||||
CGIUtils
|
||||
Cache
|
||||
hs-source-dirs:
|
||||
src/server
|
||||
src/server/transfer
|
||||
GF.Server.PGFService
|
||||
GF.Server.RunHTTP
|
||||
GF.Server.SimpleEditor.Convert
|
||||
GF.Server.SimpleEditor.JSON
|
||||
GF.Server.SimpleEditor.Syntax
|
||||
GF.Server.URLEncoding
|
||||
GF.Server.CGI
|
||||
GF.Server.CGIUtils
|
||||
|
||||
if flag(interrupt)
|
||||
cpp-options: -DUSE_INTERRUPT
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user