Skip to content

Commit 915af63

Browse files
shaka-packager: 2.6.1 -> 3.2.0 (#301846)
2 parents 00461d0 + c7592b7 commit 915af63

File tree

8 files changed

+308
-63
lines changed

8 files changed

+308
-63
lines changed

pkgs/applications/video/shaka-packager/default.nix

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index b0089ee..eb1b1c6 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -459,13 +459,20 @@ endif()
6+
# webm_parser headers are rooted at webm/.
7+
set_target_properties(webm PROPERTIES PUBLIC_HEADER
8+
"${webm_parser_public_headers}")
9+
+target_include_directories(webm INTERFACE $<INSTALL_INTERFACE:include/webm>)
10+
install(
11+
TARGETS webm
12+
+ EXPORT webmConfig
13+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
14+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
15+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
16+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webm)
17+
18+
+install(EXPORT webmConfig
19+
+ FILE webmConfig.cmake
20+
+ NAMESPACE webm::
21+
+ DESTINATION lib/cmake/webm)
22+
+
23+
# Install common headers into a subdirectory to avoid breaking nested includes.
24+
install(FILES ${libwebm_common_public_headers}
25+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webm/common)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
cmake,
6+
nix-update-script,
7+
}:
8+
9+
stdenv.mkDerivation (finalAttrs: {
10+
pname = "libwebm";
11+
version = "1.0.0.31";
12+
13+
src = fetchFromGitHub {
14+
owner = "webmproject";
15+
repo = "libwebm";
16+
rev = "refs/tags/libwebm-${finalAttrs.version}";
17+
hash = "sha256-+ayX33rcX/jkewsW8WrGalTe9X44qFBHOrIYTteOQzc=";
18+
};
19+
20+
patches = [
21+
# libwebm does not generate cmake exports by default,
22+
# which are necessary to find and use it as build-dependency
23+
# in other packages
24+
./0001-cmake-exports.patch
25+
];
26+
27+
nativeBuildInputs = [
28+
cmake
29+
];
30+
31+
outputs = [
32+
"dev"
33+
"out"
34+
];
35+
36+
cmakeFlags = [
37+
"-DBUILD_SHARED_LIBS=ON"
38+
];
39+
40+
passthru.updateScript = nix-update-script { };
41+
42+
meta = {
43+
description = "WebM file parser";
44+
homepage = "https://www.webmproject.org/code/";
45+
license = lib.licenses.bsd3;
46+
maintainers = with lib.maintainers; [ niklaskorz ];
47+
platforms = lib.platforms.all;
48+
};
49+
})
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From e243cc17f48c5e1b8db29cab85ca98b033d972fb Mon Sep 17 00:00:00 2001
2+
From: Niklas Korz <[email protected]>
3+
Date: Wed, 4 Sep 2024 14:51:30 +0200
4+
Subject: [PATCH 1/3] Allow external declaration of packager version
5+
6+
---
7+
packager/version/CMakeLists.txt | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/packager/version/CMakeLists.txt b/packager/version/CMakeLists.txt
11+
index fba4fb8282..ad56e0a23b 100644
12+
--- a/packager/version/CMakeLists.txt
13+
+++ b/packager/version/CMakeLists.txt
14+
@@ -4,6 +4,7 @@
15+
# license that can be found in the LICENSE file or at
16+
# https://developers.google.com/open-source/licenses/bsd
17+
18+
+if(NOT DEFINED PACKAGER_VERSION)
19+
execute_process(
20+
COMMAND "${Python3_EXECUTABLE}" generate_version_string.py
21+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
22+
@@ -14,6 +15,7 @@ execute_process(
23+
if(NOT STATUS EQUAL 0)
24+
message(FATAL_ERROR "Failed to generate Packager version")
25+
endif()
26+
+endif()
27+
28+
add_library(version STATIC version.cc)
29+
target_compile_definitions(version PRIVATE
30+
--
31+
2.46.0
32+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From 4c7743f4fd231648d7bd1513c9db71a651ef7553 Mon Sep 17 00:00:00 2001
2+
From: Niklas Korz <[email protected]>
3+
Date: Wed, 4 Sep 2024 14:52:23 +0200
4+
Subject: [PATCH 2/3] Unvendor dependencies
5+
6+
---
7+
CMakeLists.txt | 24 ++++++++++++++++++++++++
8+
packager/CMakeLists.txt | 1 -
9+
2 files changed, 24 insertions(+), 1 deletion(-)
10+
11+
diff --git a/CMakeLists.txt b/CMakeLists.txt
12+
index 5b96a2429e..181df0bf2d 100644
13+
--- a/CMakeLists.txt
14+
+++ b/CMakeLists.txt
15+
@@ -9,6 +9,8 @@
16+
# Minimum CMake version. This must be in the root level CMakeLists.txt.
17+
cmake_minimum_required(VERSION 3.24)
18+
19+
+set(CMAKE_CXX_STANDARD 17)
20+
+
21+
# These policy settings should be included before the project definition.
22+
include("packager/policies.cmake")
23+
24+
@@ -28,6 +30,28 @@ enable_testing()
25+
26+
option(SKIP_INTEGRATION_TESTS "Skip the packager integration tests" OFF)
27+
28+
+find_package(absl REQUIRED)
29+
+find_package(MbedTLS REQUIRED)
30+
+find_package(GTest REQUIRED)
31+
+find_package(CURL REQUIRED)
32+
+find_package(LibXml2 REQUIRED)
33+
+find_package(PNG REQUIRED)
34+
+find_package(nlohmann_json REQUIRED)
35+
+find_package(Protobuf CONFIG REQUIRED)
36+
+find_package(webm REQUIRED)
37+
+
38+
+# Alias to same names as vendored dependencies
39+
+add_library(mbedtls ALIAS MbedTLS::mbedtls)
40+
+add_library(gmock ALIAS GTest::gmock)
41+
+add_library(gtest ALIAS GTest::gtest)
42+
+add_library(gtest_main ALIAS GTest::gtest_main)
43+
+add_library(libcurl ALIAS CURL::libcurl)
44+
+add_library(LibXml2 ALIAS LibXml2::LibXml2)
45+
+add_library(png_static ALIAS PNG::PNG) # not static but the expected library name
46+
+add_library(libprotobuf ALIAS protobuf::libprotobuf)
47+
+add_executable(protoc ALIAS protobuf::protoc)
48+
+add_library(webm ALIAS webm::webm)
49+
+
50+
# Subdirectories with their own CMakeLists.txt
51+
add_subdirectory(packager)
52+
add_subdirectory(link-test)
53+
diff --git a/packager/CMakeLists.txt b/packager/CMakeLists.txt
54+
index 7238d243bb..722217bbc4 100644
55+
--- a/packager/CMakeLists.txt
56+
+++ b/packager/CMakeLists.txt
57+
@@ -78,7 +78,6 @@ add_subdirectory(media)
58+
add_subdirectory(hls)
59+
add_subdirectory(mpd)
60+
add_subdirectory(status)
61+
-add_subdirectory(third_party)
62+
add_subdirectory(tools)
63+
add_subdirectory(utils)
64+
add_subdirectory(version)
65+
--
66+
2.46.0
67+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From c8b0b467a140d8a67157f5cee26a8510444706be Mon Sep 17 00:00:00 2001
2+
From: Niklas Korz <[email protected]>
3+
Date: Wed, 4 Sep 2024 14:52:47 +0200
4+
Subject: [PATCH 3/3] Fix curl deprecations
5+
6+
---
7+
packager/file/http_file.cc | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/packager/file/http_file.cc b/packager/file/http_file.cc
11+
index b50fef6f07..dca43e26ca 100644
12+
--- a/packager/file/http_file.cc
13+
+++ b/packager/file/http_file.cc
14+
@@ -311,7 +311,7 @@ void HttpFile::SetupRequest() {
15+
curl_easy_setopt(curl, CURLOPT_POST, 1L);
16+
break;
17+
case HttpMethod::kPut:
18+
- curl_easy_setopt(curl, CURLOPT_PUT, 1L);
19+
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
20+
break;
21+
}
22+
23+
--
24+
2.46.0
25+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
testers,
6+
cmake,
7+
ninja,
8+
python3,
9+
nix-update-script,
10+
abseil-cpp,
11+
curl,
12+
gtest,
13+
nlohmann_json,
14+
libpng,
15+
libxml2,
16+
libwebm,
17+
mbedtls,
18+
mimalloc,
19+
protobuf,
20+
zlib,
21+
}:
22+
23+
stdenv.mkDerivation (finalAttrs: {
24+
pname = "shaka-packager";
25+
version = "3.2.0";
26+
27+
src = fetchFromGitHub {
28+
owner = "shaka-project";
29+
repo = "shaka-packager";
30+
rev = "refs/tags/v${finalAttrs.version}";
31+
hash = "sha256-L10IMsc4dTMa5zwYq612F4J+uKOmEEChY8k/m09wuNE=";
32+
};
33+
34+
patches = [
35+
# By default, the git commit hash and tag are used as version
36+
# and shaka-packager fails to build if these are not available.
37+
# This patch makes it possible to pass an external value as version.
38+
# The value itself is declared further below in `cmakeFlags`.
39+
./0001-Allow-external-declaration-of-packager-version.patch
40+
# Dependencies are vendored as git submodules inside shaka-packager.
41+
# We want to reuse the dependencies from nixpkgs instead to avoid unnecessary
42+
# build overhead and to ensure they are up to date.
43+
# This patch disables the vendored dependencies (by excluding `third-party`),
44+
# finds them inside the build environment and aliases them so they can be accessed
45+
# without prefixing namespaces.
46+
# The last step is necessary to keep the patch size to a minimum, otherwise we'd have
47+
# to add the namespace identifiers everywhere a dependency is used.
48+
./0002-Unvendor-dependencies.patch
49+
# As nixpkgs ships with a newer version of libcurl than the one vendored in shaka-packager,
50+
# we have to fix one deprecation.
51+
# See https://curl.se/libcurl/c/CURLOPT_PUT.html for further information.
52+
./0003-Fix-curl-deprecations.patch
53+
];
54+
55+
nativeBuildInputs = [
56+
cmake
57+
ninja
58+
];
59+
60+
buildInputs = [
61+
python3
62+
abseil-cpp
63+
curl
64+
gtest
65+
nlohmann_json
66+
libpng
67+
libxml2
68+
libwebm
69+
mbedtls
70+
mimalloc
71+
(protobuf.override {
72+
# must be the same version as for shaka-packager
73+
inherit abseil-cpp;
74+
})
75+
zlib
76+
];
77+
78+
cmakeFlags = [
79+
"-DPACKAGER_VERSION=v${finalAttrs.version}-nixpkgs"
80+
# Targets are selected below in ninjaFlags
81+
"-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON"
82+
];
83+
84+
ninjaFlags = [
85+
"mpd_generator"
86+
"packager"
87+
"pssh_box_py"
88+
];
89+
90+
passthru = {
91+
updateScript = nix-update-script { };
92+
tests.version = testers.testVersion {
93+
package = finalAttrs.finalPackage;
94+
version = "v${finalAttrs.version}-nixpkgs-release";
95+
};
96+
};
97+
98+
meta = with lib; {
99+
description = "Media packaging framework for VOD and Live DASH and HLS applications";
100+
homepage = "https://shaka-project.github.io/shaka-packager/html/";
101+
changelog = "https://github.com/shaka-project/shaka-packager/releases/tag/v${finalAttrs.version}";
102+
license = licenses.bsd3;
103+
mainProgram = "packager";
104+
maintainers = with maintainers; [ niklaskorz ];
105+
platforms = platforms.all;
106+
};
107+
})

pkgs/top-level/all-packages.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31337,7 +31337,9 @@ with pkgs;
3133731337

3133831338
mpvScripts = mpv-unwrapped.scripts;
3133931339

31340-
shaka-packager = callPackage ../applications/video/shaka-packager { };
31340+
shaka-packager = callPackage ../by-name/sh/shaka-packager/package.nix {
31341+
abseil-cpp = abseil-cpp_202401;
31342+
};
3134131343

3134231344
mpvpaper = callPackage ../tools/wayland/mpvpaper { };
3134331345

0 commit comments

Comments
 (0)