Browse Source

Add extsources to libsdl (#599)

* Add extsources to libsdl

* Update xmake.lua
ImperatorS79 4 years ago
parent
commit
67314da9ae

+ 15 - 3
packages/l/libsdl/xmake.lua

@@ -2,6 +2,15 @@ package("libsdl")
 
 
     set_homepage("https://www.libsdl.org/")
     set_homepage("https://www.libsdl.org/")
     set_description("Simple DirectMedia Layer")
     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")
     set_license("zlib")
 
 
     if is_plat("windows", "mingw") then
     if is_plat("windows", "mingw") then
@@ -121,10 +130,13 @@ package("libsdl")
         local cflags = {}
         local cflags = {}
         if package:is_plat("linux") then
         if package:is_plat("linux") then
             for _, depname in ipairs({"libxext", "libx11", "xorgproto"}) do
             for _, depname in ipairs({"libxext", "libx11", "xorgproto"}) do
-                local dep = package:dep(depname):fetch()
+                local dep = package:dep(depname)
                 if dep then
                 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
                 end
             end
             end

+ 3 - 1
packages/l/libsdl_gfx/xmake.lua

@@ -17,7 +17,9 @@ package("libsdl_gfx")
         add_versions("1.0.4", "63e0e01addedc9df2f85b93a248f06e8a04affa014a835c2ea34bfe34e576262")
         add_versions("1.0.4", "63e0e01addedc9df2f85b93a248f06e8a04affa014a835c2ea34bfe34e576262")
     end
     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")
         add_extsources("pacman::sdl2_gfx", "apt::libsdl2-gfx-dev")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_extsources("brew::sdl2_gfx")
         add_extsources("brew::sdl2_gfx")

+ 3 - 1
packages/l/libsdl_image/xmake.lua

@@ -11,7 +11,9 @@ package("libsdl_image")
         add_versions("2.0.5", "eee0927d1e7819d57c623fe3e2b3c6761c77c474fe9bc425e8674d30ac049b1c")
         add_versions("2.0.5", "eee0927d1e7819d57c623fe3e2b3c6761c77c474fe9bc425e8674d30ac049b1c")
     end
     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")
         add_extsources("pacman::sdl2_image", "apt::libsdl2-image-dev")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_extsources("brew::sdl2_image")
         add_extsources("brew::sdl2_image")

+ 3 - 1
packages/l/libsdl_mixer/xmake.lua

@@ -11,7 +11,9 @@ package("libsdl_mixer")
         add_versions("2.0.4", "9affb8c7bf6fbffda0f6906bfb99c0ea50dca9b188ba9e15be90042dc03c5ded")
         add_versions("2.0.4", "9affb8c7bf6fbffda0f6906bfb99c0ea50dca9b188ba9e15be90042dc03c5ded")
     end
     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")
         add_extsources("pacman::sdl2_mixer", "apt::libsdl2-mixer-dev")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_extsources("brew::sdl2_mixer")
         add_extsources("brew::sdl2_mixer")

+ 3 - 1
packages/l/libsdl_net/xmake.lua

@@ -11,7 +11,9 @@ package("libsdl_net")
         add_versions("2.0.1", "52031ed9d08a5eb1eda40e9a0409248bf532dde5e8babff5780ef1925657d59f")
         add_versions("2.0.1", "52031ed9d08a5eb1eda40e9a0409248bf532dde5e8babff5780ef1925657d59f")
     end
     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")
         add_extsources("pacman::sdl2_net", "apt::libsdl2-net-dev")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_extsources("brew::sdl2_net")
         add_extsources("brew::sdl2_net")

+ 3 - 1
packages/l/libsdl_ttf/xmake.lua

@@ -11,7 +11,9 @@ package("libsdl_ttf")
         add_versions("2.0.15", "cdb72b5b1c3b27795fa128af36f369fee5d3e38a96c350855da0b81880555dbc")
         add_versions("2.0.15", "cdb72b5b1c3b27795fa128af36f369fee5d3e38a96c350855da0b81880555dbc")
     end
     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")
         add_extsources("pacman::sdl2_ttf", "apt::libsdl2-ttf-dev")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_extsources("brew::sdl2_ttf")
         add_extsources("brew::sdl2_ttf")