package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.9 KiB

4 years ago
package("libsdl_ttf")
set_homepage("https://www.libsdl.org/projects/SDL_ttf/")
set_description("Simple DirectMedia Layer text rendering library")
if is_plat("windows", "mingw") then
set_urls("https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-$(version)-VC.zip")
add_versions("2.0.15", "aab0d81f1aa6fe654be412efc85829f2b188165dca6c90eb4b12b673f93e054b")
else
set_urls("https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$(version).zip")
add_versions("2.0.15", "cdb72b5b1c3b27795fa128af36f369fee5d3e38a96c350855da0b81880555dbc")
end
add_deps("libsdl")
if is_plat("linux", "macosx") then
add_deps("freetype")
end
4 years ago
add_links("SDL2_ttf")
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("bin"))
4 years ago
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
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
4 years ago
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)