Unverified Commit add510a6 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

shaka-packager: 3.4.2 -> 3.7.0 (#496924)

parents 57f032b8 178a6c71
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
diff --git a/packager/version/CMakeLists.txt b/packager/version/CMakeLists.txt
index fba4fb8282..ad56e0a23b 100644
--- a/packager/version/CMakeLists.txt
+++ b/packager/version/CMakeLists.txt
@@ -4,6 +4,7 @@
 # license that can be found in the LICENSE file or at
 # https://developers.google.com/open-source/licenses/bsd
 
+if(NOT DEFINED PACKAGER_VERSION)
 execute_process(
     COMMAND "${Python3_EXECUTABLE}" generate_version_string.py
     WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -14,6 +15,7 @@ execute_process(
 if(NOT STATUS EQUAL 0)
   message(FATAL_ERROR "Failed to generate Packager version")
 endif()
+endif()
 
 add_library(version STATIC version.cc)
 target_compile_definitions(version PRIVATE
+0 −78
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b96a2429e..181df0bf2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,8 @@
 # Minimum CMake version.  This must be in the root level CMakeLists.txt.
 cmake_minimum_required(VERSION 3.24)
 
+set(CMAKE_CXX_STANDARD 17)
+
 # These policy settings should be included before the project definition.
 include("packager/policies.cmake")
 
@@ -28,6 +30,28 @@ enable_testing()
 
 option(SKIP_INTEGRATION_TESTS "Skip the packager integration tests" OFF)
 
+find_package(absl REQUIRED)
+find_package(MbedTLS REQUIRED)
+find_package(GTest REQUIRED)
+find_package(CURL REQUIRED)
+find_package(LibXml2 REQUIRED)
+find_package(PNG REQUIRED)
+find_package(nlohmann_json REQUIRED)
+find_package(Protobuf CONFIG REQUIRED)
+find_package(webm REQUIRED)
+
+# Alias to same names as vendored dependencies
+add_library(mbedtls ALIAS MbedTLS::mbedtls)
+add_library(gmock ALIAS GTest::gmock)
+add_library(gtest ALIAS GTest::gtest)
+add_library(gtest_main ALIAS GTest::gtest_main)
+add_library(libcurl ALIAS CURL::libcurl)
+add_library(LibXml2 ALIAS LibXml2::LibXml2)
+add_library(png_static ALIAS PNG::PNG) # not static but the expected library name
+add_library(libprotobuf ALIAS protobuf::libprotobuf)
+add_executable(protoc ALIAS protobuf::protoc)
+add_library(webm ALIAS webm::webm)
+
 # Subdirectories with their own CMakeLists.txt
 add_subdirectory(packager)
 add_subdirectory(link-test)
diff --git a/packager/CMakeLists.txt b/packager/CMakeLists.txt
index 7238d243bb..722217bbc4 100644
--- a/packager/CMakeLists.txt
+++ b/packager/CMakeLists.txt
@@ -78,7 +78,6 @@ add_subdirectory(media)
 add_subdirectory(hls)
 add_subdirectory(mpd)
 add_subdirectory(status)
-add_subdirectory(third_party)
 add_subdirectory(tools)
 add_subdirectory(utils)
 add_subdirectory(version)
diff --git a/packager/tools/pssh/CMakeLists.txt b/packager/tools/pssh/CMakeLists.txt
index 9ec3a39d26..0b981cec29 100644
--- a/packager/tools/pssh/CMakeLists.txt
+++ b/packager/tools/pssh/CMakeLists.txt
@@ -14,7 +14,6 @@ set(PSSH_BOX_OUTPUTS
 
 add_custom_command(
     DEPENDS
-        protobuf_py
         widevine_protos
         pssh-box.py
     OUTPUT ${PSSH_BOX_OUTPUTS}
@@ -26,10 +25,6 @@ add_custom_command(
         ${CMAKE_BINARY_DIR}/packager/media/base/widevine_common_encryption_pb2.py
         ${CMAKE_BINARY_DIR}/packager/media/base/widevine_pssh_data_pb2.py
         ${CMAKE_BINARY_DIR}/packager/pssh-box-protos/
-    COMMAND
-        ${CMAKE_COMMAND} -E copy_directory
-        ${CMAKE_BINARY_DIR}/packager/third_party/protobuf/py/google
-        ${CMAKE_BINARY_DIR}/packager/pssh-box-protos/google
     COMMAND
         ${CMAKE_COMMAND} -E copy
         ${CMAKE_CURRENT_SOURCE_DIR}/pssh-box.py
+7 −36
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchpatch,
  fetchFromGitHub,
  testers,
  cmake,
  ninja,
  python3,
  nix-update-script,
  abseil-cpp_202401,
  abseil-cpp,
  curl,
  gtest,
  nlohmann_json,
@@ -17,47 +16,21 @@
  libwebm,
  mbedtls,
  mimalloc,
  protobuf_29,
  protobuf,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "shaka-packager";
  version = "3.4.2";
  version = "3.7.0";

  src = fetchFromGitHub {
    owner = "shaka-project";
    repo = "shaka-packager";
    tag = "v${finalAttrs.version}";
    hash = "sha256-Syty10LHGIlP5Jw+UneQMN+wBz/ggvV0xV8+3ThU8SM=";
    hash = "sha256-2kOQEkLNEX8TvHhef8RGHRGRRuhYDLhnuo11MCCnzPk=";
  };

  patches = [
    # By default, the git commit hash and tag are used as version
    # and shaka-packager fails to build if these are not available.
    # This patch makes it possible to pass an external value as version.
    # The value itself is declared further below in `cmakeFlags`.
    ./0001-Allow-external-declaration-of-packager-version.patch
    # Dependencies are vendored as git submodules inside shaka-packager.
    # We want to reuse the dependencies from nixpkgs instead to avoid unnecessary
    # build overhead and to ensure they are up to date.
    # This patch disables the vendored dependencies (by excluding `third-party`),
    # finds them inside the build environment and aliases them so they can be accessed
    # without prefixing namespaces.
    # The last step is necessary to keep the patch size to a minimum, otherwise we'd have
    # to add the namespace identifiers everywhere a dependency is used.
    ./0002-Unvendor-dependencies.patch
    # GCC15 build fixes
    # Taken from https://github.com/shaka-project/shaka-packager/pull/1506,
    # but excludes the changes to the shell script as we do not use it.
    (fetchpatch {
      name = "GCC15-cstdint-includes";
      url = "https://github.com/shaka-project/shaka-packager/commit/b1c79e50521b8725117dfe0a45fe44c2f2dbd4fb.patch";
      excludes = [ "packager/testing/test_dockers.sh" ];
      hash = "sha256-8dBQ+eENZKFB9ONjmPBlxy8P/iinyeUS8zhlxz6rnQ4=";
    })
  ];

  nativeBuildInputs = [
    cmake
    ninja
@@ -70,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
      # pssh_box.py.
      ps.protobuf
    ]))
    abseil-cpp_202401
    abseil-cpp
    curl
    gtest
    nlohmann_json
@@ -79,15 +52,13 @@ stdenv.mkDerivation (finalAttrs: {
    libwebm
    mbedtls
    mimalloc
    (protobuf_29.override {
      # must be the same version as for shaka-packager
      abseil-cpp = abseil-cpp_202401;
    })
    protobuf
    zlib
  ];

  cmakeFlags = [
    "-DPACKAGER_VERSION=v${finalAttrs.version}-nixpkgs"
    "-DUSE_SYSTEM_DEPENDENCIES=ON"
    # Targets are selected below in ninjaFlags
    "-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON"
  ];