From 6ef1a1748b54d6ff67619698d647a76dbd6e023a Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sun, 27 Jul 2014 10:29:22 +0200 Subject: [PATCH] ffmpeg: add patch to support free builds with libressl support, disable nonfree build Signed-off-by: Stephan Raue --- packages/multimedia/ffmpeg/package.mk | 2 +- .../patches/ffmpeg-2.3-libressl-is-free.patch | 141 ++++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 packages/multimedia/ffmpeg/patches/ffmpeg-2.3-libressl-is-free.patch diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index cfab1f027b..b1ba23e19b 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -162,7 +162,7 @@ configure_target() { --disable-w32threads \ --disable-x11grab \ --enable-network \ - --disable-gnutls --enable-openssl --enable-nonfree \ + --disable-gnutls --enable-libressl \ --disable-gray \ --enable-swscale-alpha \ $FFMPEG_OPTIM \ diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-2.3-libressl-is-free.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-2.3-libressl-is-free.patch new file mode 100644 index 0000000000..88f246277b --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-2.3-libressl-is-free.patch @@ -0,0 +1,141 @@ +diff -Naur ffmpeg-2.3/configure ffmpeg-2.3.patch/configure +--- ffmpeg-2.3/configure 2014-07-16 03:00:37.000000000 +0200 ++++ ffmpeg-2.3.patch/configure 2014-07-27 10:08:44.022632800 +0200 +@@ -225,6 +225,7 @@ + --enable-libopus enable Opus de/encoding via libopus [no] + --enable-libpulse enable Pulseaudio input via libpulse [no] + --enable-libquvi enable quvi input via libquvi [no] ++ --enable-libressl enable libressl [no] + --enable-librtmp enable RTMP[E] support via librtmp [no] + --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no] + --enable-libshine enable fixed-point MP3 encoding via libshine [no] +@@ -1349,6 +1350,7 @@ + libopus + libpulse + libquvi ++ libressl + librtmp + libschroedinger + libshine +@@ -2462,7 +2464,7 @@ + # protocols + bluray_protocol_deps="libbluray" + ffrtmpcrypt_protocol_deps="!librtmp_protocol" +-ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl" ++ffrtmpcrypt_protocol_deps_any="gcrypt libressl nettle openssl" + ffrtmpcrypt_protocol_select="tcp_protocol" + ffrtmphttp_protocol_deps="!librtmp_protocol" + ffrtmphttp_protocol_select="http_protocol" +@@ -2493,7 +2495,7 @@ + sctp_protocol_select="network" + srtp_protocol_select="rtp_protocol" + tcp_protocol_select="network" +-tls_protocol_deps_any="openssl gnutls" ++tls_protocol_deps_any="libressl openssl gnutls" + tls_protocol_select="tcp_protocol" + udp_protocol_select="network" + unix_protocol_deps="sys_un_h" +@@ -4749,6 +4751,10 @@ + enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create + enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new + enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init ++enabled libressl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || ++ check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || ++ check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || ++ die "ERROR: libressl not found"; } + enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket + enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init + enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer +diff -Naur ffmpeg-2.3/libavformat/network.c ffmpeg-2.3.patch/libavformat/network.c +--- ffmpeg-2.3/libavformat/network.c 2014-07-16 03:00:38.000000000 +0200 ++++ ffmpeg-2.3.patch/libavformat/network.c 2014-07-27 10:17:17.252998566 +0200 +@@ -36,7 +36,7 @@ + #endif + #endif + +-#if CONFIG_OPENSSL ++#if CONFIG_OPENSSL || CONFIG_LIBRESSL + #include + static int openssl_init; + #if HAVE_THREADS +@@ -69,7 +69,7 @@ + void ff_tls_init(void) + { + avpriv_lock_avformat(); +-#if CONFIG_OPENSSL ++#if CONFIG_OPENSSL || CONFIG_LIBRESSL + if (!openssl_init) { + SSL_library_init(); + SSL_load_error_strings(); +@@ -101,7 +101,7 @@ + void ff_tls_deinit(void) + { + avpriv_lock_avformat(); +-#if CONFIG_OPENSSL ++#if CONFIG_OPENSSL || CONFIG_LIBRESSL + openssl_init--; + if (!openssl_init) { + #if HAVE_THREADS +diff -Naur ffmpeg-2.3/libavformat/rtmpdh.c ffmpeg-2.3.patch/libavformat/rtmpdh.c +--- ffmpeg-2.3/libavformat/rtmpdh.c 2014-07-15 02:20:49.000000000 +0200 ++++ ffmpeg-2.3.patch/libavformat/rtmpdh.c 2014-07-27 10:17:38.082053995 +0200 +@@ -161,7 +161,7 @@ + bn_free(dh->priv_key); + av_free(dh); + } +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + #define bn_new(bn) bn = BN_new() + #define bn_free(bn) BN_free(bn) + #define bn_set_word(bn, w) BN_set_word(bn, w) +diff -Naur ffmpeg-2.3/libavformat/rtmpdh.h ffmpeg-2.3.patch/libavformat/rtmpdh.h +--- ffmpeg-2.3/libavformat/rtmpdh.h 2014-07-15 02:20:49.000000000 +0200 ++++ ffmpeg-2.3.patch/libavformat/rtmpdh.h 2014-07-27 10:16:08.495815596 +0200 +@@ -45,7 +45,7 @@ + long length; + } FF_DH; + +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + #include + #include + +diff -Naur ffmpeg-2.3/libavformat/tls.c ffmpeg-2.3.patch/libavformat/tls.c +--- ffmpeg-2.3/libavformat/tls.c 2014-07-15 02:20:49.000000000 +0200 ++++ ffmpeg-2.3.patch/libavformat/tls.c 2014-07-27 10:18:18.700162096 +0200 +@@ -39,7 +39,7 @@ + if (c->cred) \ + gnutls_certificate_free_credentials(c->cred); \ + } while (0) +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + #include + #include + #include +@@ -63,7 +63,7 @@ + #if CONFIG_GNUTLS + gnutls_session_t session; + gnutls_certificate_credentials_t cred; +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + SSL_CTX *ctx; + SSL *ssl; + #endif +@@ -115,7 +115,7 @@ + p.events = POLLOUT; + else + p.events = POLLIN; +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + ret = SSL_get_error(c->ssl, ret); + if (ret == SSL_ERROR_WANT_READ) { + p.events = POLLIN; +@@ -285,7 +285,7 @@ + goto fail; + } + } +-#elif CONFIG_OPENSSL ++#elif CONFIG_OPENSSL || CONFIG_LIBRESSL + c->ctx = SSL_CTX_new(c->listen ? TLSv1_server_method() : TLSv1_client_method()); + if (!c->ctx) { + av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL));