From bf0f8250ef0c25c6a921b172b49a5b78cc960845 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Sun, 30 Aug 2020 12:34:54 +0200 Subject: [PATCH 1/3] Add libsdl_net --- packages/l/libsdl_net/xmake.lua | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/l/libsdl_net/xmake.lua diff --git a/packages/l/libsdl_net/xmake.lua b/packages/l/libsdl_net/xmake.lua new file mode 100644 index 000000000..32e5d1f64 --- /dev/null +++ b/packages/l/libsdl_net/xmake.lua @@ -0,0 +1,43 @@ +package("libsdl_net") + add_deps("libsdl") + + set_homepage("https://www.libsdl.org/projects/SDL_net/") + set_description("Simple DirectMedia Layer networking library") + + if is_plat("windows", "mingw") then + set_urls("https://www.libsdl.org/projects/SDL_net/release/SDL2_net-devel-$(version)-VC.zip") + add_versions("2.0.1", "c1e423f2068adc6ff1070fa3d6a7886700200538b78fd5adc36903a5311a243e") + else + set_urls("https://www.libsdl.org/projects/SDL_net/release/SDL2_net-$(version).zip") + add_versions("2.0.1", "52031ed9d08a5eb1eda40e9a0409248bf532dde5e8babff5780ef1925657d59f") + end + + add_links("SDL2_net") + + on_install("windows", "mingw", function (package) + local arch = package:arch() + if package:is_plat("mingw") then + arch = (arch == "x86_64") and "x64" or "x86" + end + + os.cp("include/*", package:installdir("include/SDL2")) + os.cp(path.join("lib", arch, "*.lib"), package:installdir("lib")) + os.cp(path.join("lib", arch, "*.dll"), package:installdir("lib")) + end) + + on_install("macosx", "linux", function (package) + local configs = {} + if package:config("shared") then + table.insert(configs, "--enable-shared=yes") + else + table.insert(configs, "--enable-shared=no") + end + + table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir()) + + import("package.tools.autoconf").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("SDLNet_Init", {includes = "SDL2/SDL_net.h", configs = {defines = "SDL_MAIN_HANDLED"}})) + end) \ No newline at end of file From d4d91773cd1f933a5b3276f1b69033d3312416e9 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Sun, 30 Aug 2020 13:31:56 +0200 Subject: [PATCH 2/3] Move set_homepage to top in libsdl_net --- packages/l/libsdl_net/xmake.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/l/libsdl_net/xmake.lua b/packages/l/libsdl_net/xmake.lua index 32e5d1f64..ab8e94e2c 100644 --- a/packages/l/libsdl_net/xmake.lua +++ b/packages/l/libsdl_net/xmake.lua @@ -1,5 +1,4 @@ package("libsdl_net") - add_deps("libsdl") set_homepage("https://www.libsdl.org/projects/SDL_net/") set_description("Simple DirectMedia Layer networking library") @@ -12,6 +11,8 @@ package("libsdl_net") add_versions("2.0.1", "52031ed9d08a5eb1eda40e9a0409248bf532dde5e8babff5780ef1925657d59f") end + add_deps("libsdl") + add_links("SDL2_net") on_install("windows", "mingw", function (package) From aa8694099e894e7a861ff07398b7ae9272641fd1 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Sun, 30 Aug 2020 14:11:58 +0200 Subject: [PATCH 3/3] Remove redundant blank lines in libsdl_net --- packages/l/libsdl_net/xmake.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/l/libsdl_net/xmake.lua b/packages/l/libsdl_net/xmake.lua index ab8e94e2c..1f866af04 100644 --- a/packages/l/libsdl_net/xmake.lua +++ b/packages/l/libsdl_net/xmake.lua @@ -20,7 +20,6 @@ package("libsdl_net") if package:is_plat("mingw") then arch = (arch == "x86_64") and "x64" or "x86" end - os.cp("include/*", package:installdir("include/SDL2")) os.cp(path.join("lib", arch, "*.lib"), package:installdir("lib")) os.cp(path.join("lib", arch, "*.dll"), package:installdir("lib")) @@ -33,9 +32,7 @@ package("libsdl_net") else table.insert(configs, "--enable-shared=no") end - table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir()) - import("package.tools.autoconf").install(package, configs) end)