From 67314da9aea10c393c5e44be834b6fe6366daa5e Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 29 Aug 2021 02:03:00 +0200 Subject: [PATCH] Add extsources to libsdl (#599) * Add extsources to libsdl * Update xmake.lua --- packages/l/libsdl/xmake.lua | 18 +++++++++++++++--- packages/l/libsdl_gfx/xmake.lua | 4 +++- packages/l/libsdl_image/xmake.lua | 4 +++- packages/l/libsdl_mixer/xmake.lua | 4 +++- packages/l/libsdl_net/xmake.lua | 4 +++- packages/l/libsdl_ttf/xmake.lua | 4 +++- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/packages/l/libsdl/xmake.lua b/packages/l/libsdl/xmake.lua index 0233bbe5a..90a3c0336 100644 --- a/packages/l/libsdl/xmake.lua +++ b/packages/l/libsdl/xmake.lua @@ -2,6 +2,15 @@ package("libsdl") set_homepage("https://www.libsdl.org/") set_description("Simple DirectMedia Layer") + + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2") + elseif is_plat("linux") then + add_extsources("pacman::sdl2", "apt::libsdl2-dev") + elseif is_plat("macosx") then + add_extsources("brew::sdl2") + end + set_license("zlib") if is_plat("windows", "mingw") then @@ -121,10 +130,13 @@ package("libsdl") local cflags = {} if package:is_plat("linux") then for _, depname in ipairs({"libxext", "libx11", "xorgproto"}) do - local dep = package:dep(depname):fetch() + local dep = package:dep(depname) if dep then - for _, includedir in ipairs(dep.includedirs or dep.sysincludedirs) do - table.join2(cflags, "-I" .. includedir) + local depfetch = dep:fetch() + if depfetch then + for _, includedir in ipairs(depfetch.includedirs or depfetch.sysincludedirs) do + table.join2(cflags, "-I" .. includedir) + end end end end diff --git a/packages/l/libsdl_gfx/xmake.lua b/packages/l/libsdl_gfx/xmake.lua index b8c24588f..19ebf0316 100644 --- a/packages/l/libsdl_gfx/xmake.lua +++ b/packages/l/libsdl_gfx/xmake.lua @@ -17,7 +17,9 @@ package("libsdl_gfx") add_versions("1.0.4", "63e0e01addedc9df2f85b93a248f06e8a04affa014a835c2ea34bfe34e576262") end - if is_plat("linux") then + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2_gfx") + elseif is_plat("linux") then add_extsources("pacman::sdl2_gfx", "apt::libsdl2-gfx-dev") elseif is_plat("macosx") then add_extsources("brew::sdl2_gfx") diff --git a/packages/l/libsdl_image/xmake.lua b/packages/l/libsdl_image/xmake.lua index 3feffd1eb..8645ce4ed 100644 --- a/packages/l/libsdl_image/xmake.lua +++ b/packages/l/libsdl_image/xmake.lua @@ -11,7 +11,9 @@ package("libsdl_image") add_versions("2.0.5", "eee0927d1e7819d57c623fe3e2b3c6761c77c474fe9bc425e8674d30ac049b1c") end - if is_plat("linux") then + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2_image") + elseif is_plat("linux") then add_extsources("pacman::sdl2_image", "apt::libsdl2-image-dev") elseif is_plat("macosx") then add_extsources("brew::sdl2_image") diff --git a/packages/l/libsdl_mixer/xmake.lua b/packages/l/libsdl_mixer/xmake.lua index 6b48f860a..5276b0ebe 100644 --- a/packages/l/libsdl_mixer/xmake.lua +++ b/packages/l/libsdl_mixer/xmake.lua @@ -11,7 +11,9 @@ package("libsdl_mixer") add_versions("2.0.4", "9affb8c7bf6fbffda0f6906bfb99c0ea50dca9b188ba9e15be90042dc03c5ded") end - if is_plat("linux") then + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2_mixer") + elseif is_plat("linux") then add_extsources("pacman::sdl2_mixer", "apt::libsdl2-mixer-dev") elseif is_plat("macosx") then add_extsources("brew::sdl2_mixer") diff --git a/packages/l/libsdl_net/xmake.lua b/packages/l/libsdl_net/xmake.lua index e2f240a63..5af1af63c 100644 --- a/packages/l/libsdl_net/xmake.lua +++ b/packages/l/libsdl_net/xmake.lua @@ -11,7 +11,9 @@ package("libsdl_net") add_versions("2.0.1", "52031ed9d08a5eb1eda40e9a0409248bf532dde5e8babff5780ef1925657d59f") end - if is_plat("linux") then + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2_net") + elseif is_plat("linux") then add_extsources("pacman::sdl2_net", "apt::libsdl2-net-dev") elseif is_plat("macosx") then add_extsources("brew::sdl2_net") diff --git a/packages/l/libsdl_ttf/xmake.lua b/packages/l/libsdl_ttf/xmake.lua index 557f98c7c..8113ac057 100644 --- a/packages/l/libsdl_ttf/xmake.lua +++ b/packages/l/libsdl_ttf/xmake.lua @@ -11,7 +11,9 @@ package("libsdl_ttf") add_versions("2.0.15", "cdb72b5b1c3b27795fa128af36f369fee5d3e38a96c350855da0b81880555dbc") end - if is_plat("linux") then + if is_plat("mingw") and is_subhost("msys") then + add_extsources("pacman::SDL2_ttf") + elseif is_plat("linux") then add_extsources("pacman::sdl2_ttf", "apt::libsdl2-ttf-dev") elseif is_plat("macosx") then add_extsources("brew::sdl2_ttf")