Parcourir la source

pcre2: fix pc file (#6747)

* pcre2: fix pc file

* table wrap

* fix bitwidth
star9029 il y a 4 mois
Parent
commit
ce45729952
1 fichiers modifiés avec 18 ajouts et 0 suppressions
  1. 18 0
      packages/p/pcre2/xmake.lua

+ 18 - 0
packages/p/pcre2/xmake.lua

@@ -69,6 +69,24 @@ package("pcre2")
             table.insert(configs, "-DPCRE2_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
         end
         import("package.tools.cmake").install(package, configs)
+
+        local defines = table.wrap(package:get("defines"))
+        if defines and #defines ~= 0 then
+            defines = table.clone(defines)
+            for i, define in ipairs(defines) do
+                defines[i] = "-D" .. define
+            end
+            table.insert(defines, 1, "Cflags: -I${includedir}")
+            local pkgconfig_dir = package:installdir("lib/pkgconfig")
+
+            local pcre2_pc = path.join(pkgconfig_dir, format("libpcre2-%d.pc", package:config("bitwidth")))
+            io.replace(pcre2_pc, "Cflags: -I${includedir}", table.concat(defines, " "), {plain = true})
+
+            local pcre2_posix_pc = path.join(pkgconfig_dir, "libpcre2-posix.pc")
+            if os.isfile(pcre2_posix_pc) then
+                io.replace(pcre2_posix_pc, "Cflags: -I${includedir}", table.concat(defines, " "), {plain = true})
+            end
+        end
     end)
 
     on_test(function (package)