package/gerbera: fix static build with ffmpeg

Fixes:
 - http://autobuild.buildroot.org/results/2b99fabd798db84a0fce26ad696c58e54c6ff626
 - http://autobuild.buildroot.org/results/95e410e5ab34c6d4626a58f97c0d2d5e6829a300

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit 8795cb2082)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fabrice Fontaine 2019-03-24 20:29:42 +01:00 committed by Peter Korsgaard
parent 5cfc8b4686
commit e5377e9545

View File

@ -0,0 +1,175 @@
From fbbc07ce53e884b1603461ee5642d5f02788678d Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Thu, 21 Mar 2019 16:32:44 +0100
Subject: [PATCH] cmake/FindFFMPEG.cmake: use pkgconfig
ffmpeg has too many optional dependencies (opus, openssl, ...) instead
of trying to find them all one by one, use pkg-config to get them and
fallback on current mechanism
Fixes:
- http://autobuild.buildroot.org/results/2b99fabd798db84a0fce26ad696c58e54c6ff626
- http://autobuild.buildroot.org/results/95e410e5ab34c6d4626a58f97c0d2d5e6829a300
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Retrieved (and backported) from:
https://github.com/gerbera/gerbera/commit/fbbc07ce53e884b1603461ee5642d5f02788678d]
---
cmake/FindFFMPEG.cmake | 147 +++++++++++++++++++++--------------------
1 file changed, 75 insertions(+), 72 deletions(-)
diff --git a/cmake/FindFFMPEG.cmake b/cmake/FindFFMPEG.cmake
index 0a4a409f..9548b566 100644
--- a/cmake/FindFFMPEG.cmake
+++ b/cmake/FindFFMPEG.cmake
@@ -82,70 +82,76 @@ ENDIF (NOT FFMPEG_INCLUDE_DIR)
# ffmpeg uses relative includes such as <ffmpeg/avformat.h> or <libavcodec/avformat.h>
get_filename_component(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR} ABSOLUTE)
-FIND_LIBRARY(FFMPEG_avformat_LIBRARY avformat
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_avcodec_LIBRARY avcodec
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_avutil_LIBRARY avutil
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_swresample_LIBRARY swresample
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_vorbis_LIBRARY vorbis
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_dc1394_LIBRARY dc1394_control
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_vorbisenc_LIBRARY vorbisenc
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_theora_LIBRARY theora
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_dts_LIBRARY dts
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_gsm_LIBRARY gsm
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_swscale_LIBRARY swscale
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_z_LIBRARY z
- /usr/local/lib
- /usr/lib
- )
-
-FIND_LIBRARY(FFMPEG_bz2_LIBRARY bz2
- /usr/local/lib
- /usr/lib
- )
+CHECK_STRUCT_HAS_MEMBER("struct AVStream" codecpar libavformat/avformat.h HAVE_AVSTREAM_CODECPAR LANGUAGE C)
+
+FIND_PACKAGE(PkgConfig QUIET)
+PKG_CHECK_MODULES(FFMPEG QUIET libavformat libavutil)
+IF (NOT FFMPEG_FOUND)
+ FIND_LIBRARY(FFMPEG_avformat_LIBRARY avformat
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_avcodec_LIBRARY avcodec
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_avutil_LIBRARY avutil
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_swresample_LIBRARY swresample
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_vorbis_LIBRARY vorbis
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_dc1394_LIBRARY dc1394_control
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_vorbisenc_LIBRARY vorbisenc
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_theora_LIBRARY theora
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_dts_LIBRARY dts
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_gsm_LIBRARY gsm
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_swscale_LIBRARY swscale
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_z_LIBRARY z
+ /usr/local/lib
+ /usr/lib
+ )
+
+ FIND_LIBRARY(FFMPEG_bz2_LIBRARY bz2
+ /usr/local/lib
+ /usr/lib
+ )
+ENDIF(NOT FFMPEG_FOUND)
SET(FFMPEG_LIBRARIES)
IF (FFMPEG_INCLUDE_DIR)
@@ -205,9 +211,6 @@ IF (FFMPEG_INCLUDE_DIR)
ENDIF (FFMPEG_bz2_LIBRARY)
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE INTERNAL "All presently found FFMPEG libraries.")
-
- CHECK_STRUCT_HAS_MEMBER("struct AVStream" codecpar libavformat/avformat.h HAVE_AVSTREAM_CODECPAR LANGUAGE C)
-
ENDIF (FFMPEG_avutil_LIBRARY)
ENDIF (FFMPEG_avcodec_LIBRARY)
ENDIF (FFMPEG_avformat_LIBRARY)