瀏覽代碼

Try fix icu4c windows (#492)

* separate launcher

* improve icu4c

* fix build of icu4c under Windows

* crlf?

* icu4c: fix patch

* icu4c: fix patch

* icu4c: fix patch

Co-authored-by: xq114 <[email protected]>
Shiwei Wang 4 年之前
父節點
當前提交
71adc93666

+ 35 - 0
packages/i/icu4c/patches/69.1/replace-py-3.patch

@@ -0,0 +1,35 @@
+diff --git a/source/data/makedata.mak b/source/data/makedata.mak
+index 286c18a4d7..3836239ec5 100644
+--- a/source/data/makedata.mak
++++ b/source/data/makedata.mak
+@@ -33,7 +33,7 @@ ICU_LIB_TARGET=$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll
+ !ENDIF
+ !MESSAGE ICU data make path is $(ICUMAKE)
+ 
+-!IF [py -3 -c "exit(0)"]!=0
++!IF [python -c "exit(0)"]!=0
+ !MESSAGE Information: Unable to find Python 3. Data will fail to build from source.
+ !ENDIF
+ 
+@@ -283,7 +283,7 @@ $(TOOLS_TS): "$(ICUTOOLS)\genrb\$(CFGTOOLS)\genrb.exe" "$(ICUTOOLS)\gencnval\$(C
+ $(COREDATA_TS):
+ 	@cd "$(ICUSRCDATA)"
+ 	set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
+-	py -3 -B -m icutools.databuilder \
++	python -B -m icutools.databuilder \
+ 		--mode windows-exec \
+ 		--src_dir "$(ICUSRCDATA)" \
+ 		--tool_dir "$(ICUTOOLS)" \
+diff --git a/source/test/testdata/testdata.mak b/source/test/testdata/testdata.mak
+index 2809efd0ca..c20ea05361 100644
+--- a/source/test/testdata/testdata.mak
++++ b/source/test/testdata/testdata.mak
+@@ -35,7 +35,7 @@ CREATE_DIRS :
+ "$(TESTDATAOUT)\testdata.dat" :
+ 	@echo Building test data
+ 	set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
+-	py -3 -B -m icutools.databuilder \
++	python -B -m icutools.databuilder \
+ 		--mode windows-exec \
+ 		--tool_dir "$(ICUTOOLS)" \
+ 		--tool_cfg "$(CFG)" \

+ 3 - 10
packages/i/icu4c/xmake.lua

@@ -11,6 +11,8 @@ package("icu4c")
     add_versions("68.1", "a9f2e3d8b4434b8e53878b4308bd1e6ee51c9c7042e2b1a376abefb6fbb29f2d")
     add_versions("64.2", "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c")
 
+    add_patches("69.1", path.join(os.scriptdir(), "patches", "69.1", "replace-py-3.patch"), "ae27a55b0e79a8420024d6d349a7bae850e1dd403a8e1131e711c405ddb099b9")
+
     add_links("icuuc", "icutu", "icui18n", "icuio", "icudata")
     if is_plat("linux") then
         add_syslinks("dl")
@@ -20,19 +22,10 @@ package("icu4c")
     end
 
     on_install("windows", function (package)
-        import("package.tools.msbuild")
-
-        -- set configs
         local configs = {path.join("source", "allinone", "allinone.sln"), "/p:SkipUWP=True", "/p:_IsNativeEnvironment=true"}
         table.insert(configs, "/p:Configuration=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32"))
-
-        -- set envs
-        local envs = msbuild.buildenvs(package)
-        envs.PATH = package:dep("python"):installdir("bin") .. path.envsep() .. envs.PATH
-
-        -- build
-        msbuild.build(package, configs, {envs = envs})
+        import("package.tools.msbuild").build(package, configs)
         os.cp("include", package:installdir())
         os.cp("bin*/*", package:installdir("bin"))
         os.cp("lib*/*", package:installdir("lib"))

+ 21 - 0
packages/p/python-launcher/xmake.lua

@@ -0,0 +1,21 @@
+package("python-launcher")
+
+    set_kind("binary")
+    set_homepage("https://www.python.org/")
+    set_description("The python programming language.")
+
+    if is_arch("x86", "i386") or os.arch() == "x86" then
+        add_urls("https://github.com/xmake-mirror/python-windows/releases/download/$(version)/python-launcher-$(version).win32.zip")
+        add_versions("3.9.6", "73d712aaca09d7ada78bcf26dfc3346f655b4b1fed5b459133ce564b9c5f5663")
+    else
+        add_urls("https://github.com/xmake-mirror/python-windows/releases/download/$(version)/python-launcher-$(version).win64.zip")
+        add_versions("3.9.6", "fc2a54f47f07a193265cb844c0e1b165682c71a1655e92eb3c44f25bacc84b8a")
+    end
+
+    on_install("@windows", "@msys", "@cygwin", function (package)
+        os.cp("*", package:installdir("bin"))
+    end)
+
+    on_test(function (package)
+        os.vrun("py -0p")
+    end)

+ 6 - 6
packages/p/python/xmake.lua

@@ -10,12 +10,14 @@ package("python")
             add_versions("3.7.9", "55c8a408a11e598964f5d581589cf7f8c622e3cad048dce331ee5a61e5a6f57f")
             add_versions("3.8.10", "f520d2880578df076e3df53bf9e147b81b5328db02d8d873670a651fa076be50")
             add_versions("3.9.5", "ce0bfe8ced874d8d74a6cf6a98f13f5afee27cffbaf2d1ee0f09d3a027fab299")
+            add_versions("3.9.6", "2918246384dfb233bd8f8c2bcf6aa3688e6834e84ab204f7c962147c468f8d12")
         else
             add_urls("https://github.com/xmake-mirror/python-windows/releases/download/$(version)/python-$(version).win64.zip")
             add_versions("2.7.18", "6680835ed5b818e2c041c7033bea47ace17f6f3b73b0d6efb6ded8598a266754")
             add_versions("3.7.9", "d0d879c934b463d46161f933db53a676790d72f24e92143f629ee5629ae286bc")
             add_versions("3.8.10", "acf35048274404dd415e190bf5b928fae3b03d8bb5dfbfa504f9a183361468bd")
             add_versions("3.9.5", "3265059edac21bf4c46fac13553a5d78417e7aa209eceeffd0250aa1dd8d6fdf")
+            add_versions("3.9.6", "57ccd1b1b5fbc62882bd2a6f47df6e830ba39af741acf0a1d2f161eef4e87f2e")
         end
     else
         set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz",
@@ -24,6 +26,7 @@ package("python")
         add_versions("3.7.9", "39b018bc7d8a165e59aa827d9ae45c45901739b0bbb13721e4f973f3521c166a")
         add_versions("3.8.10", "b37ac74d2cbad2590e7cd0dd2b3826c29afe89a734090a87bf8c03c45066cb65")
         add_versions("3.9.5", "e0fbd5b6e1ee242524430dee3c91baf4cbbaba4a72dd1674b90fda87b713c7ab")
+        add_versions("3.9.6", "d0a35182e19e416fc8eae25a3dcd4d02d4997333e4ad1f2eee6010aadc3fe866")
     end
 
     if not is_plat(os.host()) then
@@ -75,9 +78,9 @@ package("python")
         else
             os.cp("python.exe", path.join(package:installdir("bin"), "python2.exe"))
         end
-        os.mv("*.exe", package:installdir("bin"))
-        os.mv("*.dll", package:installdir("bin"))
-        os.mv("Lib", package:installdir())
+        os.cp("*.exe", package:installdir("bin"))
+        os.cp("*.dll", package:installdir("bin"))
+        os.cp("Lib", package:installdir())
         os.cp("libs/*", package:installdir("lib"))
         os.cp("*", package:installdir())
         local python = path.join(package:installdir("bin"), "python.exe")
@@ -232,7 +235,4 @@ package("python")
         if package:kind() ~= "binary" then
             assert(package:has_cfuncs("PyModule_New", {includes = "Python.h"}))
         end
-        if is_host("windows") and package:version():ge("3.8.0") and winos.version():gt("win8") then
-            os.vrun("py -3 -c \"import sys\"")
-        end
     end)