|
@@ -1,5 +1,4 @@
|
|
|
package("emscripten")
|
|
|
-
|
|
|
set_kind("toolchain")
|
|
|
set_homepage("https://emscripten.org/")
|
|
|
set_description("Emscripten: An LLVM-to-WebAssembly Compiler.")
|
|
@@ -10,13 +9,23 @@ package("emscripten")
|
|
|
|
|
|
add_deps("python")
|
|
|
|
|
|
+ on_load(function (package)
|
|
|
+ package:addenv("PATH", "upstream/emscripten")
|
|
|
+ package:addenv("PATH", ".")
|
|
|
+ package:addenv("EMSDK", ".")
|
|
|
+ package:mark_as_pathenv("EMSDK")
|
|
|
+ package:mark_as_pathenv("EMSDK_NODE")
|
|
|
+ if package:is_plat("windows") then
|
|
|
+ package:mark_as_pathenv("EMSDK_PYTHON")
|
|
|
+ package:mark_as_pathenv("JAVA_HOME")
|
|
|
+ end
|
|
|
+ end)
|
|
|
+
|
|
|
on_install("windows", "macosx", "linux", function (package)
|
|
|
import("lib.detect.find_directory")
|
|
|
|
|
|
- -- copy to installdir
|
|
|
- os.cp("*", package:installdir())
|
|
|
-
|
|
|
-- installation
|
|
|
+ os.cp("*", package:installdir())
|
|
|
local version = package:version():rawstr()
|
|
|
local installdir = package:installdir()
|
|
|
local py = package:is_plat("windows") and "python" or "python3"
|
|
@@ -26,25 +35,22 @@ package("emscripten")
|
|
|
os.vrunv(py, {path.join(installdir, "emsdk.py"), "activate", version})
|
|
|
|
|
|
-- setup env
|
|
|
- package:addenv("PATH", node)
|
|
|
- package:addenv("PATH", path.join(installdir, "upstream", "emscripten"))
|
|
|
- package:addenv("PATH", installdir)
|
|
|
- package:addenv("EMSDK", installdir)
|
|
|
-
|
|
|
local exe = package:is_plat("windows") and ".exe" or ""
|
|
|
- local node = find_directory("bin", {path.join(installdir, "node", "**")})
|
|
|
- if node then
|
|
|
- package:addenv("PATH", node)
|
|
|
- package:addenv("EMSDK_NODE", path.join(node, "node" .. exe))
|
|
|
+ local node_bindir = find_directory("bin", {path.join(installdir, "node", "**")})
|
|
|
+ if node_bindir then
|
|
|
+ node_bindir = path.relative(node_bindir, installdir)
|
|
|
+ package:addenv("PATH", node_bindir)
|
|
|
+ package:addenv("EMSDK_NODE", path.join(node_bindir, "node" .. exe))
|
|
|
end
|
|
|
-
|
|
|
if package:is_plat("windows") then
|
|
|
local python = find_directory("*", path.join(installdir, "python"))
|
|
|
if python then
|
|
|
+ python = path.relative(python, installdir)
|
|
|
package:addenv("EMSDK_PYTHON", path.join(python, "python" .. exe))
|
|
|
end
|
|
|
local java = find_directory("*", path.join(installdir, "java"))
|
|
|
if java then
|
|
|
+ java = path.relative(java, installdir)
|
|
|
package:addenv("JAVA_HOME", java)
|
|
|
end
|
|
|
end
|