diff --git a/packages/d/duckx/xmake.lua b/packages/d/duckx/xmake.lua new file mode 100644 index 000000000..d236998b4 --- /dev/null +++ b/packages/d/duckx/xmake.lua @@ -0,0 +1,41 @@ +package("duckx") + set_homepage("https://github.com/amiremohamadi/DuckX") + set_description("C++ library for creating and modifying Microsoft Word (.docx) files") + set_license("MIT") + + add_urls("https://github.com/amiremohamadi/DuckX.git") + add_versions("2021.08.05", "6b6656309d7a46a483267abd1d591ef41226badd") + + add_deps("kuba-zip", "pugixml") + + on_install("windows", "linux", "macosx", "mingw", function (package) + io.writefile("xmake.lua", [[ + add_requires("kuba-zip", "pugixml") + add_rules("mode.debug", "mode.release") + set_languages("c++11") + target("duckx") + set_kind("$(kind)") + add_files("src/duckx.cpp") + add_includedirs("include") + add_headerfiles("include/*.hpp", {prefixdir = "duckx"}) + if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all", {export_classes = true}) + end + add_packages("kuba-zip", "pugixml") + ]]) + io.replace("include/duckx.hpp", "zip.h", "zip/zip.h", {plain = true}) + io.replace("include/duckx.hpp", "", [["constants.hpp"]], {plain = true}) + io.replace("include/duckx.hpp", "", [["duckxiterator.hpp"]], {plain = true}) + io.replace("src/duckx.cpp", "zip_total_entries", "zip_entries_total", {plain = true}) + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + duckx::Document doc("file.docx"); + doc.open(); + } + ]]}, {configs = {languages = "c++11"}})) + end) diff --git a/packages/k/kuba-zip/xmake.lua b/packages/k/kuba-zip/xmake.lua index 9adf1dbab..afd2e5afe 100644 --- a/packages/k/kuba-zip/xmake.lua +++ b/packages/k/kuba-zip/xmake.lua @@ -1,25 +1,28 @@ package("kuba-zip") - set_homepage("https://github.com/kuba--/zip") set_description("A portable, simple zip library written in C") + set_license("Unlicense") add_urls("https://github.com/kuba--/zip/archive/refs/tags/$(version).tar.gz", "https://github.com/kuba--/zip.git") + add_versions("v0.2.2", "f278b1da5e5382c7a1a1db1502cfa1f6df6b1e05e36253d661344d30277f9895") add_versions("v0.2.5", "e052f6cbe6713f69f8caec61214fda4e5ae5150d1fcba02c9e79f1a05d939305") add_versions("v0.2.6", "6a00e10dc5242f614f76f1bd1d814726a41ee6e3856ef3caf7c73de0b63acf0b") add_deps("cmake") - on_load("windows", "mingw@windows", function (package) - if package:config("shared") then - package:add("defines", "ZIP_SHARED") - end - end) - on_install("windows", "macosx", "linux", "mingw@windows", function (package) + on_install("windows", "macosx", "linux", "mingw", function (package) local configs = {"-DCMAKE_DISABLE_TESTING=ON", "-DZIP_BUILD_DOCS=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) - table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + if package:config("shared") then + table.insert(configs, "-DBUILD_SHARED_LIBS=ON") + if package:is_plat("windows", "mingw") then + package:add("defines", "ZIP_SHARED") + end + else + table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") + end import("package.tools.cmake").install(package, configs) end)