summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2024-03-28 13:53:25 +0000
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-03-29 23:49:10 +0000
commit08a54fc7568554fb2927aed1a5ebea6c098cd0cb (patch)
tree98b2efcdd5f4e966cda9db8ab5b0e556861ebc86
parente88780ecc989e00db734a7deb32e79ec3665d52b (diff)
librtmp: build with Meson
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1431>
-rw-r--r--recipes/librtmp.recipe35
-rw-r--r--recipes/librtmp/0001-Fix-support-for-cross-compilation.patch52
-rw-r--r--recipes/librtmp/0001-librtmp-add-Meson-build.patch202
-rw-r--r--recipes/librtmp/0007-Make-libdir-configurable.patch25
4 files changed, 206 insertions, 108 deletions
diff --git a/recipes/librtmp.recipe b/recipes/librtmp.recipe
index f16c2e2b..b910ce14 100644
--- a/recipes/librtmp.recipe
+++ b/recipes/librtmp.recipe
@@ -1,12 +1,11 @@
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary
-
class Recipe(recipe.Recipe):
name = 'librtmp'
version = '2.4_p20200229'
stype = SourceType.TARBALL
- btype = BuildType.MAKEFILE
+ btype = BuildType.MESON
url = 'https://gstreamer.freedesktop.org/data/src/mirror/rtmpdump-%(version)s.tar.xz'
tarball_checksum = 'ac4ebe131254da6f49d17b77df42b1419155fb09d38d8a8bf785fdc16bfca418'
# Binaries are GPLv2+, but we don't distribute them
@@ -15,14 +14,13 @@ class Recipe(recipe.Recipe):
tarball_dirname = 'rtmpdump-%(version)s'
patches = [
# Our patches, upstream is non-existent
- name + '/0001-Fix-support-for-cross-compilation.patch',
+ name + '/0001-librtmp-add-Meson-build.patch',
# vcpkg patches, porting to openssl and fixing windows bugs, since
# upstream is non-existent
name + '/0003-Port-to-openssl-1.1.1.patch',
name + '/0004-Port-to-newer-MSVC.patch',
name + '/0005-Fix-debug-build.patch',
name + '/0006-Add-license-for-vcpkg-changes.patch',
- name + '/0007-Make-libdir-configurable.patch',
]
# openssl on Linux
use_system_libs = True
@@ -34,34 +32,9 @@ class Recipe(recipe.Recipe):
if self.config.target_platform != Platform.LINUX or self.config.cross_compiling():
self.deps.append('openssl')
- if self.config.target_platform == Platform.WINDOWS:
- system = 'mingw'
- elif self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
- system = 'darwin'
- elif self.config.target_platform in [Platform.LINUX, Platform.ANDROID]:
- system = 'posix'
- # LDFLAGS are passed via XLDFLAGS, and are needed for at least Android
- cc = self.get_env('CC')
- ld = self.get_env('LD')
- prefix = self.config.prefix
- cflags = self.get_env('CFLAGS')
- ldflags = self.get_env('LDFLAGS')
- self.make += ['SYS=' + system, 'prefix=' + prefix, 'CRYPTO=OPENSSL', 'XCFLAGS=' + cflags,
- 'XLDFLAGS=' + ldflags, 'CC=' + cc, 'LD=' + ld, 'libdir=' + self.config.libdir]
- self.make_install = self.make + ['install']
-
def post_install(self):
- soversion = 1
- # On Windows, rtmp installs a duplicate DLL by trying to symlink which
- # results in a copy under MinGW since symlinks aren't supported there.
- if self.config.target_platform == Platform.WINDOWS:
- dlldir = os.path.join(self.config.prefix, 'bin')
- real_rtmp_dll = os.path.join(dlldir, 'librtmp-{}.dll'.format(soversion))
- dupe_rtmp_dll = os.path.join(dlldir, 'librtmp.dll')
- if os.path.isfile(dupe_rtmp_dll) and os.path.isfile(real_rtmp_dll):
- os.remove(dupe_rtmp_dll)
- deps = ['ssl', 'crypto']
- libtool_la = LibtoolLibrary('rtmp', soversion, None, None,
+ deps = ['ssl', 'crypto', 'z']
+ libtool_la = LibtoolLibrary('rtmp', None, None, None,
self.config.libdir, self.config.target_platform, deps)
libtool_la.save()
super().post_install()
diff --git a/recipes/librtmp/0001-Fix-support-for-cross-compilation.patch b/recipes/librtmp/0001-Fix-support-for-cross-compilation.patch
deleted file mode 100644
index 896c3e1f..00000000
--- a/recipes/librtmp/0001-Fix-support-for-cross-compilation.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 93bc9da0b9082e2a640f9eb560015739b2e16cdf Mon Sep 17 00:00:00 2001
-From: Nirbheek Chauhan <nirbheek@centricular.com>
-Date: Tue, 14 Oct 2014 21:02:51 +0530
-Subject: [PATCH 1/6] Fix support for cross-compilation
-
----
- librtmp/Makefile | 15 ++++++++-------
- 1 file changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/librtmp/Makefile b/librtmp/Makefile
-index 2c1c790..f4e2a0b 100644
---- a/librtmp/Makefile
-+++ b/librtmp/Makefile
-@@ -1,6 +1,7 @@
- VERSION=v2.4
-
--prefix=/usr/local
-+prefix?=/usr/local
-+pkgconfig?=$(shell which pkg-config)
-
- incdir=$(prefix)/include/librtmp
- bindir=$(prefix)/bin
-@@ -11,12 +12,12 @@ INCDIR=$(DESTDIR)$(incdir)
- LIBDIR=$(DESTDIR)$(libdir)
- MANDIR=$(DESTDIR)$(mandir)
-
--CC=$(CROSS_COMPILE)gcc
--LD=$(CROSS_COMPILE)ld
--AR=$(CROSS_COMPILE)ar
-+CC?=$(CROSS_COMPILE)gcc
-+LD?=$(CROSS_COMPILE)ld
-+AR?=$(CROSS_COMPILE)ar
-
--SYS=posix
--CRYPTO=OPENSSL
-+SYS?=posix
-+CRYPTO?=OPENSSL
- #CRYPTO=GNUTLS
- DEF_POLARSSL=-DUSE_POLARSSL
- DEF_OPENSSL=-DUSE_OPENSSL
-@@ -29,7 +30,7 @@ LIBZ=-lz
- LIBS_posix=
- LIBS_darwin=
- LIBS_mingw=-lws2_32 -lwinmm -lgdi32
--LIB_GNUTLS=-lgnutls -lhogweed -lnettle -lgmp $(LIBZ)
-+LIB_GNUTLS=$(shell $(pkgconfig) --libs gnutls nettle hogweed) -lgmp $(LIBZ)
- LIB_OPENSSL=-lssl -lcrypto $(LIBZ)
- LIB_POLARSSL=-lpolarssl $(LIBZ)
- PRIVATE_LIBS=$(LIBS_$(SYS))
---
-2.24.1
-
diff --git a/recipes/librtmp/0001-librtmp-add-Meson-build.patch b/recipes/librtmp/0001-librtmp-add-Meson-build.patch
new file mode 100644
index 00000000..259195bf
--- /dev/null
+++ b/recipes/librtmp/0001-librtmp-add-Meson-build.patch
@@ -0,0 +1,202 @@
+From f8442ea23f73f0acf9f02afc9844f8b226eb5be2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
+Date: Wed, 20 Apr 2016 12:17:35 +0100
+Subject: [PATCH] librtmp: add Meson build
+
+---
+ librtmp/librtmp.def | 111 ++++++++++++++++++++++++++++++++++++++++++++
+ librtmp/meson.build | 32 +++++++++++++
+ meson.build | 24 ++++++++++
+ 3 files changed, 167 insertions(+)
+ create mode 100644 librtmp/librtmp.def
+ create mode 100644 librtmp/meson.build
+ create mode 100644 meson.build
+
+diff --git a/librtmp/librtmp.def b/librtmp/librtmp.def
+new file mode 100644
+index 0000000..4c4b3b9
+--- /dev/null
++++ b/librtmp/librtmp.def
+@@ -0,0 +1,111 @@
++EXPORTS
++AMF3CD_AddProp
++AMF3CD_GetProp
++AMF3_Decode
++AMF3Prop_Decode
++AMF3ReadInteger
++AMF3ReadString
++AMF_AddProp
++AMF_CountProp
++AMF_Decode
++AMF_DecodeArray
++AMF_DecodeBoolean
++AMF_DecodeInt16
++AMF_DecodeInt24
++AMF_DecodeInt32
++AMF_DecodeLongString
++AMF_DecodeNumber
++AMF_DecodeString
++AMF_Dump
++AMF_Encode
++AMF_EncodeArray
++AMF_EncodeBoolean
++AMF_EncodeEcmaArray
++AMF_EncodeInt16
++AMF_EncodeInt24
++AMF_EncodeInt32
++AMF_EncodeNamedBoolean
++AMF_EncodeNamedNumber
++AMF_EncodeNamedString
++AMF_EncodeNumber
++AMF_EncodeString
++AMF_GetProp
++AMFProp_Decode
++AMFProp_Dump
++AMFProp_Encode
++AMFProp_GetBoolean
++AMFProp_GetName
++AMFProp_GetNumber
++AMFProp_GetObject
++AMFProp_GetString
++AMFProp_GetType
++AMFProp_IsValid
++AMFProp_Reset
++AMFProp_SetName
++AMF_Reset
++HTTP_get
++RTMP_Alloc
++RTMP_ClientPacket
++RTMP_Close
++RTMP_Connect
++RTMP_Connect0
++RTMP_Connect1
++RTMP_ConnectStream
++RTMP_DeleteStream
++RTMP_DropRequest
++RTMP_EnableWrite
++RTMP_FindFirstMatchingProperty
++RTMP_FindPrefixProperty
++RTMP_Free
++RTMP_GetDuration
++RTMP_GetNextMediaPacket
++RTMP_GetTime
++RTMP_HashSWF
++RTMP_Init
++RTMP_IsConnected
++RTMP_IsTimedout
++RTMP_LibVersion
++RTMP_Log
++RTMP_LogGetLevel
++RTMP_LogHex
++RTMP_LogHexString
++RTMP_LogPrintf
++RTMP_LogSetCallback
++RTMP_LogSetLevel
++RTMP_LogSetOutput
++RTMP_LogStatus
++RTMPPacket_Alloc
++RTMPPacket_Dump
++RTMPPacket_Free
++RTMPPacket_Reset
++RTMP_ParsePlaypath
++RTMP_ParseURL
++RTMP_Pause
++RTMP_Read
++RTMP_ReadPacket
++RTMP_ReconnectStream
++RTMP_SendChunk
++RTMP_SendClientBW
++RTMP_SendCreateStream
++RTMP_SendCtrl
++RTMP_SendPacket
++RTMP_SendPause
++RTMP_SendSeek
++RTMP_SendServerBW
++RTMP_Serve
++RTMP_SetBufferMS
++RTMP_SetOpt
++RTMP_SetupStream
++RTMP_SetupURL
++RTMPSockBuf_Close
++RTMPSockBuf_Fill
++RTMPSockBuf_Send
++RTMP_Socket
++RTMP_TLS_Accept
++RTMP_TLS_AllocServerContext
++RTMP_TLS_FreeServerContext
++RTMP_TLS_Init
++RTMP_ToggleStream
++RTMP_UpdateBufferMS
++RTMP_UserInterrupt
++RTMP_Write
+diff --git a/librtmp/meson.build b/librtmp/meson.build
+new file mode 100644
+index 0000000..b5eaf40
+--- /dev/null
++++ b/librtmp/meson.build
+@@ -0,0 +1,32 @@
++libversion = '1'
++
++librtmp_sources = ['amf.c', 'hashswf.c', 'log.c', 'parseurl.c', 'rtmp.c']
++
++librtmp_c_args = [crypto_args]
++
++librtmp_incs = include_directories('.')
++
++install_headers(['amf.h', 'http.h', 'log.h', 'rtmp.h'], install_dir: 'include/librtmp')
++
++librtmp_c_args += cc.get_supported_arguments(['-Wno-pointer-sign', '-Wno-unused-but-set-variable'])
++
++# Lots of deprecation warnings with OpenSSL 3.0
++librtmp_c_args += cc.get_supported_arguments(['-Wno-deprecated-declarations'])
++
++librtmp = library('rtmp',
++ librtmp_sources,
++ version: libversion,
++ c_args: librtmp_c_args,
++ include_directories: librtmp_incs,
++ install: true,
++ dependencies: [crypto_dep, zlib_dep, sys_deps],
++ vs_module_defs: 'librtmp.def',
++)
++
++pkg_config = import('pkgconfig')
++pkg_config.generate(libraries : librtmp,
++ version : '2.4',
++ name : 'librtmp',
++ filebase : 'librtmp',
++ description : 'RTMP implementation',
++)
+diff --git a/meson.build b/meson.build
+new file mode 100644
+index 0000000..d68e322
+--- /dev/null
++++ b/meson.build
+@@ -0,0 +1,24 @@
++project('librtmp', 'c', version : '2.4')
++
++cc = meson.get_compiler('c')
++
++crypto_dep = dependency('openssl')
++zlib_dep = dependency('zlib')
++
++threads_dep = dependency('threads')
++
++sys_deps = [threads_dep]
++
++if host_machine.system() == 'windows'
++ sys_deps += [
++ cc.find_library('ws2_32'),
++ cc.find_library('winmm'),
++ cc.find_library('gdi32')
++ ]
++endif
++
++crypto_args = ['-DUSE_OPENSSL']
++
++subdir('librtmp')
++
++# Not building programs
+--
+2.43.0
+
diff --git a/recipes/librtmp/0007-Make-libdir-configurable.patch b/recipes/librtmp/0007-Make-libdir-configurable.patch
deleted file mode 100644
index 3e4d94ed..00000000
--- a/recipes/librtmp/0007-Make-libdir-configurable.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From c08ae6dfe2f0464fb03389d58304e37c2c3969d6 Mon Sep 17 00:00:00 2001
-From: Andoni Morales Alastruey <ylatuya@gmail.com>
-Date: Wed, 14 Oct 2020 17:28:32 +0200
-Subject: [PATCH] Make libdir configurable
-
----
- librtmp/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/librtmp/Makefile b/librtmp/Makefile
-index 159f0e3..29162ff 100644
---- a/librtmp/Makefile
-+++ b/librtmp/Makefile
-@@ -5,7 +5,7 @@ pkgconfig?=$(shell which pkg-config)
-
- incdir=$(prefix)/include/librtmp
- bindir=$(prefix)/bin
--libdir=$(prefix)/lib
-+libdir?=$(prefix)/lib
- mandir=$(prefix)/man
- BINDIR=$(DESTDIR)$(bindir)
- INCDIR=$(DESTDIR)$(incdir)
---
-2.26.0
-