Fix libsdl_* .dll installation and run (#403)

* Fix libsdl_* .dll installation

* libsdl_*: Add support for pic

* Fix libsdl_gfx build on Windows

* Fix libsdl_x building with a system libsdl

* libsdl: Use private inheritance for libxext
pull/405/head
Jérôme Leclercq 4 years ago committed by GitHub
parent 6f4f43f974
commit 7936c24ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/l/libsdl/xmake.lua
  2. 13
      packages/l/libsdl_gfx/xmake.lua
  3. 12
      packages/l/libsdl_image/xmake.lua
  4. 12
      packages/l/libsdl_mixer/xmake.lua
  5. 12
      packages/l/libsdl_net/xmake.lua
  6. 12
      packages/l/libsdl_ttf/xmake.lua

@ -36,7 +36,7 @@ package("libsdl")
package:add("defines", "SDL_MAIN_HANDLED")
end
if package:is_plat("linux") and package:config("with_x") then
package:add("deps", "libxext")
package:add("deps", "libxext", {private = true})
end
if package:is_plat("macosx") and package:version():ge("2.0.14") then
package:add("frameworks", "CoreHaptics", "GameController")

@ -30,6 +30,9 @@ package("libsdl_gfx")
content = content:gsub("%%%(AdditionalLibraryDirectories%)", package:dep("libsdl"):installdir("lib") .. ";%%%(AdditionalLibraryDirectories%)")
io.writefile(file_name, content)
-- MSVC trick no longer required since C++11
io.replace("SDL2_gfxPrimitives.c", "#if defined(_MSC_VER)", "#if 0", {plain = true})
local configs = {}
local arch = package:is_arch("x86") and "Win32" or "x64"
local mode = package:debug() and "Debug" or "Release"
@ -42,7 +45,7 @@ package("libsdl_gfx")
local build_dir = path.join(arch, mode)
os.cp(path.join(build_dir, "*.lib"), package:installdir("lib"))
os.cp(path.join(build_dir, "*.dll"), package:installdir("lib"))
os.cp(path.join(build_dir, "*.dll"), package:installdir("bin"))
os.cp("*.h", package:installdir("include", "SDL2"))
end)
@ -53,7 +56,13 @@ package("libsdl_gfx")
else
table.insert(configs, "--enable-shared=no")
end
table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir())
if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
local libsdl = package:dep("libsdl")
if libsdl and not libsdl:is_system() then
table.insert(configs, "--with-sdl-prefix=" .. libsdl:installdir())
end
import("package.tools.autoconf").install(package, configs)
end)

@ -22,7 +22,7 @@ package("libsdl_image")
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"))
os.cp(path.join("lib", arch, "*.dll"), package:installdir("bin"))
end)
on_install("macosx", "linux", function (package)
@ -32,10 +32,16 @@ package("libsdl_image")
else
table.insert(configs, "--enable-shared=no")
end
table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir())
if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
local libsdl = package:dep("libsdl")
if libsdl and not libsdl:is_system() then
table.insert(configs, "--with-sdl-prefix=" .. libsdl:installdir())
end
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("IMG_Init", {includes = "SDL2/SDL_image.h", configs = {defines = "SDL_MAIN_HANDLED"}}))
end)
end)

@ -22,7 +22,7 @@ package("libsdl_mixer")
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"))
os.cp(path.join("lib", arch, "*.dll"), package:installdir("bin"))
end)
on_install("macosx", "linux", function (package)
@ -32,10 +32,16 @@ package("libsdl_mixer")
else
table.insert(configs, "--enable-shared=no")
end
table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir())
if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
local libsdl = package:dep("libsdl")
if libsdl and not libsdl:is_system() then
table.insert(configs, "--with-sdl-prefix=" .. libsdl:installdir())
end
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("Mix_Init", {includes = "SDL2/SDL_mixer.h", configs = {defines = "SDL_MAIN_HANDLED"}}))
end)
end)

@ -22,7 +22,7 @@ package("libsdl_net")
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"))
os.cp(path.join("lib", arch, "*.dll"), package:installdir("bin"))
end)
on_install("macosx", "linux", function (package)
@ -32,10 +32,16 @@ package("libsdl_net")
else
table.insert(configs, "--enable-shared=no")
end
table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir())
if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
local libsdl = package:dep("libsdl")
if libsdl and not libsdl:is_system() then
table.insert(configs, "--with-sdl-prefix=" .. libsdl:installdir())
end
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)
end)

@ -25,7 +25,7 @@ package("libsdl_ttf")
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"))
os.cp(path.join("lib", arch, "*.dll"), package:installdir("bin"))
end)
on_install("macosx", "linux", function (package)
@ -35,10 +35,16 @@ package("libsdl_ttf")
else
table.insert(configs, "--enable-shared=no")
end
table.insert(configs, "--with-sdl-prefix=" .. package:dep("libsdl"):installdir())
if package:is_plat("linux") and package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
local libsdl = package:dep("libsdl")
if libsdl and not libsdl:is_system() then
table.insert(configs, "--with-sdl-prefix=" .. libsdl:installdir())
end
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("TTF_Init", {includes = "SDL2/SDL_ttf.h", configs = {defines = "SDL_MAIN_HANDLED"}}))
end)
end)

Loading…
Cancel
Save