Browse Source

add msys subhost

ruki 4 years ago
parent
commit
f8dc70f9cc

+ 1 - 1
packages/c/cmake/xmake.lua

@@ -49,7 +49,7 @@ package("cmake")
         os.cp("CMake.app/Contents/share", package:installdir())
         os.cp("CMake.app/Contents/share", package:installdir())
     end)
     end)
 
 
-    on_install("@linux|x86_64", "@windows", function (package)
+    on_install("@linux|x86_64", "@windows", "@msys", "@cygwin", function (package)
         os.cp("bin", package:installdir())
         os.cp("bin", package:installdir())
         os.cp("share", package:installdir())
         os.cp("share", package:installdir())
     end)
     end)

+ 1 - 1
packages/l/luajit/port/xmake.lua

@@ -162,7 +162,7 @@ target("buildvm")
     else
     else
         add_defines("LUAJIT_OS=LUAJIT_OS_OTHER", {public = true})
         add_defines("LUAJIT_OS=LUAJIT_OS_OTHER", {public = true})
     end
     end
-    before_build("@windows", function (target)
+    before_build("@windows", "@msys", "@cygwin", function (target)
         if not is_arch("x86", "x64", "mips", "mips64") then
         if not is_arch("x86", "x64", "mips", "mips64") then
             -- @note we need fix `illegal zero-sized array` errors for msvc
             -- @note we need fix `illegal zero-sized array` errors for msvc
             io.gsub("src/lj_jit.h", "  LJ_K32__MAX\n", "  LJ_K32__MAX=1\n")
             io.gsub("src/lj_jit.h", "  LJ_K32__MAX\n", "  LJ_K32__MAX=1\n")

+ 1 - 7
packages/m/m4/xmake.lua

@@ -14,16 +14,10 @@ package("m4")
         add_patches("1.4.18", path.join(os.scriptdir(), "patches", "1.4.18", "secure_snprintf.patch"), "c0a408fbffb7255fcc75e26bd8edab116fc81d216bfd18b473668b7739a4158e")
         add_patches("1.4.18", path.join(os.scriptdir(), "patches", "1.4.18", "secure_snprintf.patch"), "c0a408fbffb7255fcc75e26bd8edab116fc81d216bfd18b473668b7739a4158e")
     end
     end
 
 
-    on_install("@macosx", "@linux", function (package)
+    on_install("@macosx", "@linux", "@msys", "@cygwin", function (package)
         import("package.tools.autoconf").install(package, {"--disable-dependency-tracking"})
         import("package.tools.autoconf").install(package, {"--disable-dependency-tracking"})
     end)
     end)
 
 
-    if is_subhost("msys") then
-        on_install("@windows", function (package)
-            import("package.tools.autoconf").install(package, {"--disable-dependency-tracking"})
-        end)
-    end
-
     on_test(function (package)
     on_test(function (package)
         os.vrun("m4 --version")
         os.vrun("m4 --version")
     end)
     end)

+ 7 - 1
packages/m/make/xmake.lua

@@ -10,11 +10,17 @@ package("make")
     add_versions("4.2.1", "e40b8f018c1da64edd1cc9a6fce5fa63b2e707e404e20cad91fbae337c98a5b7")
     add_versions("4.2.1", "e40b8f018c1da64edd1cc9a6fce5fa63b2e707e404e20cad91fbae337c98a5b7")
 
 
     on_install("@windows", function(package)
     on_install("@windows", function(package)
-        os.vrun("build_w32.bat")
+        import("core.tool.toolchain")
+        local runenvs = toolchain.load("msvc"):runenvs()
+        os.vrunv("build_w32.bat", {}, {envs = runenvs})
         os.cp("WinRel/gnumake.exe", path.join(package:installdir("bin"), "make.exe"))
         os.cp("WinRel/gnumake.exe", path.join(package:installdir("bin"), "make.exe"))
     end)
     end)
 
 
     on_install("@macosx", "@linux", function (package)
     on_install("@macosx", "@linux", function (package)
+        -- fix undefined reference to `__alloca'
+        if is_subhost("linux") then
+            io.replace("glob/glob.c", "!defined __alloca && !defined __GNU_LIBRARY__", "1")
+        end
         import("package.tools.autoconf").install(package, {"--disable-dependency-tracking", "--disable-gtk", "--disable-silent-rules"})
         import("package.tools.autoconf").install(package, {"--disable-dependency-tracking", "--disable-gtk", "--disable-silent-rules"})
     end)
     end)
 
 

+ 1 - 1
packages/m/moonjit/port/xmake.lua

@@ -162,7 +162,7 @@ target("buildvm")
     else
     else
         add_defines("LUAJIT_OS=LUAJIT_OS_OTHER", {public = true})
         add_defines("LUAJIT_OS=LUAJIT_OS_OTHER", {public = true})
     end
     end
-    before_build("@windows", function (target)
+    before_build("@windows", "@msys", "@cygwin", function (target)
         if not is_arch("x86", "x64", "mips", "mips64") then
         if not is_arch("x86", "x64", "mips", "mips64") then
             -- @note we need fix `illegal zero-sized array` errors for msvc
             -- @note we need fix `illegal zero-sized array` errors for msvc
             io.gsub("src/lj_jit.h", "  LJ_K32__MAX\n", "  LJ_K32__MAX=1\n")
             io.gsub("src/lj_jit.h", "  LJ_K32__MAX\n", "  LJ_K32__MAX=1\n")

+ 1 - 1
packages/n/ninja/xmake.lua

@@ -20,7 +20,7 @@ package("ninja")
         add_deps("python2", {kind = "binary"})
         add_deps("python2", {kind = "binary"})
     end
     end
 
 
-    on_install("@windows", function (package)
+    on_install("@windows", "@msys", "@cygwin", function (package)
         os.cp("./ninja.exe", package:installdir("bin"))
         os.cp("./ninja.exe", package:installdir("bin"))
     end)
     end)
 
 

+ 1 - 1
packages/o/openexr/xmake.lua

@@ -13,7 +13,7 @@ package("openexr")
 
 
     add_configs("build_both", {description = "Build both static library and shared library.", default = false, type = "boolean"})
     add_configs("build_both", {description = "Build both static library and shared library.", default = false, type = "boolean"})
 
 
-    on_install("macosx", "linux", "windows", "mingw@windows", function (package)
+    on_install("macosx", "linux", "windows", "mingw@windows", "mingw@msys", function (package)
         local configs = {"-DBUILD_TESTING=OFF", "-DINSTALL_OPENEXR_EXAMPLES=OFF", "-DINSTALL_OPENEXR_DOCS=OFF", "-DOPENEXR_BUILD_UTILS=ON"}
         local configs = {"-DBUILD_TESTING=OFF", "-DINSTALL_OPENEXR_EXAMPLES=OFF", "-DINSTALL_OPENEXR_DOCS=OFF", "-DOPENEXR_BUILD_UTILS=ON"}
         if package:config("build_both") then
         if package:config("build_both") then
             table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
             table.insert(configs, "-DBUILD_SHARED_LIBS=ON")

+ 4 - 5
packages/p/patch/xmake.lua

@@ -9,13 +9,12 @@ package("patch")
         add_urls("https://github.com/xmake-mirror/patch/releases/download/v2.5.9/patch-$(version)-bin.zip")
         add_urls("https://github.com/xmake-mirror/patch/releases/download/v2.5.9/patch-$(version)-bin.zip")
         add_versions("2.5.9-7", "fabd6517e7bd88e067db9bf630d69bb3a38a08e044fa73d13a704ab5f8dd110b")
         add_versions("2.5.9-7", "fabd6517e7bd88e067db9bf630d69bb3a38a08e044fa73d13a704ab5f8dd110b")
     else
     else
-        add_urls("https://ftp.gnu.org/gnu/patch/patch-$(version).tar.bz2", {alias = "gnuftp"})
-        add_urls("https://github.com/xmake-mirror/patch/archive/v$(version).tar.gz", {alias = "github"})
-        add_versions("gnuftp:2.7.6", "3d1d001210d76c9f754c12824aa69f25de7cb27bb6765df63455b77601a0dcc9")
-        add_versions("github:2.7.6", "33d5a86bad9813b27dbbe890123d0b88fbcc74d5d997aeadde60c670a2bd0eb9")
+        add_urls("https://ftp.gnu.org/gnu/patch/patch-$(version).tar.bz2",
+                 "https://github.com/xmake-mirror/patch/releases/download/v$(version)/patch-$(version).tar.bz2")
+        add_versions("2.7.6", "3d1d001210d76c9f754c12824aa69f25de7cb27bb6765df63455b77601a0dcc9")
     end
     end
 
 
-    on_install("@windows", function (package)
+    on_install("@windows", "@msys", "@cygwin", function (package)
         os.cp("bin/*", package:installdir("bin"))
         os.cp("bin/*", package:installdir("bin"))
     end)
     end)
 
 

+ 1 - 1
packages/p/protoc/xmake.lua

@@ -25,7 +25,7 @@ package("protoc")
         add_versions("3.8.0", "91ea92a8c37825bd502d96af9054064694899c5c7ecea21b8d11b1b5e7e993b5")
         add_versions("3.8.0", "91ea92a8c37825bd502d96af9054064694899c5c7ecea21b8d11b1b5e7e993b5")
     end
     end
 
 
-    on_install("@windows", "@macosx", function (package)
+    on_install("@windows", "@msys", "@cygwin", "@macosx", function (package)
         os.cp("bin", package:installdir())
         os.cp("bin", package:installdir())
         os.cp("include", package:installdir())
         os.cp("include", package:installdir())
     end)
     end)

+ 4 - 2
packages/p/python/xmake.lua

@@ -82,7 +82,7 @@ package("python")
         end)
         end)
     end)
     end)
 
 
-    on_install("@windows", function (package)
+    on_install("@windows", "@msys", "@cygwin", function (package)
         if package:version():ge("3.0") then
         if package:version():ge("3.0") then
             os.cp("python.exe", path.join(package:installdir("bin"), "python3.exe"))
             os.cp("python.exe", path.join(package:installdir("bin"), "python3.exe"))
         else
         else
@@ -165,5 +165,7 @@ package("python")
         os.vrun("python -c \"import pip\"")
         os.vrun("python -c \"import pip\"")
         os.vrun("python -c \"import setuptools\"")
         os.vrun("python -c \"import setuptools\"")
         os.vrun("python -c \"import wheel\"")
         os.vrun("python -c \"import wheel\"")
-        assert(package:has_cfuncs("PyModule_New", {includes = "Python.h"}))
+        if package:kind() ~= "binary" then
+            assert(package:has_cfuncs("PyModule_New", {includes = "Python.h"}))
+        end
     end)
     end)

+ 4 - 2
packages/p/python2/xmake.lua

@@ -69,7 +69,7 @@ package("python2")
         end)
         end)
     end)
     end)
 
 
-    on_install("@windows", function (package)
+    on_install("@windows", "@msys", "@cygwin", function (package)
         os.cp("python.exe", path.join(package:installdir("bin"), "python2.exe"))
         os.cp("python.exe", path.join(package:installdir("bin"), "python2.exe"))
         os.mv("*.exe", package:installdir("bin"))
         os.mv("*.exe", package:installdir("bin"))
         os.mv("*.dll", package:installdir("bin"))
         os.mv("*.dll", package:installdir("bin"))
@@ -137,5 +137,7 @@ package("python2")
         os.vrun("python2 -c \"import pip\"")
         os.vrun("python2 -c \"import pip\"")
         os.vrun("python2 -c \"import setuptools\"")
         os.vrun("python2 -c \"import setuptools\"")
         os.vrun("python2 -c \"import wheel\"")
         os.vrun("python2 -c \"import wheel\"")
-        assert(package:has_cfuncs("PyModule_New", {includes = "Python.h"}))
+        if package:kind() ~= "binary" then
+            assert(package:has_cfuncs("PyModule_New", {includes = "Python.h"}))
+        end
     end)
     end)

+ 1 - 1
packages/t/tbb/xmake.lua

@@ -18,7 +18,7 @@ package("tbb")
         end
         end
     end
     end
 
 
-    on_install("macosx", "linux", "mingw@windows", function (package)
+    on_install("macosx", "linux", "mingw@windows", "mingw@msys", function (package)
         local configs = {"-j4", "tbb_build_prefix=build_dir"}
         local configs = {"-j4", "tbb_build_prefix=build_dir"}
         local cfg = package:debug() and "debug" or "release"
         local cfg = package:debug() and "debug" or "release"
         table.insert(configs, "cfg=" .. cfg)
         table.insert(configs, "cfg=" .. cfg)

+ 6 - 8
packages/z/zlib/xmake.lua

@@ -16,14 +16,12 @@ package("zlib")
         os.cp("*.h", package:installdir("include"))
         os.cp("*.h", package:installdir("include"))
     end)
     end)
 
 
-    on_install("mingw@windows", function (package)
-        if is_subhost("msys") then
-            io.gsub("win32/Makefile.gcc", "\nCC =.-\n",      "\nCC=" .. (package:build_getenv("cc") or "") .. "\n")
-            io.gsub("win32/Makefile.gcc", "\nAR =.-\n",      "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
-            import("package.tools.make").build(package, {"-f", "win32/Makefile.gcc", "libz.a"})
-            os.cp("libz.a", package:installdir("lib"))
-            os.cp("*.h", package:installdir("include"))
-        end
+    on_install("mingw@msys", function (package)
+        io.gsub("win32/Makefile.gcc", "\nCC =.-\n",      "\nCC=" .. (package:build_getenv("cc") or "") .. "\n")
+        io.gsub("win32/Makefile.gcc", "\nAR =.-\n",      "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
+        import("package.tools.make").build(package, {"-f", "win32/Makefile.gcc", "libz.a"})
+        os.cp("libz.a", package:installdir("lib"))
+        os.cp("*.h", package:installdir("include"))
     end)
     end)
 
 
     on_install("macosx", function (package)
     on_install("macosx", function (package)