Repository: conan-io/conan-center-index

Issue:
[package] ffmpeg/5.0: Cannot build to WASM with Emscripten.
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **ffmpeg/5.0**
  * Operating System+version: **Linux Manjaro cross to Web Assembly with Emscripten**
  * Compiler+version: **Clang 13**
  * Conan version: **conan 1.47.0**
  * Python version: **Python 3.10.4**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
arch=wasm
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=13
os=Emscripten

[options]
[build_requires]
*: emsdk/3.1.7

[env]
```

### Conanfile build options for ffmpeg
```
ffmpeg:with_zlib=False
ffmpeg:with_bzip2=False
ffmpeg:with_lzma=False
ffmpeg:with_libiconv=False
ffmpeg:with_freetype=False
ffmpeg:with_openjpeg=False
ffmpeg:with_openh264=False
ffmpeg:with_opus=False
ffmpeg:with_vorbis=False
ffmpeg:with_zeromq=False
ffmpeg:with_sdl=False
ffmpeg:with_libx264=False
ffmpeg:with_libx265=False
ffmpeg:with_libvpx=False
ffmpeg:with_libmp3lame=False
ffmpeg:with_libfdk_aac=False
ffmpeg:with_libwebp=False
ffmpeg:with_ssl=False
ffmpeg:with_programs=False
```

### Steps to reproduce (Include if Applicable)
`conan install .. -pr:h ../emscripten_conan_profile -pr:b default --build=ffmpeg` fails firstly because the `--target-os` value of `emscripten` is unrecognised by the ffmpeg build system and secondly because there isn't currently a flag to disable Vulkan support.

I have a branch which fixes both issues for me that I would like to open a PR for here:
https://github.com/simoncent/conan-center-index/tree/ffmpeg/emscripten-support

I'm *very* new to Conan, attempting to use Conan for my ffmpeg dependency was my first investigation into using it to replace all my manually rolled dependencies in Cmake, so I apologise if I've done something stunningly stupid and this issue/PR is unnecessary.

</details>



Discussion:

Resolving patch:
diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py
--- a/recipes/ffmpeg/all/conanfile.py
+++ b/recipes/ffmpeg/all/conanfile.py
@@ -53,6 +53,7 @@ class FFMpegConan(ConanFile):
         "with_pulse": [True, False],
         "with_vaapi": [True, False],
         "with_vdpau": [True, False],
+        "with_vulkan": [True, False],
         "with_xcb": [True, False],
         "with_appkit": [True, False],
         "with_avfoundation": [True, False],
@@ -93,6 +94,7 @@ class FFMpegConan(ConanFile):
         "with_pulse": True,
         "with_vaapi": True,
         "with_vdpau": True,
+        "with_vulkan": True,
         "with_xcb": True,
         "with_appkit": True,
         "with_avfoundation": True,
@@ -152,6 +154,7 @@ def config_options(self):
         if not self.settings.os in ["Linux", "FreeBSD"]:
             del self.options.with_vaapi
             del self.options.with_vdpau
+            del self.options.with_vulkan
             del self.options.with_xcb
             del self.options.with_libalsa
             del self.options.with_pulse
@@ -163,6 +166,8 @@ def config_options(self):
             del self.options.with_videotoolbox
         if not tools.is_apple_os(self.settings.os):
             del self.options.with_avfoundation
+        if not self._version_supports_vulkan():
+            del self.options.with_vulkan
 
     def configure(self):
         if self.options.shared:
@@ -217,6 +222,8 @@ def requirements(self):
             self.requires("vaapi/system")
         if self.options.get_safe("with_vdpau"):
             self.requires("vdpau/system")
+        if self._version_supports_vulkan() and self.options.get_safe("with_vulkan"):
+            self.requires("vulkan-loader/1.3.211.0")
 
     def validate(self):
         if self.options.with_ssl == "securetransport" and not tools.is_apple_os(self.settings.os):
@@ -344,6 +351,8 @@ def _configure_autotools(self):
             opt_enable_disable("nonfree", self.options.with_libfdk_aac or ( self.options.with_ssl and ( self.options.with_libx264 or self.options.with_libx265 or self.options.postproc ) ) ),
             opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc)
         ]
+        if self._version_supports_vulkan():
+            args.append(opt_enable_disable("vulkan", self.options.get_safe("with_vulkan")))
         if tools.is_apple_os(self.settings.os):
             # relocatable shared libs
             args.append("--install-name-dir=@rpath")
@@ -376,7 +385,11 @@ def _configure_autotools(self):
                 # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
                 self._autotools.defines.append("inline=__inline")
         if tools.cross_building(self):
-            args.append("--target-os={}".format(self._target_os))
+            if self._target_os == "emscripten":
+                args.append("--target-os=none")
+            else:
+                args.append("--target-os={}".format(self._target_os))
+            
             if tools.is_apple_os(self.settings.os):
                 xcrun = tools.XCRun(self.settings)
                 apple_arch = tools.to_apple_arch(str(self.settings.arch))
@@ -637,3 +650,8 @@ def package_info(self):
             self.cpp_info.components["avutil"].requires.extend(["vaapi::vaapi", "xorg::x11"])
         if self.options.get_safe("with_vdpau"):
             self.cpp_info.components["avutil"].requires.append("vdpau::vdpau")
+        if self._version_supports_vulkan() and self.options.get_safe("with_vulkan"):
+            self.cpp_info.components["avutil"].requires.append("vulkan-loader::vulkan-loader")
+
+    def _version_supports_vulkan(self):
+        return tools.Version(self.version) >= "4.3.0"


Test patch: