From 785838f9b61f3532bc0e8f341abd5a70195174de Mon Sep 17 00:00:00 2001 From: xpxz <97490782+heheda123123@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:22:27 +0800 Subject: [PATCH] add mingw support to mysql (#2022) * add mingw support to mysql * remove hard code string * support mingw i386 --- packages/m/mysql/xmake.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/m/mysql/xmake.lua b/packages/m/mysql/xmake.lua index 30e1b246b..57567dde4 100644 --- a/packages/m/mysql/xmake.lua +++ b/packages/m/mysql/xmake.lua @@ -12,9 +12,17 @@ package("mysql") if is_plat("windows") then set_urls("https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-$(version).tar.gz") add_versions("8.0.31", "67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa") + end - add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean"}) - add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MT"}) + if is_plat("mingw") then + add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly=true}) + if is_arch("i386") then + set_urls("https://github.com/xmake-mirror/mysql/releases/download/$(version)/mysql_$(version)_x86.zip") + add_versions("8.0.31", "fd626cae72b1f697b941cd3a2ea9d93507e689adabb1c2c11d465f01f4b07cb9") + else + set_urls("https://github.com/xmake-mirror/mysql/releases/download/$(version)/mysql_$(version)_x64.zip") + add_versions("8.0.31", "26312cfa871c101b7a55cea96278f9d14d469455091c4fd3ffaaa67a2d1aeea5") + end end if is_plat("macosx", "linux", "windows") then @@ -26,7 +34,7 @@ package("mysql") add_includedirs("include", "include/mysql") - on_load("windows", function(package) + on_load("windows", "mingw", function(package) if package:version():ge("8.0.0") then package:add("deps", "boost") package:add("deps", "openssl 1.1.1-t") @@ -36,6 +44,12 @@ package("mysql") end end) + on_install("mingw", function (package) + os.cp("lib", package:installdir()) + os.cp("include", package:installdir()) + os.cp("lib/libmysql.dll", package:installdir("bin")) + end) + on_install("windows", function (package) io.gsub("CMakeLists.txt", "ADD_SUBDIRECTORY%(storage/ndb%)", "") local configs = {"-DCOMPILATION_COMMENT=XMake",