[packages/gpac] - up to 0.7.1 + add openssl 1.1.1 build fix

arekm arekm at pld-linux.org
Mon Sep 17 14:35:38 CEST 2018


commit ebe39204d260d1f5483594e4732cd354a08eace2
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Sep 17 14:35:23 2018 +0200

    - up to 0.7.1 + add openssl 1.1.1 build fix

 dont-err-build-on-uknown-system.patch | 18 ++++++++
 ffmpeg4.patch                         | 29 ++++++++++++
 gpac-amr.patch                        | 52 ----------------------
 gpac-flags.patch                      | 46 ++++++-------------
 gpac-install.patch                    | 40 ++++++++---------
 gpac-js.patch                         | 57 ------------------------
 gpac-xulrunner.patch                  | 12 -----
 gpac.spec                             | 36 ++++++++-------
 openssl.patch                         | 84 +++++++++++++++++++++++++++++++++++
 9 files changed, 182 insertions(+), 192 deletions(-)
---
diff --git a/gpac.spec b/gpac.spec
index bfde1d5..19da6af 100644
--- a/gpac.spec
+++ b/gpac.spec
@@ -24,28 +24,27 @@
 %undefine	with_plugin
 %endif
 #
-%define		rel 4
 Summary:	GPAC - an implementation of the MPEG-4 Systems standard (ISO/IEC 14496-1)
 Summary(pl.UTF-8):	GPAC - implementacja standardu MPEG-4 Systems (ISO/IEC 14496-1)
 Name:		gpac
-Version:	0.5.0
-Release:	16.%{snap}.%{rel}
+Version:	0.7.1
+Release:	1
 License:	LGPL v2+
 Group:		Applications/Multimedia
-# Source0:	http://downloads.sourceforge.net/gpac/%{name}-%{version}.tar.gz
-Source0:	%{name}-%{snap}.tar.bz2
-# Source0-md5:	9e37b324e490d3118622d77bf238cb16
+Source0:	https://github.com/gpac/gpac/archive/v%{version}.tar.gz
+# Source0-md5:	3b78b7b5bc022bbdeca193cc80281960
 Patch0:		%{name}-install.patch
-Patch1:		%{name}-xulrunner.patch
-Patch2:		%{name}-amr.patch
+
 Patch3:		%{name}-install-is-not-clean.patch
 Patch4:		%{name}-flags.patch
 Patch5:		wxWidgets3.patch
-Patch6:		%{name}-js.patch
+
 Patch7:		%{name}-apps.patch
 Patch8:		ffmpeg3.patch
 Patch9:		ffmpeg4.patch
-URL:		http://gpac.sourceforge.net/
+Patch10:	openssl.patch
+Patch11:	dont-err-build-on-uknown-system.patch
+URL:		http://www.gpac.io
 %{?with_directfb:BuildRequires:	DirectFB-devel}
 BuildRequires:	OpenGL-GLU-devel
 BuildRequires:	SDL-devel
@@ -163,17 +162,18 @@ GPAC plugin for Netscape-compatible WWW browsers.
 Wtyczka GPAC dla przeglądarek WWW zgodnych z Netscape.
 
 %prep
-%setup -q -n %{name}
+%setup -q
 %patch0 -p1
-%patch1 -p1
-%patch2 -p1
+
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
-%patch6 -p1
+
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
+%patch11 -p1
 
 sed -i -e 's/wx-config/wx-gtk2-unicode-config/' configure
 chmod a+x configure
@@ -181,6 +181,7 @@ chmod a+x configure
 %build
 # not autoconf configure
 ./configure \
+	--verbose \
 	--prefix=%{_prefix} \
 	--libdir=%{_lib} \
 	--mandir=%{_mandir} \
@@ -191,7 +192,7 @@ chmod a+x configure
 	%{!?with_wx:--disable-wx} \
 	%{?with_amr:--enable-amr} \
 	--enable-pic \
