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

[vcpkg_configure_make] Standardize OPTIONS list item handling #19540

Merged
merged 20 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
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
9 changes: 4 additions & 5 deletions ports/libtasn1/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ vcpkg_extract_source_archive_ex(
${PATCHES}
)

if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
set(EXTRA_OPTS "")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
# $LIBS is an environment variable that vcpkg already pre-populated with some libraries.
# We need to re-purpose it when passing LIBS option to make to avoid overriding the vcpkg's own list.
set(EXTRA_OPTS "LIBS=\"$LIBS -lgettimeofday -lgetopt\"")
list(APPEND EXTRA_OPTS "LIBS=-lgettimeofday -lgetopt \$LIBS")
else()
# restore the default ac_cv_prog_cc_g flags, otherwise it fails to compile
set(EXTRA_OPTS)
set(VCPKG_C_FLAGS "-g -O2")
set(VCPKG_CXX_FLAGS "-g -O2")
endif()

# The upstream doesn't add this macro to the configure
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")

set(EXTRA_OPTS "${EXTRA_OPTS} CFLAGS=\"$CFLAGS -DASN1_STATIC\"")
list(APPEND EXTRA_OPTS "CFLAGS=\$CFLAGS -DASN1_STATIC")
endif()

set(ENV{GTKDOCIZE} true)
Expand Down
6 changes: 3 additions & 3 deletions ports/libtasn1/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "libtasn1",
"version": "4.17.0",
"port-version": 1,
"port-version": 3,
"description": "A secure communications library implementing the SSL, TLS and DTLS protocols",
"homepage": "https://www.gnutls.org/",
"supports": "!uwp",
"dependencies": [
{
"name": "getopt",
"platform": "windows"
"platform": "windows & !mingw"
},
{
"name": "gettimeofday",
"platform": "windows"
"platform": "windows & !mingw"
}
]
}
16 changes: 9 additions & 7 deletions ports/starlink-ast/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ vcpkg_extract_source_archive_ex(
ARCHIVE ${ARCHIVE}
)

set(CONFIGURE_OPTIONS "--without-fortran star_cv_cnf_trail_type=long star_cv_cnf_f2c_compatible=no")
set(CONFIGURE_OPTIONS
--without-fortran
star_cv_cnf_trail_type=long
star_cv_cnf_f2c_compatible=no
)

if ("yaml" IN_LIST FEATURES)
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --with-yaml")
list(APPEND CONFIGURE_OPTIONS --with-yaml)
else()
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --without-yaml")
list(APPEND CONFIGURE_OPTIONS --without-yaml)
endif()

if ("pthreads" IN_LIST FEATURES)
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --with-pthreads")
list(APPEND CONFIGURE_OPTIONS --with-pthreads)
else()
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --without-pthreads")
list(APPEND CONFIGURE_OPTIONS --without-pthreads)
endif()

vcpkg_configure_make(
Expand All @@ -31,8 +35,6 @@ vcpkg_configure_make(
DETERMINE_BUILD_TRIPLET
ADDITIONAL_MSYS_PACKAGES perl
OPTIONS ${CONFIGURE_OPTIONS}
OPTIONS_RELEASE ${CONFIGURE_OPTIONS_RELEASE}
OPTIONS_DEBUG ${CONFIGURE_OPTIONS_DEBUG}
)

vcpkg_install_make()
Expand Down
2 changes: 1 addition & 1 deletion ports/starlink-ast/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "starlink-ast",
"version-semver": "9.2.4",
"port-version": 1,
"port-version": 2,
"description": "The AST library provides a comprehensive range of facilities for attaching world coordinate systems to astronomical data, for retrieving and interpreting that information and for generating graphical output based on it",
"homepage": "https://starlink.eao.hawaii.edu/starlink/AST",
"supports": "windows",
Expand Down
87 changes: 42 additions & 45 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ function(vcpkg_configure_make)
set(_vcm_paths_with_spaces TRUE)
endif()

set(CONFIGURE_ENV "V=1")
# Pre-processing windows configure requirements
if (VCPKG_TARGET_IS_WINDOWS)
if(CMAKE_HOST_WIN32)
Expand Down Expand Up @@ -351,7 +352,6 @@ function(vcpkg_configure_make)
endif()
endmacro()

set(CONFIGURE_ENV "V=1")
# Remove full filepaths due to spaces and prepend filepaths to PATH (cross-compiling tools are unlikely on path by default)
set(progs VCPKG_DETECTED_CMAKE_C_COMPILER VCPKG_DETECTED_CMAKE_CXX_COMPILER VCPKG_DETECTED_CMAKE_AR
VCPKG_DETECTED_CMAKE_LINKER VCPKG_DETECTED_CMAKE_RANLIB VCPKG_DETECTED_CMAKE_OBJDUMP
Expand Down Expand Up @@ -448,17 +448,16 @@ function(vcpkg_configure_make)
endif()
endif()

# Some PATH handling for dealing with spaces....some tools will still fail with that!
# In particular, the libtool install command is unable to install correctly to paths with spaces.
# CURRENT_INSTALLED_DIR: Pristine native path (unprotected spaces, Windows drive letters)
# _VCPKG_INSTALLED: Native path with escaped space characters
# _VCPKG_PREFIX: Path with unprotected spaces, but drive letters transformed for mingw/msys
string(REPLACE " " "\\ " _VCPKG_INSTALLED "${CURRENT_INSTALLED_DIR}")
if(CMAKE_HOST_WIN32)
#Some PATH handling for dealing with spaces....some tools will still fail with that!
string(REPLACE " " "\\\ " _VCPKG_PREFIX ${CURRENT_INSTALLED_DIR})
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PREFIX "${_VCPKG_PREFIX}")
set(_VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR})
set(prefix_var "'\${prefix}'") # Windows needs extra quotes or else the variable gets expanded in the makefile!
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PREFIX "${CURRENT_INSTALLED_DIR}")
else()
string(REPLACE " " "\ " _VCPKG_PREFIX ${CURRENT_INSTALLED_DIR})
string(REPLACE " " "\ " _VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR})
set(EXTRA_QUOTES)
set(prefix_var "\${prefix}")
set(_VCPKG_PREFIX "${CURRENT_INSTALLED_DIR}")
endif()

