2021-11-04 13:07:18 +08:00
|
|
|
set(X264_VERSION 164)
|
2018-02-22 12:12:49 +08:00
|
|
|
|
2021-01-27 06:55:06 +08:00
|
|
|
vcpkg_fail_port_install(ON_ARCH "arm")
|
2019-10-05 22:51:07 +08:00
|
|
|
|
2018-02-22 12:12:49 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO mirror/x264
|
2021-11-04 13:07:18 +08:00
|
|
|
REF 5db6aa6cab1b146e07b60cc1736a01f21da01154
|
|
|
|
SHA512 d2cdd40d195fd6507abacc8b8810107567dff2c0a93424ba1eb00b544cb78a5430f00f9bcf8f19bd663ae77849225577da05bfcdb57948a8af9dc32a7c8b9ffd
|
|
|
|
HEAD_REF stable
|
2019-05-10 04:06:36 +08:00
|
|
|
PATCHES
|
|
|
|
"uwp-cflags.patch"
|
2018-04-20 05:26:48 +08:00
|
|
|
)
|
|
|
|
|
2020-10-09 11:55:13 +08:00
|
|
|
vcpkg_find_acquire_program(NASM)
|
|
|
|
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
|
2021-01-27 06:55:06 +08:00
|
|
|
vcpkg_add_to_path(${NASM_EXE_PATH})
|
2020-10-09 11:55:13 +08:00
|
|
|
|
2020-08-14 04:32:55 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
2021-10-21 05:12:58 +08:00
|
|
|
z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH)
|
|
|
|
z_vcpkg_determine_autotools_target_cpu(HOST_ARCH)
|
2020-08-14 04:32:55 +08:00
|
|
|
list(APPEND OPTIONS --build=${BUILD_ARCH}-pc-mingw32)
|
|
|
|
list(APPEND OPTIONS --host=${HOST_ARCH}-pc-mingw32)
|
2020-11-11 01:52:02 +08:00
|
|
|
set(ENV{AS} "${NASM}")
|
2020-08-14 04:32:55 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_UWP)
|
|
|
|
list(APPEND OPTIONS --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00)
|
|
|
|
list(APPEND OPTIONS --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib)
|
2020-10-09 11:55:13 +08:00
|
|
|
list(APPEND OPTIONS --disable-asm)
|
2020-08-14 04:32:55 +08:00
|
|
|
endif()
|
|
|
|
|
2020-10-09 11:55:13 +08:00
|
|
|
if(VCPKG_TARGET_IS_LINUX)
|
|
|
|
list(APPEND OPTIONS --enable-pic)
|
|
|
|
endif()
|
2020-08-14 04:32:55 +08:00
|
|
|
|
2019-10-05 22:51:07 +08:00
|
|
|
vcpkg_configure_make(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2020-08-14 04:32:55 +08:00
|
|
|
NO_ADDITIONAL_PATHS
|
2019-10-05 22:51:07 +08:00
|
|
|
OPTIONS
|
2020-08-14 04:32:55 +08:00
|
|
|
${OPTIONS}
|
2019-10-05 22:51:07 +08:00
|
|
|
--enable-strip
|
|
|
|
--disable-lavf
|
|
|
|
--disable-swscale
|
|
|
|
--disable-avs
|
|
|
|
--disable-ffms
|
|
|
|
--disable-gpac
|
|
|
|
--disable-lsmash
|
|
|
|
--enable-debug
|
2020-08-14 04:32:55 +08:00
|
|
|
|
2019-10-05 22:51:07 +08:00
|
|
|
)
|
2018-02-22 12:12:49 +08:00
|
|
|
|
2019-10-05 22:51:07 +08:00
|
|
|
vcpkg_install_make()
|
2021-01-27 06:55:06 +08:00
|
|
|
|
|
|
|
if(NOT VCPKG_TARGET_IS_UWP)
|
|
|
|
vcpkg_copy_tools(TOOL_NAMES x264 AUTO_CLEAN)
|
|
|
|
endif()
|
2018-02-22 12:12:49 +08:00
|
|
|
|
2020-08-14 04:32:55 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
2018-02-22 12:12:49 +08:00
|
|
|
|
2020-09-25 03:37:17 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x264.pc")
|
|
|
|
if(EXISTS "${pcfile}")
|
|
|
|
vcpkg_replace_string("${pcfile}" "-lx264" "-llibx264")
|
|
|
|
endif()
|
|
|
|
set(pcfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x264.pc")
|
|
|
|
if(EXISTS "${pcfile}")
|
|
|
|
vcpkg_replace_string("${pcfile}" "-lx264" "-llibx264")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-12-02 06:13:58 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
2020-09-25 03:37:17 +08:00
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/lib/libx264.lib)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libx264.lib)
|
2020-09-28 08:58:17 +08:00
|
|
|
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2018-02-22 12:12:49 +08:00
|
|
|
# force U_STATIC_IMPLEMENTATION macro
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/include/x264.h HEADER_CONTENTS)
|
|
|
|
string(REPLACE "defined(U_STATIC_IMPLEMENTATION)" "1" HEADER_CONTENTS "${HEADER_CONTENTS}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/include/x264.h "${HEADER_CONTENTS}")
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE
|
|
|
|
${CURRENT_PACKAGES_DIR}/bin
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/bin
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-01-27 06:55:06 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-08-14 04:32:55 +08:00
|
|
|
|
2018-02-22 12:12:49 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2020-05-22 01:46:07 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|