-	--extra-cflags="%{rpmcflags} -DFF_API_CLOSE_INPUT_FILE" \
+	--extra-cflags="%{rpmcflags}" \
 	--extra-ldflags="%{rpmldflags}" \
 	%{?with_plugin:--mozdir=%{_browserpluginsdir}} \
 	%{?with_plugin:--xulsdk-path="/usr/include/xulrunner -I/usr/include/nspr"} \
@@ -236,11 +237,12 @@ fi
 
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS BUGS Changelog README TODO
+%doc AUTHORS BUGS Changelog README.md TODO
 %attr(755,root,root) %{_bindir}/MP4Box
 %attr(755,root,root) %{_bindir}/MP4Client
+%attr(755,root,root) %{_bindir}/MP4TS
 %attr(755,root,root) %{_libdir}/libgpac.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libgpac.so.3
+%attr(755,root,root) %ghost %{_libdir}/libgpac.so.7
 %dir %{_libdir}/gpac
 %attr(755,root,root) %{_libdir}/gpac/gm_*.so
 %{_datadir}/gpac
diff --git a/dont-err-build-on-uknown-system.patch b/dont-err-build-on-uknown-system.patch
new file mode 100644
index 0000000..2d57c36
--- /dev/null
+++ b/dont-err-build-on-uknown-system.patch
@@ -0,0 +1,18 @@
+Description: Don't fail build intentionally on unknown systems
+Author: Balint Reczey <balint at balintreczey.hu>
+
+diff --git a/include/gpac/configuration.h b/include/gpac/configuration.h
+index 2c58fc3..70dcafc 100644
+--- a/include/gpac/configuration.h
++++ b/include/gpac/configuration.h
+@@ -147,8 +147,8 @@
+ #define GPAC_HAS_JPEG
+ #define GPAC_HAS_PNG
+ 
+-#else
+-#error "Unknown target platform used with static configuration file"
++//#else
++//#error "Unknown target platform used with static configuration file"
+ #endif
+ 
+ 
diff --git a/ffmpeg4.patch b/ffmpeg4.patch
index 585b928..1e3d775 100644
--- a/ffmpeg4.patch
+++ b/ffmpeg4.patch
@@ -9,3 +9,32 @@
  
  	video_output_file->vstream_idx = 0;//video_stream->index;
  