# macOS - cross-compiling support
Expand All @@ -484,25 +483,25 @@ function(vcpkg_configure_make)
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")

# Set configure paths
set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE} "--prefix=${EXTRA_QUOTES}${_VCPKG_PREFIX}${EXTRA_QUOTES}")
set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG} "--prefix=${EXTRA_QUOTES}${_VCPKG_PREFIX}/debug${EXTRA_QUOTES}")
set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE} "--prefix=${_VCPKG_PREFIX}")
set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG} "--prefix=${_VCPKG_PREFIX}/debug")
if(NOT _csc_NO_ADDITIONAL_PATHS)
set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE}
# Important: These should all be relative to prefix!
"--bindir=${prefix_var}/tools/${PORT}/bin"
"--sbindir=${prefix_var}/tools/${PORT}/sbin"
"--libdir=${prefix_var}/lib" # On some Linux distributions lib64 is the default
"--bindir=\\\${prefix}/tools/${PORT}/bin"
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
"--sbindir=\\\${prefix}/tools/${PORT}/sbin"
"--libdir=\\\${prefix}/lib" # On some Linux distributions lib64 is the default
#"--includedir='\${prefix}'/include" # already the default!
"--mandir=${prefix_var}/share/${PORT}"
"--docdir=${prefix_var}/share/${PORT}"
"--datarootdir=${prefix_var}/share/${PORT}")
"--mandir=\\\${prefix}/share/${PORT}"
"--docdir=\\\${prefix}/share/${PORT}"
"--datarootdir=\\\${prefix}/share/${PORT}")
set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG}
# Important: These should all be relative to prefix!
"--bindir=${prefix_var}/../tools/${PORT}/debug/bin"
"--sbindir=${prefix_var}/../tools/${PORT}/debug/sbin"
"--libdir=${prefix_var}/lib" # On some Linux distributions lib64 is the default
"--includedir=${prefix_var}/../include"
"--datarootdir=${prefix_var}/share/${PORT}")
"--bindir=\\\${prefix}/../tools/${PORT}/debug/bin"
"--sbindir=\\\${prefix}/../tools/${PORT}/debug/sbin"
"--libdir=\\\${prefix}/lib" # On some Linux distributions lib64 is the default
"--includedir=\\\${prefix}/../include"
"--datarootdir=\\\${prefix}/share/${PORT}")
endif()
# Setup common options
if(NOT DISABLE_VERBOSE_FLAGS)
Expand Down Expand Up @@ -534,18 +533,13 @@ function(vcpkg_configure_make)
else()
find_program(base_cmd bash REQUIRED)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
list(JOIN _csc_OPTIONS " " _csc_OPTIONS)
list(JOIN _csc_OPTIONS_RELEASE " " _csc_OPTIONS_RELEASE)
list(JOIN _csc_OPTIONS_DEBUG " " _csc_OPTIONS_DEBUG)
endif()

