ruki пре 6 година
родитељ
комит
9fbd12703f
1 измењених фајлова са 16 додато и 8 уклоњено
  1. 16 8
      packages/f/ffmpeg/xmake.lua

+ 16 - 8
packages/f/ffmpeg/xmake.lua

@@ -9,9 +9,6 @@ package("ffmpeg")
     add_versions("home:4.0.2", "346c51735f42c37e0712e0b3d2f6476c86ac15863e4445d9e823fe396420d056")
     add_versions("github:4.0.2", "4df1ef0bf73b7148caea1270539ef7bd06607e0ea8aa2fbf1bb34062a097f026")
 
-    add_deps("x264", {optional = true})
-    add_deps("x265", {optional = true})
-
     add_links("avfilter", "avdevice", "avformat", "avcodec", "swscale", "swresample", "avutil")
 
     add_configs("libx264", {description = "Enable libx264 decoder.", default = false, type = "boolean"})
@@ -20,6 +17,16 @@ package("ffmpeg")
     if is_plat("macosx") then
         add_frameworks("CoreFoundation", "Foundation", "CoreVideo", "CoreMedia", "AudioToolbox", "VideoToolbox", "Security")
     end
+
+    on_load(function (package)
+        local configdeps = {libx264 = "x264",
+                            libx265 = "x265"}
+        for name, dep in pairs(configdeps) do
+            if package:config(name) then
+                package:add("deps", dep)
+            end
+        end
+    end)
   
     on_install("linux", "macosx", function (package)
         local configs = {"--disable-ffmpeg", 
@@ -36,11 +43,12 @@ package("ffmpeg")
         if is_plat("macosx") and macos.version():ge("10.8") then
             table.insert(configs, "--enable-videotoolbox")
         end
-        if package:config("libx264") and package:dep("x264"):exists() then
-            table.insert(configs, "--enable-libx264")
-        end
-        if package:config("libx265") and package:dep("x265"):exists() then
-            table.insert(configs, "--enable-libx265")
+        for name, enabled in pairs(package:configs()) do
+            if enabled then
+                table.insert(configs, "--enable-" .. name)
+            else
+                table.insert(configs, "--disable-" .. name)
+            end
         end
         import("package.tools.autoconf").install(package, configs)
     end)