Add MinGW support to libcurl, lua and sol2 (#574)

pull/580/head
Jérôme Leclercq 3 years ago committed by GitHub
parent 4c18c9879c
commit d8ac66838e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/linux.yml
  2. 6
      packages/l/libcurl/xmake.lua
  3. 35
      packages/l/lua/xmake.lua
  4. 2
      packages/s/sol2/xmake.lua

@ -23,6 +23,7 @@ jobs:
- name: Installation
run: |
# TODO we will remove it later
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 60
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60
@ -34,4 +35,3 @@ jobs:
- name: Tests
run: |
xmake l ./scripts/test.lua -D -k ${{ matrix.kind }}

@ -45,14 +45,16 @@ package("libcurl")
end
end)
on_install("windows", function (package)
on_install("windows", "mingw@windows", function (package)
local configs = {"-DBUILD_TESTING=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCURL_DISABLE_LDAP=ON")
table.insert(configs, "-DCMAKE_USE_SCHANNEL=ON")
table.insert(configs, "-DCMAKE_USE_LIBSSH2=OFF")
table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
if is_plat("windows") then
table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
for name, enabled in pairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
if name == "openssl" then

@ -16,7 +16,7 @@ package("lua")
add_versions("v5.1.5", "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333")
add_includedirs("include/lua")
if not is_plat("windows") then
if not is_plat("windows", "mingw") then
add_syslinks("dl", "m")
end
@ -24,23 +24,42 @@ package("lua")
package:addenv("PATH", "bin")
end)
on_install("linux", "macosx", "windows", "android", "bsd", function (package)
on_install(function (package)
local sourcedir = os.isdir("src") and "src/" or "" -- for tar.gz or git source
if is_plat("iphoneos", "android") then
-- disable system() calls as they're not supported on these platforms
local luaconf = io.open(sourcedir .. "/luaconf.h", "a")
luaconf:write([[
#ifndef lconfig_h_ext
#define lconfig_h_ext
#if defined(LUA_LIB)
/* disable system calls as it's not available on this sytem */
#define system(s) ((s)==NULL ? 0 : -1)
#endif
#endif
]])
luaconf:close()
end
io.writefile("xmake.lua", format([[
local sourcedir = "%s"
local kind = "%s"
local enabled = %s
target("lualib")
set_kind("%s")
set_kind(kind)
set_basename("lua")
add_headerfiles(sourcedir .. "*.h", {prefixdir = "lua"})
add_files(sourcedir .. "*.c|lua.c|luac.c|onelua.c")
add_defines("LUA_COMPAT_5_2", "LUA_COMPAT_5_1")
if is_plat("linux", "bsd") then
if is_plat("linux", "bsd", "cross") then
add_defines("LUA_USE_LINUX")
add_defines("LUA_DL_DLOPEN")
elseif is_plat("macosx") then
elseif is_plat("macosx", "iphoneos") then
add_defines("LUA_USE_MACOSX")
add_defines("LUA_DL_DYLD")
elseif is_plat("windows") then
elseif is_plat("windows", "mingw") then
-- Lua already detects Windows and sets according defines
if is_kind("shared") then
add_defines("LUA_BUILD_AS_DLL", {public = true})
@ -48,11 +67,11 @@ package("lua")
end
target("lua")
set_enabled(%s)
set_enabled(enabled)
set_kind("binary")
add_files(sourcedir .. "lua.c")
add_deps("lualib")
if not is_plat("windows") then
if not is_plat("windows", "mingw") then
add_syslinks("dl")
end
]], sourcedir,

@ -21,7 +21,7 @@ package("sol2")
end
end)
on_install("linux", "macosx", "windows", function (package)
on_install(function (package)
local configs = {}
import("package.tools.cmake").install(package, configs)
end)

Loading…
Cancel
Save