ruki преди 4 години
родител
ревизия
b49360fe29
променени са 2 файла, в които са добавени 40 реда и са изтрити 4 реда
  1. 25 1
      packages/b/brotli/xmake.lua
  2. 15 3
      packages/f/freetype/xmake.lua

+ 25 - 1
packages/b/brotli/xmake.lua

@@ -21,6 +21,30 @@ package("brotli")
         package:addenv("PATH", "bin")
     end)
 
+    if on_fetch then
+        on_fetch("linux", "macosx", function (package, opt)
+            if opt.system then
+                local result
+                for _, name in ipairs({"libbrotlidec", "libbrotlienc", "libbrotlicommon"}) do
+                    local pkginfo = find_package("pkgconfig::" .. name)
+                    if pkginfo then
+                        if not result then
+                            result = table.copy(pkginfo)
+                        else
+                            result.links = result.links or {}
+                            result.linkdirs = result.linkdirs or {}
+                            result.includedirs = result.includedirs or {}
+                            table.join2(result.includedirs, pkginfo.includedirs)
+                            table.join2(result.linkdirs, pkginfo.linkdirs)
+                            table.join2(result.links, pkginfo.links)
+                        end
+                    end
+                end
+                return result
+            end
+        end)
+    end
+
     on_install(function (package)
         io.writefile("xmake.lua", [[
             add_rules("mode.debug", "mode.release")
@@ -57,4 +81,4 @@ package("brotli")
                 BrotliEncoderDestroyInstance(s);
             }
         ]], {includes = "brotli/encode.h"}))
-    end)
+    end)

+ 15 - 3
packages/f/freetype/xmake.lua

@@ -19,6 +19,14 @@ package("freetype")
         add_includedirs("include/freetype2")
     end
 
+    if on_fetch then
+        on_fetch("linux", "macosx", function (package, opt)
+            if opt.system then
+                return find_package("pkgconfig::freetype2")
+            end
+        end)
+    end
+
     on_load("linux", "macosx", function (package)
         package:add("deps", "libpng", "bzip2", "zlib")
         if package:config("woff2") then
@@ -33,9 +41,13 @@ package("freetype")
 
     on_install("linux", "macosx", function (package)
         local configs = { "--enable-freetype-config",
-                          "--without-harfbuzz",
-                          "--disable-shared",
-                          "--with-pic"}
+                          "--without-harfbuzz"}
+        local configs = {}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+        if package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
         import("package.tools.autoconf").install(package, configs)
     end)