Skip to content
Browse files

remove hardcoded closure paths

  • Loading branch information...
1 parent 83168ea commit 85d0ed6d68396ccefc9535d0fc2578620e1dd160 @luite luite committed
Showing with 31 additions and 46 deletions.
  1. +0 −21 Setup.hs
  2. +3 −1 ghcjs.cabal
  3. +28 −24 src/Minify.hs
View
21 Setup.hs
@@ -11,9 +11,7 @@ import Data.Maybe (maybe, listToMaybe)
main = defaultMainWithHooks simpleUserHooks
{ hookedPrograms = [simpleProgram "java"]
- , instHook = ghcjsInstHook
, postInst = ghcjsPostInst
- , copyHook = ghcjsCopyHook
}
ghcjsPostInst _ _ pkgDesc lbi = when doBoot (autoboot >> return ())
@@ -24,22 +22,3 @@ ghcjsPostInst _ _ pkgDesc lbi = when doBoot (autoboot >> return ())
autoboot = rawSystem "ghcjs-boot" ["--auto"] -- fixme make sure that the one from the current install is being run
-ghcjsInstHook pkg_descr lbi hooks flags = do
- instHook simpleUserHooks pkg_descr lbi hooks flags
- copyRts pkg_descr lbi $ fromFlag (installVerbosity flags)
-
-ghcjsCopyHook pkg_descr lbi hooks flags = do
- copyHook simpleUserHooks pkg_descr lbi hooks flags
- copyRts pkg_descr lbi $ fromFlag (copyVerbosity flags)
-
-copyRts pkg_descr lbi verbosity = do
- let lib = libdir $absoluteInstallDirs pkg_descr lbi NoCopyDest
- destination = lib </> "rts.jso"
- copy n = installOrdinaryFile verbosity ("rts" </> n) (destination </> n)
-
- createDirectoryIfMissingVerbose verbosity True destination
- copy "rts-options.js"
- copy "rts-common.js"
- copy "rts-plain.js"
- copy "rts-trampoline.js"
-
View
4 ghcjs.cabal
@@ -9,6 +9,8 @@ Maintainer: Victor Nazarov <asviraspossible@gmail.com>
Stability: Experimental
Build-Type: Custom
Cabal-Version: >= 1.10
+data-dir: .
+data-files: rts/*.js
flag boot
default: False
@@ -48,7 +50,7 @@ Executable ghcjs-min
Main-Is: Minify.hs
Default-Language: Haskell2010
Hs-Source-Dirs: src
- Build-Depends: base >=3 && <5, ghc, Cabal, containers, filepath, directory, process, time
+ Build-Depends: base >=3 && <5, ghc, Cabal, containers, filepath, directory, process, time, ghcjs-closure
Executable ghcjs-pkg
Main-Is: Pkg.hs
View
52 src/Minify.hs
@@ -9,39 +9,43 @@ import System.Exit (exitFailure, exitWith, ExitCode(..))
import System.Process (system)
import System.FilePath ((</>))
+import Closure.Paths
+
main :: IO ()
main = do
args <- getArgs
+ d <- closureLibraryPath
+ cj <- closureCompilerJar
case args of
(jsexe:rest) -> do
closureArgs <- readFile $jsexe </> "closure.args"
checkExit . system . intercalate " " $ [
"java",
"-Xmx1G",
- "-jar", "~/closure-compiler/compiler.jar",
- "--js", "~/closure-library/closure/goog/base.js",
- "--js", "~/closure-library/closure/goog/object/object.js",
- "--js", "~/closure-library/closure/goog/string/string.js",
- "--js", "~/closure-library/closure/goog/debug/error.js",
- "--js", "~/closure-library/closure/goog/asserts/asserts.js",
- "--js", "~/closure-library/closure/goog/array/array.js",
- "--js", "~/closure-library/closure/goog/math/long.js",
- "--js", "~/closure-library/closure/goog/math/integer.js",
- "--js", "~/closure-library/closure/goog/debug/relativetimeprovider.js",
- "--js", "~/closure-library/closure/goog/debug/formatter.js",
- "--js", "~/closure-library/closure/goog/structs/structs.js",
- "--js", "~/closure-library/closure/goog/structs/collection.js",
- "--js", "~/closure-library/closure/goog/iter/iter.js",
- "--js", "~/closure-library/closure/goog/structs/map.js",
- "--js", "~/closure-library/closure/goog/structs/set.js",
- "--js", "~/closure-library/closure/goog/useragent/useragent.js",
- "--js", "~/closure-library/closure/goog/debug/debug.js",
- "--js", "~/closure-library/closure/goog/debug/logrecord.js",
- "--js", "~/closure-library/closure/goog/debug/logbuffer.js",
- "--js", "~/closure-library/closure/goog/debug/logger.js",
- "--js", "~/closure-library/closure/goog/debug/console.js",
- "--js", "~/closure-library/closure/goog/crypt/hash.js",
- "--js", "~/closure-library/closure/goog/crypt/md5.js",
+ "-jar", cj,
+ "--js", d </> "closure/goog/base.js",
+ "--js", d </> "closure/goog/object/object.js",
+ "--js", d </> "closure/goog/string/string.js",
+ "--js", d </> "closure/goog/debug/error.js",
+ "--js", d </> "closure/goog/asserts/asserts.js",
+ "--js", d </> "closure/goog/array/array.js",
+ "--js", d </> "closure/goog/math/long.js",
+ "--js", d </> "closure/goog/math/integer.js",
+ "--js", d </> "closure/goog/debug/relativetimeprovider.js",
+ "--js", d </> "closure/goog/debug/formatter.js",
+ "--js", d </> "closure/goog/structs/structs.js",
+ "--js", d </> "closure/goog/structs/collection.js",
+ "--js", d </> "closure/goog/iter/iter.js",
+ "--js", d </> "closure/goog/structs/map.js",
+ "--js", d </> "closure/goog/structs/set.js",
+ "--js", d </> "closure/goog/useragent/useragent.js",
+ "--js", d </> "closure/goog/debug/debug.js",
+ "--js", d </> "closure/goog/debug/logrecord.js",
+ "--js", d </> "closure/goog/debug/logbuffer.js",
+ "--js", d </> "closure/goog/debug/logger.js",
+ "--js", d </> "closure/goog/debug/console.js",
+ "--js", d </> "closure/goog/crypt/hash.js",
+ "--js", d </> "closure/goog/crypt/md5.js",
"--js", jsexe </> "rts.jso/rts-options.js",
"--define='HS_DEBUG=false'",
"--define='HS_TRACE=false'"

0 comments on commit 85d0ed6

Please sign in to comment.
Something went wrong with that request. Please try again.