+--- gpac-0.7.1/modules/ffmpeg_in/ffmpeg_decode.c~	2017-04-26 13:33:17.000000000 +0200
++++ gpac-0.7.1/modules/ffmpeg_in/ffmpeg_decode.c	2018-09-17 13:53:01.462470101 +0200
+@@ -49,7 +49,7 @@
+ static uint8_t * ffmpeg_realloc_buffer(uint8_t * oldBuffer, u32 size) {
+ 	uint8_t * buffer;
+ 	/* Size of buffer must be larger, see avcodec_decode_video2 documentation */
+-	u32 allocatedSz = sizeof( char ) * (FF_INPUT_BUFFER_PADDING_SIZE + size);
++	u32 allocatedSz = sizeof( char ) * (AV_INPUT_BUFFER_PADDING_SIZE + size);
+ 	if (oldBuffer)
+ 		gf_free(oldBuffer);
+ 	buffer = (uint8_t*)gf_malloc( allocatedSz );
+@@ -577,7 +577,7 @@ static GF_Err FFDEC_GetCapabilities(GF_B
+ 		capability->cap.valueInt = 1;
+ 		return GF_OK;
+ 	case GF_CODEC_PADDING_BYTES:
+-		capability->cap.valueInt = FF_INPUT_BUFFER_PADDING_SIZE;
++		capability->cap.valueInt = AV_INPUT_BUFFER_PADDING_SIZE;
+ 		return GF_OK;
+ 	case GF_CODEC_REORDER:
+ 		capability->cap.valueInt = 1;
+@@ -669,7 +669,7 @@ static GF_Err FFDEC_GetCapabilities(GF_B
+ 		break;
+ 
+ 	case GF_CODEC_PADDING_BYTES:
+-		capability->cap.valueInt = FF_INPUT_BUFFER_PADDING_SIZE;
++		capability->cap.valueInt = AV_INPUT_BUFFER_PADDING_SIZE;
+ 		break;
+ 	default:
+ 		capability->cap.valueInt = 0;
diff --git a/gpac-amr.patch b/gpac-amr.patch
deleted file mode 100644
index 4d011fc..0000000
--- a/gpac-amr.patch
+++ /dev/null
@@ -1,52 +0,0 @@
---- gpac/modules/amr_float_dec/Makefile.orig	2011-04-21 17:06:51.000000000 +0200
-+++ gpac/modules/amr_float_dec/Makefile	2012-06-15 19:19:05.988610730 +0200
-@@ -18,19 +18,19 @@
- #common obj
- OBJS=../amr_dec/amr_in.o amr_float_dec.o
- 
-+AMR_LIBS=
-+
- #AMR NB obj
- CFLAGS+=-DGPAC_HAS_AMR_FT
- ifeq ($(CONFIG_AMR_NB_FT), yes)
--OBJS+=./amr_nb_ft/interf_dec.o ./amr_nb_ft/interf_enc.o ./amr_nb_ft/sp_dec.o ./amr_nb_ft/sp_enc.o
-+AMR_LIBS+=-lamrnb
- endif
- 
- 
- #AMR WB obj
- CFLAGS+=-DGPAC_HAS_AMR_FT_WB
- ifeq ($(CONFIG_AMR_WB_FT), yes)
--OBJS+=./amr_wb_ft/dec_acelp.o ./amr_wb_ft/dec_dtx.o ./amr_wb_ft/dec_gain.o ./amr_wb_ft/dec_if.o ./amr_wb_ft/dec_lpc.o ./amr_wb_ft/dec_main.o \
--	./amr_wb_ft/dec_rom.o ./amr_wb_ft/dec_util.o ./amr_wb_ft/enc_acelp.o ./amr_wb_ft/enc_dtx.o ./amr_wb_ft/enc_gain.o ./amr_wb_ft/enc_if.o \
--	./amr_wb_ft/enc_lpc.o ./amr_wb_ft/enc_main.o ./amr_wb_ft/enc_rom.o ./amr_wb_ft/enc_util.o ./amr_wb_ft/if_rom.o 
-+AMR_LIBS+=-lamrwb
- endif
- 
- 
-@@ -45,7 +45,7 @@
- 
- 
- $(LIB): $(OBJS)
--	$(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac
-+	$(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac $(AMR_LIBS)
- 
- 
- %.o: %.c
---- gpac/modules/amr_float_dec/amr_float_dec.c.orig	2012-03-28 14:43:41.000000000 +0200
-+++ gpac/modules/amr_float_dec/amr_float_dec.c	2012-06-15 19:20:41.675273381 +0200
-@@ -45,12 +45,12 @@
- 
- #ifdef GPAC_HAS_AMR_FT
- /*AMR WB*/
--#include "amr_nb_ft/interf_dec.h"
-+#include "amrnb/interf_dec.h"
- #endif
- 
- #ifdef GPAC_HAS_AMR_FT_WB
- /*AMR WB*/
--#include "amr_wb_ft/dec_if.h"
-+#include "amrwb/dec_if.h"
- #endif
- 
- #endif
diff --git a/gpac-flags.patch b/gpac-flags.patch
index 3b7ece8..1071b73 100644
--- a/gpac-flags.patch
+++ b/gpac-flags.patch
@@ -1,40 +1,22 @@
---- gpac/applications/osmo4_wx/Makefile.orig	2012-06-17 07:51:02.389758176 +0200
-+++ gpac/applications/osmo4_wx/Makefile	2012-06-17 08:25:05.746339091 +0200
-@@ -45,7 +45,7 @@
+--- gpac-0.7.1/applications/osmo4_wx/Makefile~	2018-09-17 12:18:34.000000000 +0200
++++ gpac-0.7.1/applications/osmo4_wx/Makefile	2018-09-17 12:19:25.217933596 +0200
+@@ -46,7 +46,7 @@ SRCS := $(OBJS:.o=.cpp)
  all: $(PROG)
  
  Osmo4$(EXE): $(OBJS)
--	$(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(WX_LFLAGS) $(LINKFLAGS)
-+	$(CXX) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(WX_LFLAGS) `pkg-config --libs gtk+-2.0` $(LINKFLAGS)
+-	$(CC) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(WX_LFLAGS) $(LINKFLAGS) $(LDFLAGS)
++	$(CC) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(WX_LFLAGS) `pkg-config --libs gtk+-2.0` -lstdc++ $(LINKFLAGS) $(LDFLAGS)
  
- %.o: %.cpp
- 	$(CXX) $(CFLAGS) $(WX_CFLAGS) -c -o $@ $< 
---- gpac/src/Makefile.orig	2012-05-23 20:57:42.000000000 +0200
-+++ gpac/src/Makefile	2012-06-15 20:44:50.881728154 +0200
-@@ -195,15 +195,6 @@
- ## libgpac compositor compilation options
- COMPOSITOR_CFLAGS=
- 
--## Add prefix before every lib
--ifneq ($(prefix), /usr/local)
--EXTRALIBS+=-L$(prefix)/lib
--else
--ifneq ($(prefix), /usr)
--EXTRALIBS+=-L$(prefix)/lib
--endif
--endif
--
- ## OpenGL available
- ifeq ($(HAS_OPENGL),yes)
- EXTRALIBS+= $(OGL_LIBS)
---- gpac/modules/jack/Makefile.orig	2012-04-05 14:38:11.000000000 +0200
-+++ gpac/modules/jack/Makefile	2012-06-15 20:46:05.045058375 +0200
-@@ -25,7 +25,7 @@
+ clean: 
+ 	rm -f $(OBJS) ../../bin/gcc/$(PROG)
+--- gpac-0.7.1/modules/jack/Makefile~	2017-04-26 13:33:17.000000000 +0200
++++ gpac-0.7.1/modules/jack/Makefile	2018-09-17 12:20:29.753236206 +0200
+@@ -25,7 +25,7 @@ LIB=gm_jack$(DYN_LIB_SUFFIX)
  all: $(LIB)
  
  $(LIB): $(OBJS)
--	$(CC) $(SHFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac -L/usr/lib  -ljack
-+	$(CC) $(SHFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac -ljack
- 
+-	$(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac -L/usr/lib  -ljack
++	$(CC) $(SHFLAGS) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(EXTRALIBS) -L../../bin/gcc -lgpac -ljack
  
- %.o: %.c
+ clean: 
+ 	rm -f $(OBJS) ../../bin/gcc/$(LIB)
diff --git a/gpac-install.patch b/gpac-install.patch
index 099d77e..084813f 100644
--- a/gpac-install.patch
+++ b/gpac-install.patch
@@ -1,18 +1,6 @@
---- gpac/Makefile.orig	2008-10-23 17:40:38.000000000 +0200
-+++ gpac/Makefile	2011-02-05 07:18:41.996686361 +0100
-@@ -59,9 +59,6 @@
- ifeq ($(CONFIG_WIN32),yes)
- 	install $(INSTFLAGS) -m 755 bin/gcc/libgpac.dll $(prefix)/$(libdir)
- else
--ifeq ($(DEBUGBUILD),no)
--	$(STRIP) bin/gcc/libgpac.$(DYN_LIB_SUFFIX)
--endif
- ifeq ($(CONFIG_DARWIN),yes)
- 	install -m 755 bin/gcc/libgpac.$(DYN_LIB_SUFFIX) $(DESTDIR)$(prefix)/$(libdir)/libgpac-$(VERSION).$(DYN_LIB_SUFFIX)
- 	ln -sf libgpac-$(VERSION).$(DYN_LIB_SUFFIX) $(DESTDIR)$(prefix)/$(libdir)/libgpac.$(DYN_LIB_SUFFIX)
---- gpac/applications/osmozilla/Makefile.orig	2008-11-24 09:54:12.000000000 +0100
-+++ gpac/applications/osmozilla/Makefile	2011-02-05 07:20:46.968690551 +0100
-@@ -6,10 +6,6 @@
+--- gpac-0.7.1/applications/osmozilla/Makefile~	2017-04-26 13:33:17.000000000 +0200
++++ gpac-0.7.1/applications/osmozilla/Makefile	2018-09-17 13:57:38.870996859 +0200
+@@ -6,10 +6,6 @@ ifeq ($(CONFIG_WIN32),yes)
  USER_NAME=root
  else
  USER_NAME=$(shell whoami)
@@ -22,8 +10,8 @@
 -endif
  endif
  
- CFLAGS=$(CPPFLAGS) $(XUL_CFLAGS) -I$(SRC_PATH)/include
-@@ -68,19 +68,8 @@ ifeq ($(CONFIG_WIN32),yes)
+ CFLAGS=$(CXXFLAGS) $(XUL_CFLAGS) -I"$(SRC_PATH)/include"
+@@ -72,19 +68,8 @@ ifeq ($(CONFIG_WIN32),yes)
  endif
  
  install: 
@@ -37,12 +25,20 @@
 -	$(INSTALL) -D -m 755 ../../bin/gcc/nposmozilla.xpt "$(HOME)/.mozilla/components/nposmozilla.xpt"
 -endif
 -else
--	$(INSTALL) -D -m 755 ../../bin/gcc/$(LIB) "$(MOZILLA_DIR)/components/$(LIB)"
--	$(INSTALL) -D -m 755 ../../bin/gcc/nposmozilla.xpt "$(MOZILLA_DIR)/components/nposmozilla.xpt"
+ 	$(INSTALL) -D -m 755 ../../bin/gcc/$(LIB) "$(MOZILLA_DIR)/components/$(LIB)"
+ 	$(INSTALL) -D -m 755 ../../bin/gcc/nposmozilla.xpt "$(MOZILLA_DIR)/components/nposmozilla.xpt"
 -endif
-+	$(INSTALL) -D -m 755 ../../bin/gcc/$(LIB) "$(MOZILLA_DIR)/$(LIB)"
-+	$(INSTALL) -D -m 755 ../../bin/gcc/nposmozilla.xpt "$(MOZILLA_DIR)/nposmozilla.xpt"
  
  uninstall:
  ifeq ($(MOZILLA_DIR), local)
-
+--- gpac-0.7.1/Makefile~	2017-04-26 13:33:17.000000000 +0200
++++ gpac-0.7.1/Makefile	2018-09-17 14:27:00.872110746 +0200
+@@ -112,7 +112,7 @@ ifneq ($(CONFIG_WIN32), yes)
+ ifneq ($(CONFIG_FFMPEG), no)
+ ifneq ($(DISABLE_CORE_TOOLS), yes)
+ ifneq ($(DISABLE_AV_PARSERS), yes)
+-	if [ -f bin/gcc/DashCast$(EXE_SUFFIX)g ] ; then \
++	if [ -f bin/gcc/DashCast$(EXE_SUFFIX) ] ; then \
+ 	$(INSTALL) $(INSTFLAGS) -m 755 bin/gcc/DashCast$(EXE_SUFFIX) "$(DESTDIR)$(prefix)/bin" ; \
+ 	fi
+ endif
diff --git a/gpac-js.patch b/gpac-js.patch
deleted file mode 100644
index f0e6498..0000000
--- a/gpac-js.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- gpac/configure.orig	2012-06-15 21:26:23.188290228 +0200
-+++ gpac/configure	2012-06-15 22:10:36.141512228 +0200
-@@ -727,11 +727,11 @@ EOF
-         #dc added
-     elif test "$pkg_config" != "no"; then
-         #try pkg-config
--        if $pkg_config --exists mozilla-js 2> /dev/null  ; then
-+        if $pkg_config --exists nomozilla-js 2> /dev/null  ; then
-             mozjs_pkgcfg="mozilla-js"
--        elif $pkg_config --exists mozjs 2> /dev/null  ; then
-+        elif $pkg_config --exists nomozjs 2> /dev/null  ; then
-             mozjs_pkgcfg="mozjs"
--        elif $pkg_config --exists mozjs185 2> /dev/null  ; then
-+        elif $pkg_config --exists nomozjs185 2> /dev/null  ; then
-             mozjs_pkgcfg="mozjs185"
- 	fi
- 
-@@ -699,29 +699,13 @@
-                 js_lib=`$pkg_config --libs mozilla-js`
-             fi
-         #try firefox folders (starting at ubuntu 11.10, no pkg-config)
--        elif ls -d /usr/lib/firefox* > /dev/null 2>&1 ; then
--            firefox_version=`cd /usr/lib ; ls -d firefox* | grep -v addons | grep -v devel ; cd - > /dev/null`
--            for i in $firefox_version ; do
--                if test "$has_js" = "no" ; then
--                    js_inc="/usr/include/$i"
--                    js_flags="-DXP_UNIX -I$js_inc"
--                    js_lib="-L/usr/lib/$i/ -lxul -lmozsqlite3 -lmozalloc -lnssutil3 -lnss3 -lnspr4 -lsmime3"
--                    if $cc -o $TMPO $TMPC $js_flags $js_lib 2> /dev/null  ; then
--                        has_js="$i"
--                    elif $cc -o $TMPO $TMPC $js_flags -lnssutil3 $js_lib -lssl3 2> /dev/null  ; then
--                        #firefox 11 compatibility
--                        has_js="$i"
--                        js_lib="-lnssutil3 $js_lib -lssl3"
--                    fi
--                fi
--            done
-         fi
- 
-         if test "$has_js" = "no" ; then
-             #try prefix (DC)
-             js_inc="$prefix/include/js"
-             js_flags="-DXP_UNIX -I$prefix/include/js"
--            if $cc -o $TMPO $TMPC $js_flags -L$prefix/lib -ljs -lpthread 2> /dev/null  ; then
-+            if $cc -o $TMPO $TMPC $js_flags -ljs -lpthread 2> /dev/null  ; then
-                 has_js="prefix"
-                 #dc added end
-             else
-@@ -782,7 +766,7 @@
-         #try prefix (DC)
-         js_inc="$prefix/include/js"
-         js_flags="-DXP_UNIX -I$prefix/include/js"
--        if $cc -o $TMPO $TMPC $js_flags -L$prefix/lib -ljs 2> /dev/null  ; then
-+        if $cc -o $TMPO $TMPC $js_flags -ljs 2> /dev/null  ; then
-             has_js="prefix"
-             #dc added end
-         else
diff --git a/gpac-xulrunner.patch b/gpac-xulrunner.patch
deleted file mode 100644
index 7139b0c..0000000
--- a/gpac-xulrunner.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- gpac/applications/osmozilla/osmo_npapi.cpp.orig	2012-04-04 17:04:39.000000000 +0200
-+++ gpac/applications/osmozilla/osmo_npapi.cpp	2012-06-17 07:42:36.879779391 +0200
-@@ -372,7 +372,7 @@
- 	/* explicit plugin call */ \
- 	"application/x-gpac::GPAC plugin;" \
-  
--char * NP_GetMIMEDescription(void)
-+const char * NP_GetMIMEDescription(void)
- {
- 	return (char *) GPAC_PLUGIN_MIMETYPES;
- }
-
diff --git a/openssl.patch b/openssl.patch
new file mode 100644
index 0000000..1f91a1e
--- /dev/null
+++ b/openssl.patch
@@ -0,0 +1,84 @@
+From e64a7d229fdcb5c190064b7860ade50124dcc735 Mon Sep 17 00:00:00 2001
+From: Aurelien David <aurelien.david at telecom-paristech.fr>
+Date: Fri, 6 Oct 2017 16:46:18 +0200
+Subject: [PATCH] compatibility with OpenSSL 1.1.x (#616)
+
+---
+ src/utils/downloader.c | 40 +++++++++++++++++++++++++++++-----------
+ 1 file changed, 29 insertions(+), 11 deletions(-)
+
+diff --git a/src/utils/downloader.c b/src/utils/downloader.c
+index b8c923b88..3b7d37b41 100644
+--- a/src/utils/downloader.c
++++ b/src/utils/downloader.c
+@@ -204,7 +204,7 @@ struct __gf_download_manager
+ 	u32 limit_data_rate, read_buf_size;
+ 	u64 max_cache_size;
+ 	Bool allow_broken_certificate;
+-	
++
+ 	GF_List *skip_proxy_servers;
+ 	GF_List *credentials;
+ 	GF_List *cache_entries;
+@@ -392,10 +392,18 @@ static Bool init_ssl_lib() {
+ 		GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[HTTPS] Error while initializing Random Number generator, failed to init SSL !\n"));
+ 		return GF_TRUE;
+ 	}
++
++	/* per https://www.openssl.org/docs/man1.1.0/ssl/OPENSSL_init_ssl.html
++	** As of version 1.1.0 OpenSSL will automatically allocate all resources that it needs so no explicit initialisation is required.
++	** Similarly it will also automatically deinitialise as required.
++	*/
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ 	SSL_library_init();
+ 	SSL_load_error_strings();
+ 	SSLeay_add_all_algorithms();
+ 	SSLeay_add_ssl_algorithms();
++#endif
++
+ 	_ssl_is_initialized = GF_TRUE;
+ 	GF_LOG(GF_LOG_DEBUG, GF_LOG_NETWORK, ("[HTTPS] Initalization of SSL library complete.\n"));
+ 	return GF_FALSE;
+@@ -422,6 +430,7 @@ static int ssl_init(GF_DownloadManager *dm, u32 mode)
+ 	}
+ 
+ 	switch (mode) {
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ 	case 0:
+ 		meth = SSLv23_client_method();
+ 		break;
+@@ -436,6 +445,11 @@ static int ssl_init(GF_DownloadManager *dm, u32 mode)
+ 	case 3:
+ 		meth = TLSv1_client_method();
+ 		break;
++#else /* for openssl 1.1+ this is the prefered method */
++	case 0:
++		meth = TLS_client_method();
++		break;
++#endif
+ 	default:
+ 		goto error;
+ 	}
+@@ -1225,7 +1239,7 @@ static GF_Err gf_dm_read_data(GF_DownloadSession *sess, char *data, u32 data_siz
+ 		gf_mx_v(sess->mx);
+ 		return GF_IP_CONNECTION_CLOSED;
+ 	}
+-	
++
+ #ifdef GPAC_HAS_SSL
+ 	if (sess->ssl) {
+ 		s32 size;
+@@ -1451,7 +1465,11 @@ static void gf_dm_connect(GF_DownloadSession *sess)
+ 							const GENERAL_NAME *altname = sk_GENERAL_NAME_value(altnames, i);
+ 							if (altname->type == GEN_DNS)
+ 							{
+-								unsigned char *altname_str = ASN1_STRING_data(altname->d.ia5);
++								#if OPENSSL_VERSION_NUMBER < 0x10100000L
++									unsigned char *altname_str = ASN1_STRING_data(altname->d.ia5);
++								#else
++									unsigned char *altname_str = (unsigned char *)ASN1_STRING_get0_data(altname->d.ia5);
++								#endif
+ 								gf_list_add(valid_names, altname_str);
+ 							}
+ 						}
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gpac.git/commitdiff/ebe39204d260d1f5483594e4732cd354a08eace2



More information about the pld-cvs-commit mailing list