ffmpeg: add patch to support free builds with libressl support, disable nonfree build

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2014-07-27 10:29:22 +02:00
parent 2a7749b4cb
commit 6ef1a1748b
2 changed files with 142 additions and 1 deletions

View File

@ -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 \

View File

@ -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 <openssl/ssl.h>
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 <openssl/bn.h>
#include <openssl/dh.h>
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 <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
@@ -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));