commit:     d6c049ccb36319fdca8883f34f3227d2cfc40589
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 13 01:03:25 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 13 04:21:54 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6c049cc

media-video/gpac: add 2.4.0

Closes: https://bugs.gentoo.org/913229
Closes: https://bugs.gentoo.org/919717
Closes: https://bugs.gentoo.org/926819
Closes: https://bugs.gentoo.org/934641
Closes: https://bugs.gentoo.org/940227
Closes: https://bugs.gentoo.org/951221
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 media-video/gpac/Manifest                          |   1 +
 .../gpac/files/gpac-2.4.0-configure-stddef.patch   |  19 +++
 media-video/gpac/files/gpac-2.4.0-ffmpeg7.patch    |  71 ++++++++++
 media-video/gpac/gpac-2.4.0.ebuild                 | 143 +++++++++++++++++++++
 4 files changed, 234 insertions(+)

diff --git a/media-video/gpac/Manifest b/media-video/gpac/Manifest
index c3e8ca33dce5..8b033192b1ef 100644
--- a/media-video/gpac/Manifest
+++ b/media-video/gpac/Manifest
@@ -1,2 +1,3 @@
 DIST gpac-2.0.0.tar.gz 11362932 BLAKE2B 
a8489831efb77c374d13e2edb3951e60a94907c4cd8601919e1390aee0e9002249e97a9200fd006c2aa783c516f701f7695aa84b5f3596a3bc90290916ff4086
 SHA512 
e95e6d78167fc306917b3ac89e56ba511bbcb0c825da118f5ba374504499352104b5c1f3ee71e7ec018015b8e302f9b07162d22287ddb21c8564b097d900913f
 DIST gpac-2.2.1.tar.gz 11377184 BLAKE2B 
44b47459da0f203d0e4c0eed5836a59f44fb508db4e601b46e9ffdb53d89bb49e22ccdfe7951b17581130f186c47ae8efc0d9002685d5cf9a3547159356d2d9e
 SHA512 
873df4c2fdc3594a0f3bce66d511cee14669643042ab1ca8d7f370ad3f50636c32c31f79818051d00bf844de30a5533ae30c81ed168baf2626a152771b6a6845
+DIST gpac-2.4.0.tar.gz 9914579 BLAKE2B 
09d7eeb390b4d10a6d144bf4046a7b53283fa05be01c663e0cd82e8b7b8d9dece30ef42747c12a7477f5b13ca7c7e18905f36d3f20396bb50937a249729fd3a8
 SHA512 
164d8a1ff235413852cc2077b5153c36b094862b61fdda12065bf6810926caabd1a1f6f30b7aac9a5b640f51fe92a6ca911518a424cab7220b635920d95da99f

diff --git a/media-video/gpac/files/gpac-2.4.0-configure-stddef.patch 
b/media-video/gpac/files/gpac-2.4.0-configure-stddef.patch
new file mode 100644
index 000000000000..05a9ac08b54d
--- /dev/null
+++ b/media-video/gpac/files/gpac-2.4.0-configure-stddef.patch
@@ -0,0 +1,19 @@
+https://github.com/gpac/gpac/commit/a005fd6eb7a9ede4d3356630cae3d6516c91b73e
+--- a/configure
++++ b/configure
+@@ -1593,2 +1593,3 @@
+ #include <openssl/rand.h>
++#include <stddef.h>
+ int main( void ) {  SSL_CTX_set_options(NULL, SSL_OP_ALL); return 0; }'
+@@ -1619,2 +1620,3 @@
+ config_package png "libpng" "" "-lpng -lz" "png" '#include <png.h>
++#include <stddef.h>
+ int main( void ) {  png_struct *png_ptr = 
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); return 0; }'
+@@ -1635,2 +1637,3 @@
+ config_package xvid "xvid" "" "-lxvidcore $PTHREAD_LDFLAGS" "" '#include 
<xvid.h>
++#include <stddef.h>
+ int main( void ) { void *codec; xvid_decore(codec, XVID_DEC_DESTROY, NULL, 
NULL); return 0; }'
+@@ -1688,2 +1691,3 @@
+ config_package freenect "libfreenect" "" "-lfreenect" "freenect" '#include 
<libfreenect/libfreenect.h>
++#include <stddef.h>
+ int main( void ) { freenect_context *f_ctx; freenect_init(&f_ctx, NULL); 
return 0; }'

