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.
48 lines
1.9 KiB
48 lines
1.9 KiB
2 years ago
|
package("uchardet")
|
||
|
set_homepage("https://www.freedesktop.org/wiki/Software/uchardet/")
|
||
|
set_description("uchardet is an encoding detector library, which takes a sequence of bytes in an unknown character encoding without any additional information, and attempts to determine the encoding of the text. ")
|
||
|
add_urls("https://www.freedesktop.org/software/uchardet/releases/uchardet-$(version).tar.xz")
|
||
|
|
||
|
add_versions("0.0.7", "3fc79408ae1d84b406922fa9319ce005631c95ca0f34b205fad867e8b30e45b1")
|
||
|
|
||
|
on_load(function (package)
|
||
|
package:addenv("PATH", "bin")
|
||
|
end)
|
||
|
|
||
|
on_install(function (package)
|
||
|
io.writefile("xmake.lua", [[
|
||
|
add_rules("mode.debug", "mode.release")
|
||
|
if is_plat("windows") then
|
||
|
add_requires("cgetopt")
|
||
|
end
|
||
|
target("uchardet")
|
||
|
set_kind("$(kind)")
|
||
|
add_includedirs("src")
|
||
|
add_headerfiles("src/uchardet.h")
|
||
|
if is_kind("shared") then
|
||
|
add_defines("UCHARDET_SHARED")
|
||
|
end
|
||
|
add_defines("BUILDING_UCHARDET")
|
||
|
add_files("src/*.cpp", "src/LangModels/*.cpp")
|
||
|
target("uchardet_bin")
|
||
|
set_kind("binary")
|
||
|
set_basename("uchardet")
|
||
|
add_files("src/tools/uchardet.cpp")
|
||
|
add_deps("uchardet")
|
||
|
if is_plat("windows") then
|
||
|
add_packages("cgetopt")
|
||
|
end
|
||
|
]])
|
||
|
local configs = {}
|
||
|
if package:config("shared") then
|
||
|
configs.kind = "shared"
|
||
|
end
|
||
|
import("package.tools.xmake").install(package, configs)
|
||
|
end)
|
||
|
|
||
|
on_test(function (package)
|
||
|
if package:is_plat(os.host()) then
|
||
|
os.vrun("uchardet -v")
|
||
|
end
|
||
|
assert(package:has_cfuncs("uchardet_get_charset", {includes = "uchardet.h"}))
|
||
|
end)
|