[x265] Fix dependencies, modernize (#25747)

* [x265] No unguarded NUMA dependency

* [x265] Keep non-standard runtime libs in pc file

* Rewrite assembly options

* Modernize and cleanup

* Update versions
This commit is contained in:
Kai Pastor 2022-07-13 22:17:56 +02:00 committed by GitHub
parent 5f631cf955
commit ac68609a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 70 deletions

View File

@ -8,89 +8,52 @@ vcpkg_from_github(
disable-install-pdb.patch
)
set(ENABLE_ASSEMBLY OFF)
if (VCPKG_TARGET_IS_WINDOWS)
set(ASSEMBLY_OPTIONS "-DENABLE_ASSEMBLY=OFF")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}")
set(ENABLE_ASSEMBLY ON)
endif ()
set(ASSEMBLY_OPTIONS "-DENABLE_ASSEMBLY=ON" "-DNASM_EXECUTABLE=${NASM}")
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/source
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/source"
OPTIONS
-DENABLE_ASSEMBLY=${ENABLE_ASSEMBLY}
${ASSEMBLY_OPTIONS}
-DENABLE_SHARED=${ENABLE_SHARED}
-DENABLE_LIBNUMA=OFF
OPTIONS_DEBUG
-DENABLE_CLI=OFF
MAYBE_UNUSED_VARIABLES
ENABLE_LIBNUMA
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
# remove duplicated include files
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_tools(TOOL_NAMES x265 AUTO_CLEAN)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR VCPKG_TARGET_IS_LINUX)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND (NOT VCPKG_TARGET_IS_MINGW))
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc" "-lx265" "-lx265-static")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc" "-lx265" "-lx265-static")
endif()
endif()
endif()
# maybe create vcpkg_regex_replace_string?
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(READ ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc _contents)
string(REGEX REPLACE "-l(std)?c\\+\\+" "" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc "${_contents}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc _contents)
string(REGEX REPLACE "-l(std)?c\\+\\+" "" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc "${_contents}")
endif()
if(VCPKG_TARGET_IS_MINGW AND ENABLE_SHARED)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libx265.a)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libx265.a)
endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libx265.a")
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libx265.a")
endif()
if(UNIX)
foreach(FILE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc")
if(EXISTS "${FILE}")
file(READ "${FILE}" _contents)
string(REPLACE " -lstdc++" "" _contents "${_contents}")
string(REPLACE " -lc++" "" _contents "${_contents}")
string(REPLACE " -lgcc_s" "" _contents "${_contents}")
string(REPLACE " -lgcc" "" _contents "${_contents}")
string(REPLACE " -lrt" "" _contents "${_contents}")
file(WRITE "${FILE}" "${_contents}")
endif()
endforeach()
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES numa)
else()
vcpkg_fixup_pkgconfig()
vcpkg_fixup_pkgconfig()
vcpkg_list(SET pc_files "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_list(APPEND pc_files "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc")
endif()
foreach(FILE IN LISTS pc_files)
file(READ "${FILE}" _contents)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
string(REPLACE "-lx265" "-lx265-static" _contents "${_contents}")
else()
string(REPLACE " -lgcc_s" "" _contents "${_contents}")
string(REPLACE " -lgcc" "" _contents "${_contents}")
endif()
file(WRITE "${FILE}" "${_contents}")
endforeach()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,8 +1,15 @@
{
"name": "x265",
"version-string": "3.4",
"port-version": 5,
"version": "3.4",
"port-version": 6,
"description": "x265 is a H.265 / HEVC video encoder application library, designed to encode video or images into an H.265 / HEVC encoded bitstream.",
"homepage": "https://github.com/videolan/x265",
"supports": "!(uwp | arm)"
"license": "GPL-2.0",
"supports": "!(uwp | arm)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}

View File

@ -7666,7 +7666,7 @@
},
"x265": {
"baseline": "3.4",
"port-version": 5
"port-version": 6
},
"xalan-c": {
"baseline": "1.12",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "15ee257957dfa5a194cf602c160713369b7c313a",
"version": "3.4",
"port-version": 6
},
{
"git-tree": "3904d5293aad0e38ee7ca93b82182441bb1575ca",
"version-string": "3.4",