diff --git a/media-video/gpac/files/gpac-2.4.0-ffmpeg7.patch 
b/media-video/gpac/files/gpac-2.4.0-ffmpeg7.patch
new file mode 100644
index 000000000000..e9485dfa5f65
--- /dev/null
+++ b/media-video/gpac/files/gpac-2.4.0-ffmpeg7.patch
@@ -0,0 +1,71 @@
+https://bugs.gentoo.org/951221
+https://github.com/gpac/gpac/commit/18863aa2176e423dae2a6d7e39ff6ed6a37b2b78
+--- a/src/filters/ff_dmx.c
++++ b/src/filters/ff_dmx.c
+@@ -2202,5 +2202,4 @@
+ {
+       const AVInputFormat *fmt;
+-      AVFormatContext *ctx;
+ 
+     if (!dev_name) return;
+@@ -2211,33 +2210,13 @@
+               return;
+       }
+-    ctx = avformat_alloc_context();
+-    if (!ctx) return;
+-    ctx->iformat = (AVInputFormat *)fmt;
+-    if (ctx->iformat->priv_data_size > 0) {
+-        ctx->priv_data = av_mallocz(ctx->iformat->priv_data_size);
+-        if (!ctx->priv_data) {
+-                      avformat_free_context(ctx);
+-            return;
+-        }
+-        if (ctx->iformat->priv_class) {
+-            *(const AVClass**)ctx->priv_data = ctx->iformat->priv_class;
+-            av_opt_set_defaults(ctx->priv_data);
+-        }
+-    } else {
+-        ctx->priv_data = NULL;
+-      }
+ 
+       AVDeviceInfoList *dev_list = NULL;
+-
+-    AVDictionary *tmp = NULL;
+-      av_dict_set(&tmp, "list_devices", "1", 0);
+-    av_opt_set_dict2(ctx, &tmp, AV_OPT_SEARCH_CHILDREN);
+-      if (tmp)
+-              av_dict_free(&tmp);
+-
+-      int res = avdevice_list_devices(ctx, &dev_list);
++      int res = avdevice_list_input_sources(fmt, dev_name, NULL, &dev_list);
+       if (res<0) {
+               //device doesn't implement avdevice_list_devices, try loading 
the context using "list_devices=1" option
+               if (-res == ENOSYS) {
++                      AVFormatContext *ctx = avformat_alloc_context();
++                      if (!ctx) return;
++
+                       AVDictionary *opts = NULL;
+                       av_dict_set(&opts, "list_devices", "1", 0);
+@@ -2245,6 +2224,15 @@
+                       if (opts)
+                               av_dict_free(&opts);
++
++#if !defined(__DARWIN__) && !defined(__APPLE__)
++                      // FIXME: no-op, permission issues on macOS Sonoma+
++                      if (res>=0) avdevice_list_devices(ctx, &dev_list);
++#endif
++
++                      if (res>=0) avformat_close_input(&ctx);
++                      avformat_free_context(ctx);
+               }
+-      } else if (!res && dev_list->nb_devices) {
++      }
++      if (!res && dev_list && dev_list->nb_devices) {
+               if (!dev_desc) {
+                       gf_dynstrcat(&dev_desc, "# Detected devices\n", NULL);
+@@ -2263,5 +2251,4 @@
+ 
+       if (dev_list) avdevice_free_list_devices(&dev_list);
+-      avformat_free_context(ctx);
+ }
+ 

diff --git a/media-video/gpac/gpac-2.4.0.ebuild 
b/media-video/gpac/gpac-2.4.0.ebuild
new file mode 100644
index 000000000000..68d3e1977978
--- /dev/null
+++ b/media-video/gpac/gpac-2.4.0.ebuild
@@ -0,0 +1,143 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs xdg
+
+DESCRIPTION="Implementation of the MPEG-4 Systems standard developed from 
scratch in ANSI C"
+HOMEPAGE="https://gpac.wp.imt.fr/";
+SRC_URI="https://github.com/gpac/gpac/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1+"
+SLOT="0/12"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="
+       X a52 aac alsa dvb ffmpeg http2 jack jpeg jpeg2k libcaca lzma mad
+       opengl png pulseaudio sdl ssl theora truetype vorbis xvid
+"
+
+RDEPEND="
+       sys-libs/zlib:=
+       X? (
+               x11-libs/libX11
+               x11-libs/libXv
+               x11-libs/libXext
+       )
+       a52? ( media-libs/a52dec )
+       aac? ( media-libs/faad2 )
+       alsa? ( media-libs/alsa-lib )
+       ffmpeg? ( media-video/ffmpeg:= )
+       http2? ( net-libs/nghttp2:= )
+       jack? ( virtual/jack )
+       jpeg2k? ( media-libs/openjpeg:2= )
+       jpeg? ( media-libs/libjpeg-turbo:= )
+       libcaca? ( media-libs/libcaca )
+       lzma? ( app-arch/xz-utils )
+       mad? ( media-libs/libmad )
+       opengl? (
+               media-libs/libglvnd[X]
+               x11-libs/libX11
+               virtual/glu
+       )
+       png? ( media-libs/libpng:= )
+       pulseaudio? ( media-libs/libpulse )
+       sdl? ( media-libs/libsdl2 )
+       ssl? ( dev-libs/openssl:= )
+       theora? (
+               media-libs/libogg
+               media-libs/libtheora
+       )
+       truetype? ( media-libs/freetype )
+       vorbis? ( media-libs/libvorbis )
+       xvid? ( media-libs/xvid )
+"
+DEPEND="
+       ${RDEPEND}
+       X? ( x11-base/xorg-proto )
+       dvb? ( sys-kernel/linux-headers )
+"
+BDEPEND="
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-configure-stddef.patch
+       "${FILESDIR}"/${P}-ffmpeg7.patch
+)
+
+src_prepare() {
+       default
+
+       # respect *FLAGS
+       sed -e '/^sseflags=/d' -e 's/-O[0-3] //' -i configure || die
+
+       # some configure options are ignored? (check if still needed on bump)
+       use alsa || sed -i 's/^check_has_lib alsa/:/' configure || die
+       use jack || sed -i 's/^check_has_lib jack/:/' configure || die
+       use lzma || sed -i 's/^check_has_lib lzma/:/' configure || die
+       use pulseaudio || sed -i 's/^check_has_lib pulseaudio/:/' configure || 
die
+       use sdl || sed -i 's/has_sdl=.*/has_sdl=no/' configure || die
+}
+
+src_configure() {
+       tc-export AR CC CXX RANLIB
+
+       gpac_use() {
+               usex ${1} --use-${2:-${1}}={system,no}
+       }
+
+       local conf=(
+               ./configure # not autotools-based
+
+               --prefix="${EPREFIX}"/usr
+               --libdir="$(get_libdir)"
+               --extra-cflags="${CFLAGS}"
+               --enable-pic
+               --verbose
+
+               $(use_enable X x11)
+               $(use_enable dvb dvbx)
+               $(use_enable opengl 3d)
+
+               $(gpac_use a52)
+               $(gpac_use alsa)
+               $(gpac_use dvb dvb4linux)
+               $(gpac_use aac faad)
+               $(gpac_use ffmpeg)
+               $(gpac_use truetype freetype)
+               --use-hid=no # only for a deprecated module
+               $(gpac_use jack)
+               $(gpac_use jpeg)
+               $(gpac_use libcaca)
+               $(gpac_use lzma)
+               $(gpac_use mad)
+               $(gpac_use http2 nghttp2)
+               $(gpac_use jpeg2k openjpeg)
+               $(gpac_use png)
+               $(gpac_use pulseaudio)
+               $(gpac_use sdl)
+               $(gpac_use ssl)
+               $(gpac_use vorbis)
+               $(gpac_use theora)
+               $(gpac_use xvid)
+
+               # not packaged
+               --use-caption=no
+               --use-directfb=no
+               --use-freenect=no
+               --use-mpeghdec=no
+               --use-openhevc=no
+               --use-opensvc=no
+       )
+
+       einfo "${conf[*]}"
+       "${conf[@]}" || die
+}
+
+src_install() {
+       emake STRIP=: DESTDIR="${D}" install
+       dodoc Changelog README.md share/doc/{*.{bt,doc,txt},SceneGenerators}
+
+       find "${ED}" -type f -name '*.a' -delete || die
+}

Reply via email to