Skip to content

Commit

Permalink
libsvgtiny: add package
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Sep 30, 2024
1 parent b4b9231 commit 40bdc7b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/l/libsvgtiny/port/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
add_rules("mode.debug", "mode.release")

add_requires("gperf")
add_packages("gperf")

add_requires("libdom")
add_packages("libdom")

target("svgtiny")
set_kind("$(kind)")
add_files("src/*.c")
add_includedirs("include")
add_headerfiles("include/(*.h)")

if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end

before_build(function (target)
local gperf
if is_subhost("windows") then
gperf = path.join(target:pkg("gperf"):installdir(), "bin/gperf.exe")
else
gperf = "gperf"
end
os.vrunv(gperf, {"src/colors.gperf", "--output-file=src/autogenerated_colors.c"})
end)
24 changes: 24 additions & 0 deletions packages/l/libsvgtiny/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package("libsvgtiny")
set_homepage("https://www.netsurf-browser.org/projects/libsvgtiny")
set_description("Libsvgtiny is a library for parsing SVG files for display.")
set_license("MIT")

set_urls("https://source.netsurf-browser.org/libsvgtiny.git/snapshot/libsvgtiny-release/$(version).tar.bz2",
"git://git.netsurf-browser.org/libsvgtiny.git")

add_versions("0.1.8", "e9e772d3b8e17f26dae26d53187b42e146be9b53632c81e601a60bf9a6ec92a6")

add_deps("gperf")
add_deps("libdom")

on_install(function (package)
os.cd(package:version_str())
io.replace("src/svgtiny.c", "calloc(sizeof(*diagram), 1);", "calloc(1, sizeof(*diagram));", {plain = true})

os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package)
end)

on_test(function (package)
assert(package:has_cfuncs("svgtiny_create", {includes = "svgtiny.h"}))
end)

0 comments on commit 40bdc7b

Please sign in to comment.