# Setup include environment (since these are buildtype independent restoring them is unnecessary)
macro(prepend_include_path var)
if("${${var}_BACKUP}" STREQUAL "")
set(ENV{${var}} "${_VCPKG_INSTALLED}/include")
set(ENV{${var}} "${CURRENT_INSTALLED_DIR}/include")
else()
set(ENV{${var}} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${${var}_BACKUP}")
set(ENV{${var}} "${CURRENT_INSTALLED_DIR}/include${VCPKG_HOST_PATH_SEPARATOR}${${var}_BACKUP}")
endif()
endmacro()
# Used by CL
Expand Down Expand Up @@ -693,10 +687,10 @@ function(vcpkg_configure_make)
endif()
else()
set(_link_dirs)
if(EXISTS "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
if(EXISTS "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
set(_link_dirs "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
endif()
if(EXISTS "{_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
if(EXISTS "{CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
set(_link_dirs "${_link_dirs} -L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
endif()
string(STRIP "${_link_dirs}" _link_dirs)
Expand Down Expand Up @@ -726,10 +720,10 @@ function(vcpkg_configure_make)
endif()
else()
set(_link_dirs)
if(EXISTS "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
if(EXISTS "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
set(_link_dirs "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib")
endif()
if(EXISTS "{_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
if(EXISTS "{CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
set(_link_dirs "${_link_dirs} -L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link")
endif()
string(STRIP "${_link_dirs}" _link_dirs)
Expand All @@ -738,6 +732,15 @@ function(vcpkg_configure_make)
unset(_VAR_SUFFIX)
endif()

foreach(var IN ITEMS _csc_OPTIONS _csc_OPTIONS_RELEASE _csc_OPTIONS_DEBUG)
vcpkg_list(SET tmp)
foreach(element IN LISTS "${var}")
string(REPLACE [["]] [[\"]] element "${element}")
vcpkg_list(APPEND tmp "\"${element}\"")
endforeach()
vcpkg_list(JOIN tmp " " "${var}")
endforeach()
Comment on lines +736 to +743
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoese codes are not used, can you please double confirm that?

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 code is used. Verified by CI. Verified once more manually by instrumenting the code and building libtasn1.


foreach(_buildtype IN LISTS _buildtypes)
foreach(ENV_VAR ${_csc_CONFIG_DEPENDENT_ENVIRONMENT})
if(DEFINED ENV{${ENV_VAR}})
Expand Down Expand Up @@ -788,27 +791,21 @@ function(vcpkg_configure_make)
set(_lib_env_vars LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)
foreach(_lib_env_var IN LISTS _lib_env_vars)
set(_link_path)
if(EXISTS "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib")
set(_link_path "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib")
if(EXISTS "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_buildtype}}/lib")
set(_link_path "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_buildtype}}/lib")
endif()
if(EXISTS "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/manual-link")
if(EXISTS "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_buildtype}}/lib/manual-link")
if(_link_path)
set(_link_path "${_link_path}${VCPKG_HOST_PATH_SEPARATOR}")
endif()
set(_link_path "${_link_path}${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/manual-link")
set(_link_path "${_link_path}${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_buildtype}}/lib/manual-link")
endif()
set(ENV{${_lib_env_var}} "${_link_path}${${_lib_env_var}_PATHLIKE_CONCAT}")
endforeach()
unset(_link_path)
unset(_lib_env_vars)

if(CMAKE_HOST_WIN32)
set(command "${base_cmd}" -c "${CONFIGURE_ENV} ./${RELATIVE_BUILD_PATH}/configure ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}}")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(command "${base_cmd}" -c "${CONFIGURE_ENV} $@" -- "./${RELATIVE_BUILD_PATH}/configure" ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}})
else()
set(command "${base_cmd}" "./${RELATIVE_BUILD_PATH}/configure" ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}})
endif()
set(command "${base_cmd}" -c "${CONFIGURE_ENV} ./${RELATIVE_BUILD_PATH}/configure ${_csc_BUILD_TRIPLET} ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}}")

if(_csc_ADD_BIN_TO_PATH)
set(PATH_BACKUP $ENV{PATH})
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3798,7 +3798,7 @@
},
"libtasn1": {
"baseline": "4.17.0",
"port-version": 1
"port-version": 3
},
"libtcod": {
"baseline": "1.18.0",
Expand Down Expand Up @@ -6294,7 +6294,7 @@
},
"starlink-ast": {
"baseline": "9.2.4",
"port-version": 1
"port-version": 2
},
"status-code": {
"baseline": "1.0.0-ab3cd821",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libtasn1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c387ff2824b319ecd287ea3e5a507a8263dce95e",
"version": "4.17.0",
"port-version": 3
},
{
"git-tree": "3554f6c03cdac32ddf68540d62c04f6f4644ec94",
"version": "4.17.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/starlink-ast.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "487c5e318ce957c09647d0d74a2b5b4a4e99ffef",
"version-semver": "9.2.4",
"port-version": 2
},
{
"git-tree": "2fecd468269d73b6e8f29a297c4f7db771ea37c4",
"version-semver": "9.2.4",
Expand Down