|
@@ -3,7 +3,7 @@ package("libsdl")
|
|
|
set_homepage("https://www.libsdl.org/")
|
|
|
set_description("Simple DirectMedia Layer")
|
|
|
|
|
|
- if is_plat("windows") then
|
|
|
+ if is_plat("windows", "mingw") then
|
|
|
set_urls("https://www.libsdl.org/release/SDL2-devel-$(version)-VC.zip")
|
|
|
add_versions("2.0.8", "68505e1f7c16d8538e116405411205355a029dcf2df738dbbc768b2fe95d20fd")
|
|
|
else
|
|
@@ -11,12 +11,37 @@ package("libsdl")
|
|
|
add_versions("2.0.8", "e6a7c71154c3001e318ba7ed4b98582de72ff970aca05abc9f45f7cbdc9088cb")
|
|
|
end
|
|
|
|
|
|
- on_install("windows", function (package)
|
|
|
- os.cp("include", package:installdir())
|
|
|
- os.cp("lib/$(arch)/*.lib", package:installdir("lib"))
|
|
|
- os.cp("lib/$(arch)/*.dll", package:installdir("lib"))
|
|
|
+ if is_plat("macosx") then
|
|
|
+ add_frameworks("OpenGL", "CoreVideo", "CoreAudio", "AudioToolbox", "Carbon", "CoreGraphics", "ForceFeedback", "Metal", "AppKit", "IOKit", "CoreFoundation", "Foundation")
|
|
|
+ add_syslinks("iconv")
|
|
|
+ elseif is_plat("linux") then
|
|
|
+ add_syslinks("pthread", "dl")
|
|
|
+ elseif is_plat("windows", "mingw") then
|
|
|
+ add_syslinks("gdi32", "user32", "winmm", "shell32")
|
|
|
+ end
|
|
|
+
|
|
|
+ on_install("windows", "mingw", function (package)
|
|
|
+ local arch = package:arch()
|
|
|
+ if arch == "x86_64" then
|
|
|
+ arch = "x64"
|
|
|
+ else
|
|
|
+ arch = "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)
|
|
|
- import("package.tools.autoconf").install(package)
|
|
|
+ local configs = {}
|
|
|
+ if package:config("shared") then
|
|
|
+ table.insert(configs, "--enable-shared=yes")
|
|
|
+ else
|
|
|
+ table.insert(configs, "--enable-shared=no")
|
|
|
+ end
|
|
|
+ import("package.tools.autoconf").install(package, configs)
|
|
|
+ end)
|
|
|
+
|
|
|
+ on_test(function (package)
|
|
|
+ assert(package:has_cfuncs("SDL_Init", {includes = "SDL2/SDL.h"}))
|
|
|
end)
|