From 9dc6582c5563ae63765542b45093c3a3aa6be8b9 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 21 Dec 2021 21:09:41 -0500 Subject: [PATCH] Add robotstxt (#779) --- packages/r/robotstxt/xmake.lua | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/r/robotstxt/xmake.lua diff --git a/packages/r/robotstxt/xmake.lua b/packages/r/robotstxt/xmake.lua new file mode 100644 index 000000000..f3a7edc97 --- /dev/null +++ b/packages/r/robotstxt/xmake.lua @@ -0,0 +1,37 @@ +package("robotstxt") + + set_homepage("https://github.com/google/robotstxt") + set_description("The repository contains Google's robots.txt parser and matcher as a C++ librar.") + set_license("Apache-2.0") + + add_urls("https://github.com/google/robotstxt.git") + add_versions("2021.11.24", "02bc6cdfa32db50d42563180c42aeb47042b4f0c") + + add_deps("abseil") + + on_install("macosx", "linux", "windows", function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + add_requires("abseil") + target("librobotstxt") + set_kind("$(kind)") + add_files("robots.cc") + add_packages("abseil") + add_headerfiles("robots.h") + set_languages("c99", "c++17") + if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all", {export_classes = true}) + end + ]]) + import("package.tools.xmake").install(package, {buildir = "xmake_build"}) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + googlebot::RobotsMatcher matcher; + std::vector user_agents(1, "Chrome"); + bool allowed = matcher.AllowedByRobots("robots_content", &user_agents, "url"); + } + ]]}, {configs = {languages = "c++17"}, includes = "robots.h"})) + end)