Last active
August 29, 2015 14:25
-
-
Save dkubb/842da22c212c944673b1 to your computer and use it in GitHub Desktop.
Revisions
-
dkubb revised this gist
Jul 14, 2015 . 1 changed file with 41 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} import Turtle import Prelude hiding (FilePath) data Options = Options { repo :: Text , file :: FilePath } parser :: Parser Options parser = Options <$> (optText "repo" 'r' "The docker repo name" <|> pure "nilcons/ghc-musl") <*> argPath "file" "The source file path" compile :: FilePath -> Text -> IO ExitCode compile inFile repo = do let inDir = directory inFile shell (cmd inDir inDir repo inFile) empty where cmd = format ("docker run --volume "%fp%":"%fp%" --rm "%s%" ghc -O2 -threaded -optl-static -optl-s "%fp) compress :: FilePath -> IO ExitCode compress outFile = shell (cmd outFile) empty where cmd = format ("upx --best --ultra-brute --lzma -- "%fp) main :: IO () main = do -- Parse command-line options Options{..} <- options "Static Haskell Binary Creation" parser -- Get the full input directory inFile <- realpath file -- Compile and compress the static binaries status <- compile inFile repo .&&. compress (dropExtension inFile) case status of ExitSuccess -> return () ExitFailure msg -> die ("compilation failure" <> repr msg) -
dkubb revised this gist
Jul 14, 2015 . 2 changed files with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ name: minimal-docker-image version: 0.0.0 cabal-version: >= 1.2 executable Build ghc-options: -Wall -Werror -fwarn-incomplete-record-updates -fwarn-tabs -fwarn-monomorphism-restriction -fwarn-unused-do-bind -fwarn-implicit-prelude default-language: Haskell2010 main-is: Build.hs build-depends: base >= 4 && < 5, turtle >= 1.2.0 && < 2 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ resolver: nightly-2015-07-12 -
dkubb revised this gist
Jul 13, 2015 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ *.hi *.o *.sw[op] /.shake /.stack-work /dist /output -
dkubb created this gist
Jul 13, 2015 .There are no files selected for viewing