From 85d7ad81837a8150464c6c29707d037ccae1161a Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Sun, 23 May 2021 22:12:50 +0300 Subject: [PATCH 1/9] [aom] Add new port --- ports/aom/aom-install.diff | 75 ++++++++++++++++++++++++++++++++ ports/aom/aom-rename-static.diff | 12 +++++ ports/aom/portfile.cmake | 49 +++++++++++++++++++++ ports/aom/usage | 4 ++ ports/aom/vcpkg.json | 17 ++++++++ 5 files changed, 157 insertions(+) create mode 100644 ports/aom/aom-install.diff create mode 100644 ports/aom/aom-rename-static.diff create mode 100644 ports/aom/portfile.cmake create mode 100644 ports/aom/usage create mode 100644 ports/aom/vcpkg.json diff --git a/ports/aom/aom-install.diff b/ports/aom/aom-install.diff new file mode 100644 index 00000000000000..64c45df5489685 --- /dev/null +++ b/ports/aom/aom-install.diff @@ -0,0 +1,75 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 18190f647..f4b1b359d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,6 +23,9 @@ endif() + + project(AOM C CXX) + ++include(GNUInstallDirs) ++include(CMakePackageConfigHelpers) ++ + if(NOT EMSCRIPTEN) + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE +@@ -289,6 +292,52 @@ if(BUILD_SHARED_LIBS) + set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static) + endif() + ++set(PUBLIC_HEADERS ++ aom/aom.h ++ aom/aom_codec.h ++ aom/aom_decoder.h ++ aom/aom_encoder.h ++ aom/aom_frame_buffer.h ++ aom/aom_image.h ++ aom/aom_integer.h ++ aom/aomcx.h ++ aom/aomdx.h ++) ++ ++set_target_properties(aom PROPERTIES ++ PUBLIC_HEADER "${PUBLIC_HEADERS}") ++ ++ ++target_include_directories(aom ++ PUBLIC $ ++ $) ++ ++install(TARGETS aom ++ EXPORT unofficial-aom-targets ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom") ++ ++install(EXPORT unofficial-aom-targets ++ FILE unofficial-aom-targets.cmake ++ NAMESPACE unofficial:: ++ DESTINATION lib/cmake/aom) ++ ++configure_package_config_file(cmake/aom-config.cmake.in ++ ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake ++ INSTALL_DESTINATION lib/cmake/aom ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO) ++ ++write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake ++ VERSION ${SO_FILE_VERSION} ++ COMPATIBILITY SameMajorVersion) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake ++ DESTINATION lib/cmake/aom) ++ + # Setup dependencies. + setup_aom_dsp_targets() + setup_aom_mem_targets() +diff --git a/cmake/aom-config.cmake.in b/cmake/aom-config.cmake.in +new file mode 100644 +index 000000000..91cac3b5b +--- /dev/null ++++ b/cmake/aom-config.cmake.in +@@ -0,0 +1,2 @@ ++@PACKAGE_INIT@ ++include(${CMAKE_CURRENT_LIST_DIR}/unofficial-aom-targets.cmake) diff --git a/ports/aom/aom-rename-static.diff b/ports/aom/aom-rename-static.diff new file mode 100644 index 00000000000000..e38c73fb174789 --- /dev/null +++ b/ports/aom/aom-rename-static.diff @@ -0,0 +1,12 @@ +diff -pruN aom-3.0.0.o/CMakeLists.txt aom-3.0.0/CMakeLists.txt +--- aom-3.0.0.o/CMakeLists.txt 2021-04-15 20:05:52.695181200 +0300 ++++ aom-3.0.0/CMakeLists.txt 2021-04-15 22:34:16.147522600 +0300 +@@ -249,7 +249,7 @@ endif() + add_library(aom ${AOM_SOURCES} $) + if(BUILD_SHARED_LIBS) + add_library(aom_static STATIC ${AOM_SOURCES} $) +- set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) + + if(NOT MSVC) + # Extract version string and set VERSION/SOVERSION for the aom target. diff --git a/ports/aom/portfile.cmake b/ports/aom/portfile.cmake new file mode 100644 index 00000000000000..0c6ff3c565407c --- /dev/null +++ b/ports/aom/portfile.cmake @@ -0,0 +1,49 @@ +vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "UWP") + +# NASM is required to build AOM +vcpkg_find_acquire_program(NASM) +get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) +vcpkg_add_to_path(${NASM_EXE_PATH}) + +# Perl is required to build AOM +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path(${PERL_PATH}) + +vcpkg_from_git( + OUT_SOURCE_PATH SOURCE_PATH + URL "https://aomedia.googlesource.com/aom" + REF 33aff8586e35ffe385637f6aa2c991858c0fb58e + TAG v3.1.0 + PATCHES + aom-rename-static.diff + aom-install.diff +) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DENABLE_DOCS=OFF + -DENABLE_EXAMPLES=OFF + -DENABLE_TESTDATA=OFF + -DENABLE_TESTS=OFF + -DENABLE_TOOLS=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_pdbs() + +# Move cmake configs +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) + +# Remove duplicate files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle usage +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aom/usage b/ports/aom/usage new file mode 100644 index 00000000000000..3d8efadbf6b2da --- /dev/null +++ b/ports/aom/usage @@ -0,0 +1,4 @@ +The package aom provides CMake targets: + + find_package(aom CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::aom) diff --git a/ports/aom/vcpkg.json b/ports/aom/vcpkg.json new file mode 100644 index 00000000000000..514500ae9ae55f --- /dev/null +++ b/ports/aom/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "aom", + "version-semver": "3.1.0", + "description": "AV1 codec library", + "homepage": "https://aomedia.googlesource.com/aom", + "supports": "!uwp & !arm64", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} From 575ebf48648e19163607d675f71861e9ada73119 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Sun, 23 May 2021 22:14:44 +0300 Subject: [PATCH 2/9] [aom] vcpkg x-add-version --all --- versions/baseline.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versions/baseline.json b/versions/baseline.json index b787b58a0dd8a4..0a8fa547b61d5e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -92,6 +92,10 @@ "baseline": "2020-01-13", "port-version": 2 }, + "aom": { + "baseline": "3.1.0", + "port-version": 0 + }, "apr": { "baseline": "1.7.0", "port-version": 3 From 4eb04c8f81507e1353a611f8ff34b0152dc93392 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Sun, 23 May 2021 22:27:19 +0300 Subject: [PATCH 3/9] [aom] Added versions/a-/aom.json --- versions/a-/aom.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 versions/a-/aom.json diff --git a/versions/a-/aom.json b/versions/a-/aom.json new file mode 100644 index 00000000000000..c4d593d3f43c6d --- /dev/null +++ b/versions/a-/aom.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "dcc51db063666bbc6620325c722b16d0a40a60b0", + "version-semver": "3.1.0", + "port-version": 0 + } + ] +} From e258d6295d44884b47d180b25256d4708e25687b Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Mon, 24 May 2021 18:25:23 +0300 Subject: [PATCH 4/9] [aom] Fixes after review --- ports/aom/portfile.cmake | 1 + ports/aom/vcpkg.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/aom/portfile.cmake b/ports/aom/portfile.cmake index 0c6ff3c565407c..74c90cdee69674 100644 --- a/ports/aom/portfile.cmake +++ b/ports/aom/portfile.cmake @@ -17,6 +17,7 @@ vcpkg_from_git( TAG v3.1.0 PATCHES aom-rename-static.diff + # Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream aom-install.diff ) diff --git a/ports/aom/vcpkg.json b/ports/aom/vcpkg.json index 514500ae9ae55f..d3743ba17b17a9 100644 --- a/ports/aom/vcpkg.json +++ b/ports/aom/vcpkg.json @@ -3,7 +3,7 @@ "version-semver": "3.1.0", "description": "AV1 codec library", "homepage": "https://aomedia.googlesource.com/aom", - "supports": "!uwp & !arm64", + "supports": "!uwp & !arm", "dependencies": [ { "name": "vcpkg-cmake", From 5c6df6b1edea1370725372c33e5c1b097889a50c Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Mon, 24 May 2021 18:25:52 +0300 Subject: [PATCH 5/9] [aom] vcpkg x-add-version --all --overwrite-version --- versions/a-/aom.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/a-/aom.json b/versions/a-/aom.json index c4d593d3f43c6d..25eea9ca1d49dc 100644 --- a/versions/a-/aom.json +++ b/versions/a-/aom.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "dcc51db063666bbc6620325c722b16d0a40a60b0", + "git-tree": "f99c8c6e8b058829edd89bfc80a8bd2aaf0dee85", "version-semver": "3.1.0", "port-version": 0 } From 9cf91b72080481fa0031c1bac6b5088e8d5c5420 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Mon, 24 May 2021 22:42:44 +0300 Subject: [PATCH 6/9] [aom] Remove usage --- ports/aom/portfile.cmake | 3 --- ports/aom/usage | 4 ---- 2 files changed, 7 deletions(-) delete mode 100644 ports/aom/usage diff --git a/ports/aom/portfile.cmake b/ports/aom/portfile.cmake index 74c90cdee69674..3e49972aa20ab8 100644 --- a/ports/aom/portfile.cmake +++ b/ports/aom/portfile.cmake @@ -43,8 +43,5 @@ vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) -# Handle usage -file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) - # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aom/usage b/ports/aom/usage deleted file mode 100644 index 3d8efadbf6b2da..00000000000000 --- a/ports/aom/usage +++ /dev/null @@ -1,4 +0,0 @@ -The package aom provides CMake targets: - - find_package(aom CONFIG REQUIRED) - target_link_libraries(main PRIVATE unofficial::aom) From 611890768790e149d099b25e8fb57c5bdd880c68 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Mon, 24 May 2021 22:47:02 +0300 Subject: [PATCH 7/9] [aom] vcpkg x-add-version --all --overwrite-version --- versions/a-/aom.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/a-/aom.json b/versions/a-/aom.json index 25eea9ca1d49dc..1d16493cb3b339 100644 --- a/versions/a-/aom.json +++ b/versions/a-/aom.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "f99c8c6e8b058829edd89bfc80a8bd2aaf0dee85", + "git-tree": "5ad9e1ff21c8fd9790c08393b5eac5e3cf582b5d", "version-semver": "3.1.0", "port-version": 0 } From d2d7688f23ed3b68260c98aac23eac8dabf549e7 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Tue, 25 May 2021 08:34:31 +0300 Subject: [PATCH 8/9] [aom] Update ports/aom/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/aom/portfile.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/aom/portfile.cmake b/ports/aom/portfile.cmake index 3e49972aa20ab8..65193664274b98 100644 --- a/ports/aom/portfile.cmake +++ b/ports/aom/portfile.cmake @@ -23,7 +23,6 @@ vcpkg_from_git( vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA OPTIONS -DENABLE_DOCS=OFF -DENABLE_EXAMPLES=OFF From 6c94d719ec56f8e74e803b4455f55c297175a3fd Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Tue, 25 May 2021 08:40:19 +0300 Subject: [PATCH 9/9] [aom] vcpkg x-add-version --all --overwrite-version --- versions/a-/aom.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/a-/aom.json b/versions/a-/aom.json index 1d16493cb3b339..075bb35c32be87 100644 --- a/versions/a-/aom.json +++ b/versions/a-/aom.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "5ad9e1ff21c8fd9790c08393b5eac5e3cf582b5d", + "git-tree": "b465c1a32eeac8dfe55239134d800c309b16b33f", "version-semver": "3.1.0", "port-version": 0 }