Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try fixing x264 #13450

Merged
merged 3 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ports/x264/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif()

vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
COPY_SOURCE
NO_ADDITIONAL_PATHS
OPTIONS
${OPTIONS}
Expand All @@ -47,9 +48,20 @@ vcpkg_copy_tools(TOOL_NAMES x264 AUTO_CLEAN)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

if(VCPKG_TARGET_IS_WINDOWS)
set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x264.pc")
if(EXISTS "${pcfile}")
vcpkg_string_replace("${pcfile}" "-lx264" "-llibx264")
endif()
set(pcfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x264.pc")
if(EXISTS "${pcfile}")
vcpkg_string_replace("${pcfile}" "-lx264" "-llibx264")
endif()
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/lib/x264.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libx264.dll.lib ${CURRENT_PACKAGES_DIR}/debug/lib/x264.lib)
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)
else()
# force U_STATIC_IMPLEMENTATION macro
file(READ ${CURRENT_PACKAGES_DIR}/include/x264.h HEADER_CONTENTS)
Expand Down
11 changes: 7 additions & 4 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ function(vcpkg_configure_make)
list(APPEND MSYS_REQUIRE_PACKAGES binutils libtool autoconf automake-wrapper automake1.16 m4)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES ${MSYS_REQUIRE_PACKAGES})
# This inserts msys before system32 (which masks sort.exe and find.exe) but after MSVC (which avoids masking link.exe)
string(REPLACE ";$ENV{SystemRoot}\\System32;" ";${MSYS_ROOT}/usr/share/automake-1.16;${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\System32;" NEWPATH "$ENV{PATH}")
set(ENV{PATH} "${NEWPATH}")
set(BASH "${MSYS_ROOT}/usr/bin/bash.exe")

set(APPEND_ENV)
if (_csc_AUTOCONFIG)
# --build: the machine you are building on
# --host: the machine you are building for
Expand All @@ -243,8 +240,14 @@ function(vcpkg_configure_make)
endif()
endif()
debug_message("Using make triplet: ${_csc_BUILD_TRIPLET}")
set(APPEND_ENV ";${MSYS_ROOT}/usr/share/automake-1.16")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure if this should be before /usr/bin or after. The problem here is that /usr/share/automake-1.16 contains an install script which conflicts with install.exe in /usr/bin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite follow how this PR fixes things; it looks like automake will still come before /usr/bin and thus will still mask install?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X264 is not a autoconf port but some custom configure. As such the path with the script is not added to the path variable for the port.

endif()

string(REPLACE ";$ENV{SystemRoot}\\System32;" "${APPEND_ENV};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\System32;" NEWPATH "$ENV{PATH}")
string(REPLACE ";$ENV{SystemRoot}\\system32;" "${APPEND_ENV};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\system32;" NEWPATH "$ENV{PATH}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this duplicated twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not duplicated. Since windows is case insensitive the path can be both ways. I tried a regex with [Ss] and escaping of the \ but cmake never matched it for some reason

set(ENV{PATH} "${NEWPATH}")
set(BASH "${MSYS_ROOT}/usr/bin/bash.exe")

macro(_vcpkg_append_to_configure_environment inoutstring var defaultval)
# Allows to overwrite settings in custom triplets via the environment
if(DEFINED ENV{${var}})
Expand Down