From 1e071114bfea1e51b85b6578f3aeb178a5bfe05b Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Sat, 27 Nov 2021 20:46:21 +0800 Subject: [PATCH] add loguru, pegtl and utfcpp (#717) * add loguru * add utfcpp * update icu4c * update vtk * fix loguru cross compilation * fix bsd build * add pegtl --- .../i/icu4c/patches/70.1/replace-py-3.patch | 33 +++++++++++ packages/i/icu4c/xmake.lua | 2 + packages/l/loguru/xmake.lua | 56 +++++++++++++++++++ packages/p/pegtl/xmake.lua | 25 +++++++++ packages/u/utfcpp/xmake.lua | 30 ++++++++++ packages/v/vtk/xmake.lua | 3 +- 6 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 packages/i/icu4c/patches/70.1/replace-py-3.patch create mode 100644 packages/l/loguru/xmake.lua create mode 100644 packages/p/pegtl/xmake.lua create mode 100644 packages/u/utfcpp/xmake.lua diff --git a/packages/i/icu4c/patches/70.1/replace-py-3.patch b/packages/i/icu4c/patches/70.1/replace-py-3.patch new file mode 100644 index 000000000..0a7ef611e --- /dev/null +++ b/packages/i/icu4c/patches/70.1/replace-py-3.patch @@ -0,0 +1,33 @@ +diff --git a/source/data/makedata.mak b/source/data/makedata.mak +--- a/source/data/makedata.mak ++++ b/source/data/makedata.mak +@@ -33,7 +33,7 @@ ICU_LIB_TARGET=$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll + !ENDIF + !MESSAGE ICU data make path is $(ICUMAKE) + +-!IF [py -3 -c "exit(0)"]!=0 ++!IF [python -c "exit(0)"]!=0 + !MESSAGE Information: Unable to find Python 3. Data will fail to build from source. + !ENDIF + +@@ -303,7 +303,7 @@ + $(COREDATA_TS): + @cd "$(ICUSRCDATA)" + set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH% +- py -3 -B -m icutools.databuilder \ ++ python -B -m icutools.databuilder \ + --mode windows-exec \ + --src_dir "$(ICUSRCDATA)" \ + --tool_dir "$(ICUTOOLS)" \ +diff --git a/source/test/testdata/testdata.mak b/source/test/testdata/testdata.mak +--- a/source/test/testdata/testdata.mak ++++ b/source/test/testdata/testdata.mak +@@ -35,7 +35,7 @@ CREATE_DIRS : + "$(TESTDATAOUT)\testdata.dat" : + @echo Building test data + set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH% +- py -3 -B -m icutools.databuilder \ ++ python -B -m icutools.databuilder \ + --mode windows-exec \ + --tool_dir "$(ICUTOOLS)" \ + --tool_cfg "$(CFG)" \ diff --git a/packages/i/icu4c/xmake.lua b/packages/i/icu4c/xmake.lua index 960db9c9a..1c24fb96d 100644 --- a/packages/i/icu4c/xmake.lua +++ b/packages/i/icu4c/xmake.lua @@ -6,12 +6,14 @@ package("icu4c") add_urls("https://github.com/unicode-org/icu/releases/download/release-$(version)-src.tgz", {version = function (version) return (version:gsub("%.", "-")) .. "/icu4c-" .. (version:gsub("%.", "_")) end}) + add_versions("70.1", "8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5") add_versions("69.1", "4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745") add_versions("68.2", "c79193dee3907a2199b8296a93b52c5cb74332c26f3d167269487680d479d625") add_versions("68.1", "a9f2e3d8b4434b8e53878b4308bd1e6ee51c9c7042e2b1a376abefb6fbb29f2d") add_versions("64.2", "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c") add_patches("69.1", path.join(os.scriptdir(), "patches", "69.1", "replace-py-3.patch"), "ae27a55b0e79a8420024d6d349a7bae850e1dd403a8e1131e711c405ddb099b9") + add_patches("70.1", path.join(os.scriptdir(), "patches", "70.1", "replace-py-3.patch"), "6469739da001721122b62af513370ed62901caf43af127de3f27ea2128830e35") add_links("icuuc", "icutu", "icui18n", "icuio", "icudata") if is_plat("linux") then diff --git a/packages/l/loguru/xmake.lua b/packages/l/loguru/xmake.lua new file mode 100644 index 000000000..41d44778c --- /dev/null +++ b/packages/l/loguru/xmake.lua @@ -0,0 +1,56 @@ +package("loguru") + + set_homepage("https://github.com/emilk/loguru") + set_description("A lightweight C++ logging library") + + add_urls("https://github.com/emilk/loguru/archive/refs/tags/$(version).tar.gz", + "https://github.com/emilk/loguru.git") + add_versions("v2.1.0", "1a3be62ebec5609af60b1e094109a93b7412198b896bb88f31dcfe4d95b79ce7") + + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + add_configs("fmt", {description = "Use fmt to format the log.", default = false, type = "boolean"}) + + if is_plat("linux") then + add_syslinks("pthread", "dl") + elseif is_plat("bsd") then + add_syslinks("pthread", "dl", "execinfo") + end + on_load(function (package) + if package:config("fmt") then + package:add("deps", "fmt") + package:add("defines", "LOGURU_USE_FMTLIB") + end + end) + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + set_languages("cxx11") + option("with_fmt", {default = false, showmenu = true}) + if has_config("with_fmt") then + add_requires("fmt") + end + target("loguru") + set_kind("static") + add_files("loguru.cpp") + add_headerfiles("loguru.hpp") + if is_plat("cross") then + add_defines("LOGURU_STACKTRACES=0") + end + if has_config("with_fmt") then + add_packages("fmt") + add_defines("LOGURU_USE_FMTLIB") + end + ]]) + import("package.tools.xmake").install(package, {with_fmt = package:config("fmt")}) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + void test(int argc, char* argv[]) { + loguru::init(argc, argv); + LOG_F(INFO, "Hello from main.cpp!"); + } + ]]}, {configs = {languages = "c++11"}})) + end) diff --git a/packages/p/pegtl/xmake.lua b/packages/p/pegtl/xmake.lua new file mode 100644 index 000000000..98937d292 --- /dev/null +++ b/packages/p/pegtl/xmake.lua @@ -0,0 +1,25 @@ +package("pegtl") + + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/taocpp/PEGTL") + set_description("Parsing Expression Grammar Template Library") + set_license("BSL-1.0") + + add_urls("https://github.com/taocpp/PEGTL/archive/refs/tags/$(version).tar.gz", + "https://github.com/taocpp/PEGTL.git") + add_versions("3.2.2", "c6616275e78c618c016b79054eed0a0bdf4c1934f830d3ab33d3c3dac7320b03") + + add_deps("cmake") + on_install("windows", "macosx", "linux", "mingw", function (package) + import("package.tools.cmake").install(package, {"-DPEGTL_BUILD_TESTS=OFF", "-DPEGTL_BUILD_EXAMPLES=OFF"}) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + namespace pegtl = TAO_PEGTL_NAMESPACE; + void test(int argc, char *argv[]) { + pegtl::argv_input in(argv, 1); + } + ]]}, {configs = {languages = "c++17"}})) + end) diff --git a/packages/u/utfcpp/xmake.lua b/packages/u/utfcpp/xmake.lua new file mode 100644 index 000000000..09974d52d --- /dev/null +++ b/packages/u/utfcpp/xmake.lua @@ -0,0 +1,30 @@ +package("utfcpp") + + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/nemtrif/utfcpp") + set_description("UTF8-CPP: UTF-8 with C++ in a Portable Way") + set_license("BSL-1.0") + + add_urls("https://github.com/nemtrif/utfcpp/archive/refs/tags/$(version).tar.gz", + "https://github.com/nemtrif/utfcpp.git") + add_versions("v3.2.1", "8d6aa7d77ad0abb35bb6139cb9a33597ac4c5b33da6a004ae42429b8598c9605") + + add_extsources("apt::libutfcpp-dev") + + add_deps("cmake") + on_install(function (package) + local configs = {"-DUTF8_TESTS=OFF", "-DUTF8_INSTALL=ON", "-DUTF8_SAMPLES=OFF"} + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #define UTF_CPP_CPLUSPLUS 201103L + #include + void test() { + std::string line("你好,世界"); + std::u16string u16line = utf8::utf8to16(line); + std::string u8line = utf8::utf16to8(u16line); + } + ]]}, {configs = {languages = "c++11"}})) + end) diff --git a/packages/v/vtk/xmake.lua b/packages/v/vtk/xmake.lua index dc41d94b2..ea535ad36 100644 --- a/packages/v/vtk/xmake.lua +++ b/packages/v/vtk/xmake.lua @@ -9,6 +9,7 @@ package("vtk") end}) add_versions("9.0.1", "1b39a5e191c282861e7af4101eaa8585969a2de05f5646c9199a161213a622c7") add_versions("9.0.3", "bc3eb9625b2b8dbfecb6052a2ab091fc91405de4333b0ec68f3323815154ed8a") + add_versions("9.1.0", "8fed42f4f8f1eb8083107b68eaa9ad71da07110161a3116ad807f43e5ca5ce96") add_patches("9.0.3", path.join(os.scriptdir(), "patches", "9.0.3", "limits.patch"), "3bebcd1cac52462b0cf84c8232c3426202c75c944784252b215b4416cbe111db") @@ -21,7 +22,7 @@ package("vtk") on_load("windows", "linux", function (package) local ver = package:version():major() .. "." .. package:version():minor() package:add("includedirs", "include/vtk-" .. ver) - local libs = {"vtkViewsInfovis", "vtkCommonColor", "vtkViewsContext2D", "vtkTestingRendering", "vtkTestingCore", "vtkRenderingVolumeOpenGL2", "vtkRenderingOpenGL2", "vtkglew", "vtkopengl", "vtkRenderingLabel", "vtkoctree", "vtkRenderingLOD", "vtkRenderingImage", "vtkIOVeraOut", "vtkhdf5", "vtkIOTecplotTable", "vtkIOSegY", "vtkIOParallelXML", "vtkIOParallel", "vtkjsoncpp", "vtkIOPLY", "vtkIOOggTheora", "vtktheora", "vtkogg", "vtkIONetCDF", "vtknetcdf", "vtkIOMotionFX", "vtkpegtl", "vtkIOMINC", "vtkIOLSDyna", "vtkIOInfovis", "vtklibxml2", "vtkzlib", "vtkIOImport", "vtkIOGeometry", "vtkIOVideo", "vtkIOMovie", "vtkIOExportPDF", "vtklibharu", "vtkIOExportGL2PS", "vtkRenderingGL2PSOpenGL2", "vtkgl2ps", "vtkpng", "vtkIOExport", "vtkRenderingVtkJS", "vtkRenderingSceneGraph", "vtkIOExodus", "vtkexodusII", "vtkIOEnSight", "vtkIOCityGML", "vtkpugixml", "vtkIOAsynchronous", "vtkIOAMR", "vtkInteractionImage", "vtkImagingStencil", "vtkImagingStatistics", "vtkImagingMorphological", "vtkImagingMath", "vtkIOSQL", "vtksqlite", "vtkGeovisCore", "vtklibproj", "vtkInfovisLayout", "vtkViewsCore", "vtkInteractionWidgets", "vtkRenderingVolume", "vtkRenderingAnnotation", "vtkImagingHybrid", "vtkImagingColor", "vtkInteractionStyle", "vtkFiltersTopology", "vtkFiltersSelection", "vtkFiltersSMP", "vtkFiltersProgrammable", "vtkFiltersPoints", "vtkFiltersVerdict", "vtkverdict", "vtkFiltersParallelImaging", "vtkFiltersImaging", "vtkImagingGeneral", "vtkFiltersHyperTree", "vtkFiltersGeneric", "vtkFiltersFlowPaths", "vtkFiltersAMR", "vtkFiltersParallel", "vtkFiltersTexture", "vtkFiltersModeling", "vtkFiltersHybrid", "vtkRenderingUI", "vtkDomainsChemistry", "vtkChartsCore", "vtkInfovisCore", "vtkFiltersExtraction", "vtkParallelDIY", "vtkdiy2", "vtkIOXML", "vtkIOXMLParser", "vtkexpat", "vtkParallelCore", "vtkIOLegacy", "vtkIOCore", "vtkdoubleconversion", "vtklz4", "vtklzma", "vtkutf8", "vtkFiltersStatistics", "vtkeigen", "vtkImagingFourier", "vtkImagingSources", "vtkIOImage", "vtkDICOMParser", "vtkjpeg", "vtkmetaio", "vtktiff", "vtkRenderingContext2D", "vtkRenderingFreeType", "vtkfreetype", "vtkkwiml", "vtkRenderingCore", "vtkFiltersSources", "vtkImagingCore", "vtkFiltersGeometry", "vtkFiltersGeneral", "vtkCommonComputationalGeometry", "vtkFiltersCore", "vtkCommonExecutionModel", "vtkCommonDataModel", "vtkCommonSystem", "vtkCommonMisc", "vtkCommonTransforms", "vtkCommonMath", "vtkCommonCore", "vtkloguru", "vtksys"} + local libs = {"vtkViewsInfovis", "vtkViewsContext2D", "vtkTestingRendering", "vtkTestingCore", "vtkRenderingVolumeOpenGL2", "vtkRenderingOpenGL2", "vtkRenderingLabel", "vtkRenderingLOD", "vtkRenderingImage", "vtkIOVeraOut", "vtkIOTecplotTable", "vtkIOSegY", "vtkIOParallelXML", "vtkIOParallel", "vtkIOPLY", "vtkIOOggTheora", "vtkIONetCDF", "vtkIOMotionFX", "vtkIOMINC", "vtkIOLSDyna", "vtkIOInfovis", "vtkIOImport", "vtkIOGeometry", "vtkIOVideo", "vtkIOMovie", "vtkIOExportPDF", "vtkIOExportGL2PS", "vtkRenderingGL2PSOpenGL2", "vtkIOExport", "vtkRenderingVtkJS", "vtkRenderingSceneGraph", "vtkIOExodus", "vtkIOEnSight", "vtkIOCityGML", "vtkIOAsynchronous", "vtkIOAMR", "vtkInteractionImage", "vtkImagingStencil", "vtkImagingStatistics", "vtkImagingMorphological", "vtkImagingMath", "vtkIOSQL", "vtkGeovisCore", "vtkInfovisLayout", "vtkViewsCore", "vtkInteractionWidgets", "vtkRenderingVolume", "vtkRenderingAnnotation", "vtkImagingHybrid", "vtkImagingColor", "vtkInteractionStyle", "vtkFiltersTopology", "vtkFiltersSelection", "vtkFiltersSMP", "vtkFiltersProgrammable", "vtkFiltersPoints", "vtkFiltersVerdict", "vtkFiltersParallelImaging", "vtkFiltersImaging", "vtkImagingGeneral", "vtkFiltersHyperTree", "vtkFiltersGeneric", "vtkFiltersFlowPaths", "vtkFiltersAMR", "vtkFiltersParallel", "vtkFiltersTexture", "vtkFiltersModeling", "vtkFiltersHybrid", "vtkRenderingUI", "vtkDomainsChemistry", "vtkChartsCore", "vtkFiltersExtraction", "vtkParallelDIY", "vtkIOXML", "vtkIOXMLParser", "vtkFiltersStatistics", "vtkImagingFourier", "vtkImagingSources", "vtkIOImage", "vtkDICOMParser", "vtkRenderingContext2D", "vtkRenderingFreeType", "vtkRenderingCore", "vtkFiltersSources", "vtkImagingCore", "vtkFiltersGeometry", "vtkFiltersGeneral", "vtkInfovisCore", "vtkIOLegacy", "vtkIOCore", "vtkCommonColor", "vtkParallelCore", "vtkCommonComputationalGeometry", "vtkFiltersCore", "vtkCommonExecutionModel", "vtkCommonDataModel", "vtkCommonSystem", "vtkCommonMisc", "vtkCommonTransforms", "vtkCommonMath", "vtkCommonCore", "vtkexodusII", "vtklibharu", "vtkgl2ps", "vtkverdict", "vtklibproj", "vtkoctree", "vtkdiy2", "vtknetcdf", "vtklibxml2", "vtkutf8", "vtkmetaio", "vtkkwiml", "vtktheora", "vtkloguru", "vtksys", "vtkogg", "vtksqlite", "vtkglew", "vtkopengl", "vtkjsoncpp", "vtkpugixml", "vtkhdf5", "vtkexpat", "vtktiff", "vtklz4", "vtklzma", "vtkfreetype", "vtkjpeg", "vtkpng", "vtkeigen", "vtkpegtl", "vtkdoubleconversion", "vtkzlib"} for _, lib in ipairs(libs) do package:add("links", lib .. "-" .. ver) end