From 3761916b05b72c28074fd7471ea3b9809884bdcb Mon Sep 17 00:00:00 2001 From: thesn10 <38666407+thesn10@users.noreply.github.com> Date: Sun, 13 Jul 2025 22:18:57 +0200 Subject: [PATCH] gpac: add ffmpeg support & refactor --- pkgs/by-name/gp/gpac/package.nix | 102 +++++++++++++++++++++++++------ pkgs/top-level/all-packages.nix | 13 ++++ 2 files changed, 96 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/gp/gpac/package.nix b/pkgs/by-name/gp/gpac/package.nix index 44da242fca32..3b86c7fe2043 100644 --- a/pkgs/by-name/gp/gpac/package.nix +++ b/pkgs/by-name/gp/gpac/package.nix @@ -5,35 +5,98 @@ cctools, pkg-config, zlib, + ffmpeg, + freetype, + libjpeg, + libpng, + libmad, + faad2, + libogg, + libvorbis, + libtheora, + a52dec, + nghttp2, + openjpeg, + libcaca, + libXv, + mesa, + mesa_glu, + xvidcore, + openssl, + jack2, + alsa-lib, + pulseaudio, + SDL2, + curl, + + withFullDeps ? false, + withFfmpeg ? withFullDeps, + releaseChannel ? "stable", }: stdenv.mkDerivation rec { pname = "gpac"; - version = "2.4.0"; + version = if releaseChannel == "nightly" then "2.4-unstable-2025-07-11" else "2.4.0"; - src = fetchFromGitHub { - owner = "gpac"; - repo = "gpac"; - rev = "v${version}"; - hash = "sha256-RADDqc5RxNV2EfRTzJP/yz66p0riyn81zvwU3r9xncM="; - }; + src = + if releaseChannel == "nightly" then + fetchFromGitHub { + owner = "gpac"; + repo = "gpac"; + rev = "fe88c3545aadd597b250ccf23271d5d3de50ccc8"; + hash = "sha256-c6B9Y19ZZ3PLz82GCcjkWzcUQSEK7ufVNEzqHQqOvrI="; + } + else + fetchFromGitHub { + owner = "gpac"; + repo = "gpac"; + rev = "v${version}"; + hash = "sha256-RADDqc5RxNV2EfRTzJP/yz66p0riyn81zvwU3r9xncM="; + }; - # this is the bare minimum configuration, as I'm only interested in MP4Box - # For most other functionality, this should probably be extended - nativeBuildInputs = [ - pkg-config - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - cctools - ]; + nativeBuildInputs = + [ + pkg-config + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + cctools + ] + ++ lib.optionals withFfmpeg [ + ffmpeg + ]; + # ref: https://wiki.gpac.io/Build/build/GPAC-Build-Guide-for-Linux/#gpac-easy-build-recommended-for-most-users buildInputs = [ zlib + ] + ++ lib.optionals withFullDeps [ + freetype + libjpeg + libpng + libmad + faad2 + libogg + libvorbis + libtheora + a52dec + nghttp2 + openjpeg + libcaca + libXv + mesa + mesa_glu + xvidcore + openssl + jack2 + alsa-lib + pulseaudio + SDL2 + curl ]; enableParallelBuilding = true; - meta = with lib; { + meta = { description = "Open Source multimedia framework for research and academic purposes"; longDescription = '' GPAC is an Open Source multimedia framework for research and academic purposes. @@ -48,10 +111,11 @@ stdenv.mkDerivation rec { And some server tools included in MP4Box and MP42TS applications. ''; homepage = "https://gpac.wp.imt.fr"; - license = licenses.lgpl21; - maintainers = with maintainers; [ + license = lib.licenses.lgpl21; + maintainers = with lib.maintainers; [ mgdelacroix + thesn ]; - platforms = platforms.unix; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dcd95dbaf55d..aaa4994a3284 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14539,4 +14539,17 @@ with pkgs; davis = callPackage ../by-name/da/davis/package.nix { php = php83; # https://github.com/tchapi/davis/issues/195 }; + + gpac = callPackage ../by-name/gp/gpac/package.nix { + ffmpeg = ffmpeg.override { + version = "7.0.2"; + hash = "sha256-6bcTxMt0rH/Nso3X7zhrFNkkmWYtxsbUqVQKh25R1Fs="; + ffmpegVariant = "headless"; + }; + }; + + gpac_nightly = callPackage ../by-name/gp/gpac/package.nix { + ffmpeg = ffmpeg-headless; + releaseChannel = "nightly"; + }; }