From 96b4b1eea25d4959fcffbdda458efbad1aa8e071 Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 16:01:35 +0200 Subject: [PATCH 01/20] WIP commit --- ports/jemalloc/fix-cmakelists.patch | 67 ------------------------ ports/jemalloc/fix-configure-ac.patch | 13 +++++ ports/jemalloc/fix-static-build.patch | 25 --------- ports/jemalloc/fix-utilities.patch | 30 ----------- ports/jemalloc/portfile.cmake | 36 ++++++------- ports/jemalloc/vcpkg.json | 5 +- scripts/cmake/vcpkg_configure_make.cmake | 63 ++++++++++------------ 7 files changed, 58 insertions(+), 181 deletions(-) delete mode 100644 ports/jemalloc/fix-cmakelists.patch create mode 100644 ports/jemalloc/fix-configure-ac.patch delete mode 100644 ports/jemalloc/fix-static-build.patch delete mode 100644 ports/jemalloc/fix-utilities.patch diff --git a/ports/jemalloc/fix-cmakelists.patch b/ports/jemalloc/fix-cmakelists.patch deleted file mode 100644 index 3ba70544c602be..00000000000000 --- a/ports/jemalloc/fix-cmakelists.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 06e83ef..229e17a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -57,6 +57,7 @@ option(enable-lazy-lock "Enable lazy locking (only lock when multi-threaded" OFF - option(force_lazy_lock "Forcing lazy-lock to avoid allocator/threading bootstrap issues" OFF) - # install_prefix - installation directory prefix - # with-xslroot= XSL stylesheet root path -+option(build-tests "Build tests" OFF) - - set (PACKAGE_NAME "jemalloc") - project (${PACKAGE_NAME} C) -@@ -711,12 +712,8 @@ endif() - - # The original library, delivery product - set(LIBJEMALLOCLIB jemalloc${install_suffix}) --add_library(${LIBJEMALLOCLIB} STATIC ${C_SRCS}) -- --# Now add shared library. Needed for integration tests --# and a benchmark --set(LIBJEMALLOCSO jemallocso${install_suffix}) --add_library(${LIBJEMALLOCSO} SHARED ${C_SRCS}) -+set(LIBJEMALLOCSO ${LIBJEMALLOCLIB}) -+add_library(${LIBJEMALLOCLIB} ${C_SRCS}) - - if(WIN32) - # May want to replace /d2Zi+ to /Zo -@@ -745,8 +745,6 @@ if(WIN32) - # either impport or export which is both wrong for a static library - set_target_properties(${LIBJEMALLOCLIB} - PROPERTIES -- COMPILE_DEFINITIONS -- "JEMALLOC_EXPORT=" - CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG - ${PROJECT_BINARY_DIR}/Debug - CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE -@@ -754,6 +752,9 @@ if(WIN32) - COMPILE_PDB_NAME - ${LIBJEMALLOCLIB} - ) -+ if(NOT BUILD_SHARED_LIBS) -+ target_compile_definitions(${LIBJEMALLOCLIB} "JEMALLOC_EXPORT=") -+ endif() - - endif() - -@@ -825,6 +822,14 @@ if(C_UTIL_INTEGRATION_DEFS) - "${C_UTIL_INTEGRATION_DEFS}") - endif() - -+install(FILES include/jemalloc/jemalloc${install_suffix}.h -+ DESTINATION include/jemalloc) -+ -+install(TARGETS ${LIBJEMALLOCSO} -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) -+if (build-tests) - ################################################################## - # Common source for Unit, Integration and stress test libraries - set(C_TESTLIB_SRCS -@@ -1028,4 +1033,4 @@ foreach(sourcefile ${TESTS_INTEGRATION}) - add_test(NAME ${exename} COMMAND ${exename}) - add_dependencies(check ${exename}) - endforeach(sourcefile ${TESTS_UNIT}) -- -+endif() diff --git a/ports/jemalloc/fix-configure-ac.patch b/ports/jemalloc/fix-configure-ac.patch new file mode 100644 index 00000000000000..7799dfb9e80e39 --- /dev/null +++ b/ports/jemalloc/fix-configure-ac.patch @@ -0,0 +1,13 @@ +diff --git a/configure.ac b/configure.ac +index f6d25f334..3115504e2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1592,7 +1592,7 @@ fi + [enable_uaf_detection="0"] + ) + if test "x$enable_uaf_detection" = "x1" ; then +- AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ]) ++ AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ], ["enable UAF"]) + fi + AC_SUBST([enable_uaf_detection]) + diff --git a/ports/jemalloc/fix-static-build.patch b/ports/jemalloc/fix-static-build.patch deleted file mode 100644 index 3ede809a8a600d..00000000000000 --- a/ports/jemalloc/fix-static-build.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0b8959a..55e6a5f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -826,10 +826,16 @@ endif() - install(FILES include/jemalloc/jemalloc${install_suffix}.h - DESTINATION include/jemalloc) - --install(TARGETS ${LIBJEMALLOCSO} -- RUNTIME DESTINATION bin -- LIBRARY DESTINATION lib -- ARCHIVE DESTINATION lib) -+if (without-export) -+ install(TARGETS ${C_JETLIB} -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) -+else() -+ install(TARGETS ${LIBJEMALLOCSO} -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) -+endif() - if (build-tests) - ################################################################## - # Common source for Unit, Integration and stress test libraries diff --git a/ports/jemalloc/fix-utilities.patch b/ports/jemalloc/fix-utilities.patch deleted file mode 100644 index 32c39e0b3e822d..00000000000000 --- a/ports/jemalloc/fix-utilities.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/Utilities.cmake b/Utilities.cmake -index 562e948..d2d3530 100644 ---- a/Utilities.cmake -+++ b/Utilities.cmake -@@ -633,9 +633,11 @@ file(TO_NATIVE_PATH "${file_path}" ntv_file_path) - # This converts #undefs into #cmakedefines so configure_file can handle it - set(PS_CMD - "Get-Content \"${ntv_file_path}\" | --ForEach { -+ForEach { - if($_ -match '^#undef[ \t]*[^ \t]*') -- { $_ -replace '^#undef[ \t]*([^ \t]*)','#cmakedefine $1 @$1@' } else {$_}}" -+ { $_ -replace '^#undef[ \t]*([^ \t]*)','#cmakedefine $1 @$1@' } else {$_} -+} | -+Set-Content \"${ntv_file_path}.cmake\"" - ) - - if(EXISTS ${file_path}) -@@ -646,9 +648,8 @@ if(EXISTS ${file_path}) - # Convert autoconf .in into a cmake .in - execute_process(COMMAND powershell -Command "${PS_CMD}" - RESULT_VARIABLE error_level -- ERROR_VARIABLE error_output -- OUTPUT_FILE ${file_path}.cmake) -- -+ ERROR_VARIABLE error_output) -+ - if(NOT ${error_level} EQUAL 0) - message(FATAL_ERROR "Powershell completed with ${error_level} : ${error_output}") - endif() diff --git a/ports/jemalloc/portfile.cmake b/ports/jemalloc/portfile.cmake index 013634577b0cb4..00a6e89b07e405 100644 --- a/ports/jemalloc/portfile.cmake +++ b/ports/jemalloc/portfile.cmake @@ -2,34 +2,30 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO jemalloc/jemalloc-cmake - REF jemalloc-cmake.4.3.1 - SHA512 e94b62ec3a53acc0ab5acb247d7646bc172108e80f592bb41c2dd50d181cbbeb33d623adf28415ffc0a0e2de3818af2dfe4c04af75ac891ef5042bc5bb186886 + REPO jemalloc/jemalloc + REF 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c + SHA512 527bfbf5db9a5c2b7b04df4785b6ae9d445cff8cb17298bf3e550c88890d2bd7953642d8efaa417580610508279b527d3a3b9e227d17394fd2013c88cb7ae75a HEAD_REF master PATCHES - fix-cmakelists.patch - fix-utilities.patch - fix-static-build.patch + fix-configure-ac.patch ) - -if (VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(BUILD_STATIC_LIBRARY OFF) -else() - set(BUILD_STATIC_LIBRARY ON) +if(VCPKG_TARGET_IS_WINDOWS) + set(opts "ac_cv_search_log=none required") endif() -vcpkg_configure_cmake( - DISABLE_PARALLEL_CONFIGURE - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS -DGIT_FOUND=OFF -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON -Dwithout-export=${BUILD_STATIC_LIBRARY} + +vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}" + AUTOCONFIG + NO_WRAPPERS + OPTIONS ${opts} ) -vcpkg_install_cmake() +vcpkg_install_make() vcpkg_copy_pdbs() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") # Handle copyright -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/jemalloc) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/jemalloc/COPYING ${CURRENT_PACKAGES_DIR}/share/jemalloc/copyright) +file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/jemalloc") +file(RENAME "${CURRENT_PACKAGES_DIR}/share/jemalloc/COPYING" "${CURRENT_PACKAGES_DIR}/share/jemalloc/copyright") diff --git a/ports/jemalloc/vcpkg.json b/ports/jemalloc/vcpkg.json index c23bdcaa803915..7891fc25552ea3 100644 --- a/ports/jemalloc/vcpkg.json +++ b/ports/jemalloc/vcpkg.json @@ -1,7 +1,6 @@ { "name": "jemalloc", - "version-string": "4.3.1", - "port-version": 5, + "version": "5.3.0", "description": "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support", - "homepage": "https://github.com/jemalloc/jemalloc-cmake" + "homepage": "http://jemalloc.net/" } diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 3ead0e58edc4ab..ec5e6a93fa6a62 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -124,7 +124,7 @@ endmacro() function(vcpkg_configure_make) # parse parameters such that semicolons in options arguments to COMMAND don't get erased cmake_parse_arguments(PARSE_ARGV 0 arg - "AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE;DISABLE_VERBOSE_FLAGS;NO_ADDITIONAL_PATHS;ADD_BIN_TO_PATH;NO_DEBUG;USE_WRAPPERS;DETERMINE_BUILD_TRIPLET" + "AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE;DISABLE_VERBOSE_FLAGS;NO_ADDITIONAL_PATHS;ADD_BIN_TO_PATH;NO_DEBUG;USE_WRAPPERS;NO_WRAPPERS;DETERMINE_BUILD_TRIPLET" "SOURCE_PATH;PROJECT_SUBPATH;PRERUN_SHELL;BUILD_TRIPLET" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;CONFIGURE_ENVIRONMENT_VARIABLES;CONFIG_DEPENDENT_ENVIRONMENT;ADDITIONAL_MSYS_PACKAGES" ) @@ -175,6 +175,9 @@ function(vcpkg_configure_make) else() set(arg_USE_WRAPPERS OFF) endif() + if(arg_NO_WRAPPERS) + set(arg_USE_WRAPPERS OFF) + endif() # Backup environment variables # CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJCXX R UPC Y @@ -565,20 +568,17 @@ function(vcpkg_configure_make) endif() endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT arg_NO_DEBUG) - set(var_suffix DEBUG) - set(path_suffix_${var_suffix} "/debug") - set(short_name_${var_suffix} "dbg") - list(APPEND all_buildtypes ${var_suffix}) + macro(z_vcpkg_setup_make_linker_flags_vars var_suffix) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}") else() # dynamic set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}") endif() - z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags(${var_suffix}) - if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe") + set(ARFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}") + set(LDFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}") + if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "cl.exe^") if(NOT vcm_paths_with_spaces) - set(LDFLAGS_${var_suffix} "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") + string(APPEND LDFLAGS_${var_suffix} " -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") endif() if(DEFINED ENV{_LINK_}) set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${LINKER_FLAGS_${var_suffix}}") @@ -586,7 +586,7 @@ function(vcpkg_configure_make) set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}") endif() else() - set(link_required_dirs) + set(link_required_dirs "") if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib") set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib") endif() @@ -594,8 +594,22 @@ function(vcpkg_configure_make) set(link_required_dirs "${link_required_dirs} -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") endif() string(STRIP "${link_required_dirs}" link_required_dirs) - set(LDFLAGS_${var_suffix} "${link_required_dirs} ${LINKER_FLAGS_${var_suffix}}") + if(link_required_dirs) + string(PREPEND LDFLAGS_${var_suffix} "${link_required_dirs} ") + string(PREPEND ARFLAGS_${var_suffix} "${link_required_dirs} ") + string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) + string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix}) + endif() endif() + endmacro() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT arg_NO_DEBUG) + set(var_suffix DEBUG) + set(path_suffix_${var_suffix} "/debug") + set(short_name_${var_suffix} "dbg") + list(APPEND all_buildtypes ${var_suffix}) + z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags(${var_suffix}) + z_vcpkg_setup_make_linker_flags_vars(${var_suffix}) unset(var_suffix) endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") @@ -603,32 +617,8 @@ function(vcpkg_configure_make) set(path_suffix_${var_suffix} "") set(short_name_${var_suffix} "rel") list(APPEND all_buildtypes ${var_suffix}) - if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}") - else() # dynamic - set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}") - endif() z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags(${var_suffix}) - if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe") - if(NOT vcm_paths_with_spaces) - set(LDFLAGS_${var_suffix} "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") - endif() - if(DEFINED ENV{_LINK_}) - set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${LINKER_FLAGS_${var_suffix}}") - else() - set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}") - endif() - else() - set(link_required_dirs "") - if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib") - set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib") - endif() - if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib/manual-link") - set(link_required_dirs "${link_required_dirs} -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") - endif() - string(STRIP "${link_required_dirs}" link_required_dirs) - set(LDFLAGS_${var_suffix} "${link_required_dirs} ${LINKER_FLAGS_${var_suffix}}") - endif() + z_vcpkg_setup_make_linker_flags_vars(${var_suffix}) unset(var_suffix) endif() @@ -671,6 +661,7 @@ function(vcpkg_configure_make) set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}") set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${current_buildtype}}") set(ENV{LDFLAGS} "${LDFLAGS_${current_buildtype}}") + set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}") # https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html # -avoid-version is handled specially by libtool link mode, this flag is not forwarded to linker, From 1cfa290236d95444b3cfe9cc3cfcfa59eeb5102a Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 21:44:03 +0200 Subject: [PATCH 02/20] more jemalloc wip --- ports/jemalloc/portfile.cmake | 32 +++++++++++++++++++++--- ports/jemalloc/preprocessor.patch | 12 +++++++++ scripts/cmake/vcpkg_configure_make.cmake | 28 +++++++++++++++++++-- 3 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 ports/jemalloc/preprocessor.patch diff --git a/ports/jemalloc/portfile.cmake b/ports/jemalloc/portfile.cmake index 00a6e89b07e405..970f652158b57b 100644 --- a/ports/jemalloc/portfile.cmake +++ b/ports/jemalloc/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO jemalloc/jemalloc @@ -8,9 +6,10 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-configure-ac.patch + preprocessor.patch ) if(VCPKG_TARGET_IS_WINDOWS) - set(opts "ac_cv_search_log=none required") + set(opts "ac_cv_search_log=none required" "--without-private-namespace") endif() vcpkg_configure_make( @@ -22,9 +21,36 @@ vcpkg_configure_make( vcpkg_install_make() +if(VCPKG_TARGET_IS_WINDOWS) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin") + file(RENAME "${CURRENT_PACKAGES_DIR}/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/bin/jemalloc.dll") + endif() + if(NOT VCPKG_BUILD_TYPE) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/jemalloc.dll") + endif() + endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s") + endif() + endif() +endif() + + + +vcpkg_fixup_pkgconfig() + vcpkg_copy_pdbs() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools") # Handle copyright file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/jemalloc") diff --git a/ports/jemalloc/preprocessor.patch b/ports/jemalloc/preprocessor.patch new file mode 100644 index 00000000000000..6e6e2d1403fb2e --- /dev/null +++ b/ports/jemalloc/preprocessor.patch @@ -0,0 +1,12 @@ +diff --git a/configure.ac b/configure.ac +index 3115504e2..ffb504b08 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -749,6 +749,7 @@ case "${host}" in + so="dll" + if test "x$je_cv_msvc" = "xyes" ; then + importlib="lib" ++ JE_APPEND_VS(CPPFLAGS, -DJEMALLOC_NO_PRIVATE_NAMESPACE) + DSO_LDFLAGS="-LD" + EXTRA_LDFLAGS="-link -DEBUG" + CTARGET='-Fo$@' diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index ec5e6a93fa6a62..a6433c4d99bc4f 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -145,7 +145,7 @@ function(vcpkg_configure_make) set(requires_autogen OFF) # use autogen.sh set(requires_autoconfig OFF) # use autotools and configure.ac - if(EXISTS "${src_dir}/configure" AND "${src_dir}/configure.ac") # remove configure; rerun autoconf + if(EXISTS "${src_dir}/configure" AND EXISTS "${src_dir}/configure.ac") # remove configure; rerun autoconf if(NOT VCPKG_MAINTAINER_SKIP_AUTOCONFIG) # If fixing bugs skipping autoconfig saves a lot of time set(requires_autoconfig ON) file(REMOVE "${SRC_DIR}/configure") # remove possible autodated configure scripts @@ -181,7 +181,7 @@ function(vcpkg_configure_make) # Backup environment variables # CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJCXX R UPC Y - set(cm_FLAGS AS CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJXX R UPC Y RC) + set(cm_FLAGS AR AS CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJXX R UPC Y RC) list(TRANSFORM cm_FLAGS APPEND "FLAGS") vcpkg_backup_env_variables(VARS ${cm_FLAGS}) @@ -338,6 +338,30 @@ function(vcpkg_configure_make) # Currently needed for arm because objdump yields: "unrecognised machine type (0x1c4) in Import Library Format archive" list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all) endif() + else() + macro(make_set_env envvar cmakevar) + if(VCPKG_DETECTED_CMAKE_${cmakevar}) + set(ENV{${envvar}} "${VCPKG_DETECTED_CMAKE_${cmakevar}}") + else() + if(NOT DEFINED ENV{${envvar}}) + set(ENV{${envvar}} "false") #/usr/bin/false is a binary returning 0 for any input + endif() + endif() + endmacro() + make_set_env(CC C_COMPILER) + make_set_env(CC_FOR_BUILD C_COMPILER) + make_set_env(CXX CXX_COMPILER) + make_set_env(NM NM) + make_set_env(RC RC) + make_set_env(WINDRES RC) + make_set_env(CCAS C_COMPILER) + make_set_env(AS C_COMPILER) + make_set_env(DLLTOOL DLLTOOL) + make_set_env(STRIP STRIP) + make_set_env(OBJDUMP OBJDUMP) + make_set_env(RANLIB RANLIB) + make_set_env(AR AR) + make_set_env(LD LINKER) endif() # Some PATH handling for dealing with spaces....some tools will still fail with that! From c2041e8b326e43e6fb8685edc7dfa3baed69de64 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 21:45:46 +0200 Subject: [PATCH 03/20] v db --- versions/baseline.json | 4 ++-- versions/j-/jemalloc.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index bc6ae7766840e1..e77427a5bdfe0e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3053,8 +3053,8 @@ "port-version": 5 }, "jemalloc": { - "baseline": "4.3.1", - "port-version": 5 + "baseline": "5.3.0", + "port-version": 0 }, "jinja2cpplight": { "baseline": "2018-05-08", diff --git a/versions/j-/jemalloc.json b/versions/j-/jemalloc.json index a27e65c4c646a3..fb0ca7727274f3 100644 --- a/versions/j-/jemalloc.json +++ b/versions/j-/jemalloc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "57d923459febb712c14ae661659c0569bf785dc1", + "version": "5.3.0", + "port-version": 0 + }, { "git-tree": "0ced62e7a268f8442b2e808df7b094afe8998c38", "version-string": "4.3.1", From 1e22c6d125da062f4dcbd6f1fd48e4efc867137e Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 22:04:40 +0200 Subject: [PATCH 04/20] add license --- ports/jemalloc/vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/jemalloc/vcpkg.json b/ports/jemalloc/vcpkg.json index 7891fc25552ea3..bd1177e11d1bcd 100644 --- a/ports/jemalloc/vcpkg.json +++ b/ports/jemalloc/vcpkg.json @@ -2,5 +2,6 @@ "name": "jemalloc", "version": "5.3.0", "description": "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support", - "homepage": "http://jemalloc.net/" + "homepage": "http://jemalloc.net/", + "license": "BSD-2-Clause" } From 62d16036ccb85d141a1e6b2bc0b0129ddcedc937 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 22:05:42 +0200 Subject: [PATCH 05/20] v db --- versions/j-/jemalloc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/j-/jemalloc.json b/versions/j-/jemalloc.json index fb0ca7727274f3..f2e599d205b5a9 100644 --- a/versions/j-/jemalloc.json +++ b/versions/j-/jemalloc.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "57d923459febb712c14ae661659c0569bf785dc1", + "git-tree": "35d8d5ef27d1720a07270cc6a943ded66502db89", "version": "5.3.0", "port-version": 0 }, From cef9e33c6e6e369b4730e67f898bde7ec78bd0d4 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 22:09:19 +0200 Subject: [PATCH 06/20] apply format diff --- docs/maintainers/vcpkg_configure_make.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/maintainers/vcpkg_configure_make.md b/docs/maintainers/vcpkg_configure_make.md index af0213bd5a141b..da9346e23b45a7 100644 --- a/docs/maintainers/vcpkg_configure_make.md +++ b/docs/maintainers/vcpkg_configure_make.md @@ -9,7 +9,7 @@ Configure configure for Debug and Release builds of a project. vcpkg_configure_make( SOURCE_PATH <${SOURCE_PATH}> [AUTOCONFIG] - [USE_WRAPPERS] + [USE_WRAPPERS] [NO_WRAPPERS] [DETERMINE_BUILD_TRIPLET] [BUILD_TRIPLET "--host=x64 --build=i686-unknown-pc"] [NO_ADDITIONAL_PATHS] @@ -42,6 +42,9 @@ Skip configure process ### USE_WRAPPERS Use autotools ar-lib and compile wrappers (only applies to windows cl and lib) +### NO_WRAPPERS +Deactivate the use of autotools ar-lib and compile wrappers (only applies to windows cl and lib) + ### BUILD_TRIPLET Used to pass custom --build/--target/--host to configure. Can be globally overwritten by VCPKG_MAKE_BUILD_TRIPLET From c8e206f7783ed99c437ab27df15be597b1290845 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 30 May 2022 22:47:24 +0200 Subject: [PATCH 07/20] fix script --- scripts/cmake/vcpkg_configure_make.cmake | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index a6433c4d99bc4f..e09959f3fc1a11 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -145,12 +145,9 @@ function(vcpkg_configure_make) set(requires_autogen OFF) # use autogen.sh set(requires_autoconfig OFF) # use autotools and configure.ac - if(EXISTS "${src_dir}/configure" AND EXISTS "${src_dir}/configure.ac") # remove configure; rerun autoconf - if(NOT VCPKG_MAINTAINER_SKIP_AUTOCONFIG) # If fixing bugs skipping autoconfig saves a lot of time - set(requires_autoconfig ON) - file(REMOVE "${SRC_DIR}/configure") # remove possible autodated configure scripts - set(arg_AUTOCONFIG ON) - endif() + if(EXISTS "${src_dir}/configure" AND EXISTS "${src_dir}/configure.ac" AND arg_AUTOCONFIG) # remove configure; rerun autoconf + set(requires_autoconfig ON) + file(REMOVE "${SRC_DIR}/configure") # remove possible autodated configure scripts elseif(EXISTS "${src_dir}/configure" AND NOT arg_SKIP_CONFIGURE) # run normally; no autoconf or autogen required elseif(EXISTS "${src_dir}/configure.ac") # Run autoconfig set(requires_autoconfig ON) @@ -536,7 +533,7 @@ function(vcpkg_configure_make) debug_message("ENV{LIBS}:$ENV{LIBS}") # Run autoconf if necessary - if (arg_AUTOCONFIG OR requires_autoconfig) + if (arg_AUTOCONFIG OR requires_autoconfig AND NOT arg_NO_AUTOCONFIG) find_program(AUTORECONF autoreconf) if(NOT AUTORECONF) message(FATAL_ERROR "${PORT} requires autoconf from the system package manager (example: \"sudo apt-get install autoconf\")") From 14704c208e277823da227820768012ffbe725349 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 00:39:18 +0200 Subject: [PATCH 08/20] WIP commit --- scripts/cmake/vcpkg_configure_make.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index e09959f3fc1a11..1ce431059aa89d 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -618,9 +618,12 @@ function(vcpkg_configure_make) if(link_required_dirs) string(PREPEND LDFLAGS_${var_suffix} "${link_required_dirs} ") string(PREPEND ARFLAGS_${var_suffix} "${link_required_dirs} ") - string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) - string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix}) endif() + if(ARFLAGS_${var_suffix}) + string(PREPEND ARFLAGS_${var_suffix} "cr ") + endif() + string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) + string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix}) endif() endmacro() @@ -682,8 +685,9 @@ function(vcpkg_configure_make) set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}") set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${current_buildtype}}") set(ENV{LDFLAGS} "${LDFLAGS_${current_buildtype}}") - set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}") - + if(ARFLAGS_${current_buildtype}) + set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}") + endif() # https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html # -avoid-version is handled specially by libtool link mode, this flag is not forwarded to linker, # and libtool tries to avoid versioning for shared libraries and no symbolic links are created. From 339140ce50aed3e16ccc5775aa960fc9357b0bab Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 12:47:40 +0200 Subject: [PATCH 09/20] fix ARFLAGS for the wrapper --- scripts/cmake/vcpkg_configure_make.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 1ce431059aa89d..23abee4e0e8ef2 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -597,7 +597,7 @@ function(vcpkg_configure_make) endif() set(ARFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}") set(LDFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}") - if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "cl.exe^") + if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "cl.exe$") if(NOT vcm_paths_with_spaces) string(APPEND LDFLAGS_${var_suffix} " -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") endif() @@ -617,9 +617,12 @@ function(vcpkg_configure_make) string(STRIP "${link_required_dirs}" link_required_dirs) if(link_required_dirs) string(PREPEND LDFLAGS_${var_suffix} "${link_required_dirs} ") - string(PREPEND ARFLAGS_${var_suffix} "${link_required_dirs} ") + # ARFLAGS doesn't need -L search paths since it just bundles object files endif() if(ARFLAGS_${var_suffix}) + # ARFLAGS need to know the command for creating an archive (Maybe needs user customization?) + # or extract it from CMake via CMAKE_${lang}_ARCHIVE_CREATE ? + # or from CMAKE_${lang}_${rule} with rule being one of CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE string(PREPEND ARFLAGS_${var_suffix} "cr ") endif() string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) @@ -685,7 +688,8 @@ function(vcpkg_configure_make) set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}") set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${current_buildtype}}") set(ENV{LDFLAGS} "${LDFLAGS_${current_buildtype}}") - if(ARFLAGS_${current_buildtype}) + if(ARFLAGS_${current_buildtype} AND NOT (arg_USE_WRAPPERS AND VCPKG_TARGET_IS_WINDOWS)) + # Target windows with wrappers enabled cannot forward ARFLAGS since it breaks the wrapper set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}") endif() # https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html From 8855209be811af44024eb98c1abe6ce749ebac14 Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 12:50:01 +0200 Subject: [PATCH 10/20] CR stuff --- ports/jemalloc/portfile.cmake | 5 +---- ports/jemalloc/vcpkg.json | 2 +- scripts/cmake/vcpkg_configure_make.cmake | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ports/jemalloc/portfile.cmake b/ports/jemalloc/portfile.cmake index 970f652158b57b..81c01ab9e4c7e0 100644 --- a/ports/jemalloc/portfile.cmake +++ b/ports/jemalloc/portfile.cmake @@ -42,8 +42,6 @@ if(VCPKG_TARGET_IS_WINDOWS) endif() endif() - - vcpkg_fixup_pkgconfig() vcpkg_copy_pdbs() @@ -53,5 +51,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools") # Handle copyright -file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/jemalloc") -file(RENAME "${CURRENT_PACKAGES_DIR}/share/jemalloc/COPYING" "${CURRENT_PACKAGES_DIR}/share/jemalloc/copyright") +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/jemalloc/vcpkg.json b/ports/jemalloc/vcpkg.json index bd1177e11d1bcd..dccb6d1734e6e4 100644 --- a/ports/jemalloc/vcpkg.json +++ b/ports/jemalloc/vcpkg.json @@ -2,6 +2,6 @@ "name": "jemalloc", "version": "5.3.0", "description": "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support", - "homepage": "http://jemalloc.net/", + "homepage": "https://jemalloc.net/", "license": "BSD-2-Clause" } diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 23abee4e0e8ef2..93490b51f6f6b2 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -597,7 +597,7 @@ function(vcpkg_configure_make) endif() set(ARFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}") set(LDFLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}") - if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "cl.exe$") + if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES [[cl\.exe$]]) if(NOT vcm_paths_with_spaces) string(APPEND LDFLAGS_${var_suffix} " -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link") endif() From df9de849cf9fc0a5495fb695be9d3ce6fe88aeb9 Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 12:50:18 +0200 Subject: [PATCH 11/20] v db --- versions/j-/jemalloc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/j-/jemalloc.json b/versions/j-/jemalloc.json index f2e599d205b5a9..028888496829fa 100644 --- a/versions/j-/jemalloc.json +++ b/versions/j-/jemalloc.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "35d8d5ef27d1720a07270cc6a943ded66502db89", + "git-tree": "6baf5d3d5e323c49a4f91a2e67f778421af4a4c5", "version": "5.3.0", "port-version": 0 }, From 9185f80b06a13e0e19dd51558e8b10784102a17f Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 15:12:44 +0200 Subject: [PATCH 12/20] use separate_arguments to add -Wl, to linker flags --- scripts/cmake/vcpkg_configure_make.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 93490b51f6f6b2..ac25a2c6259bef 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -627,6 +627,10 @@ function(vcpkg_configure_make) endif() string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix}) + if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_DETECTED_CMAKE_LINKER MATCHES [[link\.exe$]]) + separate_arguments(LDFLAGS_LIST NATIVE_COMMAND "-Wl,${LDFLAGS_${var_suffix}}") + list(JOIN LDFLAGS_LIST " -Wl," LDFLAGS_${var_suffix}) + endif() endif() endmacro() From 018f82fbe355b854aa8dac3373b06cfc2c27d05b Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 31 May 2022 22:37:54 +0200 Subject: [PATCH 13/20] say "-Xlinker" three times and it will come. --- scripts/cmake/vcpkg_configure_make.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index ac25a2c6259bef..c4d7452aadd4e0 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -628,8 +628,16 @@ function(vcpkg_configure_make) string(STRIP "${LDFLAGS_${var_suffix}}" LDFLAGS_${var_suffix}) string(STRIP "${ARFLAGS_${var_suffix}}" ARFLAGS_${var_suffix}) if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_DETECTED_CMAKE_LINKER MATCHES [[link\.exe$]]) - separate_arguments(LDFLAGS_LIST NATIVE_COMMAND "-Wl,${LDFLAGS_${var_suffix}}") - list(JOIN LDFLAGS_LIST " -Wl," LDFLAGS_${var_suffix}) + # Do not touch autotools quirks incoming! + # -Xlinker is repeated three times because: + # - libtool script eats -Xlinker + # - the compile wrapper eats -Xlinker + # - passing through both tools requires 3 -Xlinker; two being eaten in the first script. + # passing only through one script will keep one -Xlinker (done in configure) + # but cl will just ignore those with a warning. (Just like -Xcompiler) + separate_arguments(LDFLAGS_LIST NATIVE_COMMAND "${LDFLAGS_${var_suffix}}") + list(JOIN LDFLAGS_LIST " -Xlinker -Xlinker -Xlinker " LDFLAGS_${var_suffix}) + string(PREPEND LDFLAGS_${var_suffix} "-Xlinker -Xlinker -Xlinker ") endif() endif() endmacro() From 0365507d7a2bf2774c79f0bb7c17da71958b3e08 Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:04:26 +0200 Subject: [PATCH 14/20] make assembler compile only. --- scripts/cmake/vcpkg_configure_make.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index c4d7452aadd4e0..e7351fcdc438c3 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -337,8 +337,10 @@ function(vcpkg_configure_make) endif() else() macro(make_set_env envvar cmakevar) - if(VCPKG_DETECTED_CMAKE_${cmakevar}) - set(ENV{${envvar}} "${VCPKG_DETECTED_CMAKE_${cmakevar}}") + set(prog "${VCPKG_DETECTED_CMAKE_${cmakevar}} ${ARGN}") + string(STRIP "${prog}" prog) + if(VCPKG_DETECTED_CMAKE_${cmakevar} AND NOT DEFINED ENV{${envvar}}) + set(ENV{${envvar}} "${prog}") else() if(NOT DEFINED ENV{${envvar}}) set(ENV{${envvar}} "false") #/usr/bin/false is a binary returning 0 for any input @@ -351,14 +353,15 @@ function(vcpkg_configure_make) make_set_env(NM NM) make_set_env(RC RC) make_set_env(WINDRES RC) - make_set_env(CCAS C_COMPILER) - make_set_env(AS C_COMPILER) make_set_env(DLLTOOL DLLTOOL) make_set_env(STRIP STRIP) make_set_env(OBJDUMP OBJDUMP) make_set_env(RANLIB RANLIB) make_set_env(AR AR) make_set_env(LD LINKER) + # Only compile. + make_set_env(CCAS C_COMPILER "-c") + make_set_env(AS C_COMPILER "-c") endif() # Some PATH handling for dealing with spaces....some tools will still fail with that! From 30576d80415bb3d3008b8a304f660c274f287c50 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:19:22 +0200 Subject: [PATCH 15/20] disable _FOR_BUILD if crosscompiling. use function instead of macro. Remove AS settings --- scripts/cmake/vcpkg_configure_make.cmake | 48 +++++++++++++++++------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index e7351fcdc438c3..609568b21b299a 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -261,7 +261,16 @@ function(vcpkg_configure_make) z_vcpkg_append_to_configure_environment(configure_env CPP "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER} -E") z_vcpkg_append_to_configure_environment(configure_env CC "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER}") - z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER}") + if(NOT VCPKG_CROSSCOMPILING) + z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER}") + z_vcpkg_append_to_configure_environment(configure_env CPP_FOR_BUILD "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER} -E") + z_vcpkg_append_to_configure_environment(configure_env CXX_FOR_BUILD "compile ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") + else() + # Silly trick to make configure accept CC_FOR_BUILD but in reallity CC_FOR_BUILD is deactivated. + z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + z_vcpkg_append_to_configure_environment(configure_env CPP_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + z_vcpkg_append_to_configure_environment(configure_env CXX_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + endif() z_vcpkg_append_to_configure_environment(configure_env CXX "compile ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") z_vcpkg_append_to_configure_environment(configure_env RC "windres-rc ${VCPKG_DETECTED_CMAKE_RC_COMPILER}") z_vcpkg_append_to_configure_environment(configure_env WINDRES "windres-rc ${VCPKG_DETECTED_CMAKE_RC_COMPILER}") @@ -273,7 +282,15 @@ function(vcpkg_configure_make) else() z_vcpkg_append_to_configure_environment(configure_env CPP "${VCPKG_DETECTED_CMAKE_C_COMPILER} -E") z_vcpkg_append_to_configure_environment(configure_env CC "${VCPKG_DETECTED_CMAKE_C_COMPILER}") - z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "${VCPKG_DETECTED_CMAKE_C_COMPILER}") + if(NOT VCPKG_CROSSCOMPILING) + z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "${VCPKG_DETECTED_CMAKE_C_COMPILER}") + z_vcpkg_append_to_configure_environment(configure_env CPP_FOR_BUILD "${VCPKG_DETECTED_CMAKE_C_COMPILER} -E") + z_vcpkg_append_to_configure_environment(configure_env CXX_FOR_BUILD "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") + else() + z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + z_vcpkg_append_to_configure_environment(configure_env CPP_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + z_vcpkg_append_to_configure_environment(configure_env CXX_FOR_BUILD "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + endif() z_vcpkg_append_to_configure_environment(configure_env CXX "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") z_vcpkg_append_to_configure_environment(configure_env RC "${VCPKG_DETECTED_CMAKE_RC_COMPILER}") z_vcpkg_append_to_configure_environment(configure_env WINDRES "${VCPKG_DETECTED_CMAKE_RC_COMPILER}") @@ -336,19 +353,26 @@ function(vcpkg_configure_make) list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all) endif() else() - macro(make_set_env envvar cmakevar) + function(make_set_env envvar cmakevar) set(prog "${VCPKG_DETECTED_CMAKE_${cmakevar}} ${ARGN}") string(STRIP "${prog}" prog) - if(VCPKG_DETECTED_CMAKE_${cmakevar} AND NOT DEFINED ENV{${envvar}}) + if(DEFINED ENV{${envvar}}) + return() + endif() + if(VCPKG_DETECTED_CMAKE_${cmakevar}) set(ENV{${envvar}} "${prog}") - else() - if(NOT DEFINED ENV{${envvar}}) - set(ENV{${envvar}} "false") #/usr/bin/false is a binary returning 0 for any input - endif() endif() - endmacro() + endfunction() make_set_env(CC C_COMPILER) - make_set_env(CC_FOR_BUILD C_COMPILER) + if(NOT VCPKG_CROSSCOMPILING) + make_set_env(CC_FOR_BUILD C_COMPILER) + #make_set_env(CPP_FOR_BUILD C_COMPILER) + make_set_env(CXX_FOR_BUILD C_COMPILER) + else() + set(ENV{CC_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + set(ENV{CPP_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + set(ENV{CXX_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") + endif() make_set_env(CXX CXX_COMPILER) make_set_env(NM NM) make_set_env(RC RC) @@ -359,9 +383,7 @@ function(vcpkg_configure_make) make_set_env(RANLIB RANLIB) make_set_env(AR AR) make_set_env(LD LINKER) - # Only compile. - make_set_env(CCAS C_COMPILER "-c") - make_set_env(AS C_COMPILER "-c") + unset(make_set_env) endif() # Some PATH handling for dealing with spaces....some tools will still fail with that! From 46ab3395791738c7ae82a8463efbc99cf0bf7464 Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:13:44 +0200 Subject: [PATCH 16/20] ignore settings for osx until somebody knows how to fix it. --- scripts/cmake/vcpkg_configure_make.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 609568b21b299a..5e0cf5d2d94e49 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -352,7 +352,8 @@ function(vcpkg_configure_make) # Currently needed for arm because objdump yields: "unrecognised machine type (0x1c4) in Import Library Format archive" list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all) endif() - else() + elseif(NOT VCPKG_TARGET_IS_OSX) + # Because OSX dosn't like CMAKE_C(XX)_COMPILER (cc) in CC/CXX and rather wants to have gcc/g++ function(make_set_env envvar cmakevar) set(prog "${VCPKG_DETECTED_CMAKE_${cmakevar}} ${ARGN}") string(STRIP "${prog}" prog) @@ -366,7 +367,7 @@ function(vcpkg_configure_make) make_set_env(CC C_COMPILER) if(NOT VCPKG_CROSSCOMPILING) make_set_env(CC_FOR_BUILD C_COMPILER) - #make_set_env(CPP_FOR_BUILD C_COMPILER) + make_set_env(CPP_FOR_BUILD C_COMPILER "-E") make_set_env(CXX_FOR_BUILD C_COMPILER) else() set(ENV{CC_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") From ef6714b3c16916813ead915d7d72bc61fa4f830c Mon Sep 17 00:00:00 2001 From: Neumann-A <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 8 Jun 2022 09:10:06 +0200 Subject: [PATCH 17/20] CR z_vcpkg_make_set_env --- scripts/cmake/vcpkg_configure_make.cmake | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 5e0cf5d2d94e49..9d963f717d5a3c 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -354,7 +354,7 @@ function(vcpkg_configure_make) endif() elseif(NOT VCPKG_TARGET_IS_OSX) # Because OSX dosn't like CMAKE_C(XX)_COMPILER (cc) in CC/CXX and rather wants to have gcc/g++ - function(make_set_env envvar cmakevar) + function(z_vcpkg_make_set_env envvar cmakevar) set(prog "${VCPKG_DETECTED_CMAKE_${cmakevar}} ${ARGN}") string(STRIP "${prog}" prog) if(DEFINED ENV{${envvar}}) @@ -364,27 +364,27 @@ function(vcpkg_configure_make) set(ENV{${envvar}} "${prog}") endif() endfunction() - make_set_env(CC C_COMPILER) + z_vcpkg_make_set_env(CC C_COMPILER) if(NOT VCPKG_CROSSCOMPILING) - make_set_env(CC_FOR_BUILD C_COMPILER) - make_set_env(CPP_FOR_BUILD C_COMPILER "-E") - make_set_env(CXX_FOR_BUILD C_COMPILER) + z_vcpkg_make_set_env(CC_FOR_BUILD C_COMPILER) + z_vcpkg_make_set_env(CPP_FOR_BUILD C_COMPILER "-E") + z_vcpkg_make_set_env(CXX_FOR_BUILD C_COMPILER) else() set(ENV{CC_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") set(ENV{CPP_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") set(ENV{CXX_FOR_BUILD} "touch a.out | touch conftest${VCPKG_HOST_EXECUTABLE_SUFFIX} | true") endif() - make_set_env(CXX CXX_COMPILER) - make_set_env(NM NM) - make_set_env(RC RC) - make_set_env(WINDRES RC) - make_set_env(DLLTOOL DLLTOOL) - make_set_env(STRIP STRIP) - make_set_env(OBJDUMP OBJDUMP) - make_set_env(RANLIB RANLIB) - make_set_env(AR AR) - make_set_env(LD LINKER) - unset(make_set_env) + z_vcpkg_make_set_env(CXX CXX_COMPILER) + z_vcpkg_make_set_env(NM NM) + z_vcpkg_make_set_env(RC RC) + z_vcpkg_make_set_env(WINDRES RC) + z_vcpkg_make_set_env(DLLTOOL DLLTOOL) + z_vcpkg_make_set_env(STRIP STRIP) + z_vcpkg_make_set_env(OBJDUMP OBJDUMP) + z_vcpkg_make_set_env(RANLIB RANLIB) + z_vcpkg_make_set_env(AR AR) + z_vcpkg_make_set_env(LD LINKER) + unset(z_vcpkg_make_set_env) endif() # Some PATH handling for dealing with spaces....some tools will still fail with that! From 72ce1e8395247b410a0a082747efcb01f4358c01 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 8 Jun 2022 21:27:28 +0200 Subject: [PATCH 18/20] CI retrigger From 5e2d82ef379c3f04acca3c65e04d71af14538f31 Mon Sep 17 00:00:00 2001 From: Neumann-A Date: Tue, 12 Jul 2022 11:02:49 +0200 Subject: [PATCH 19/20] make conflicting options an error --- scripts/cmake/vcpkg_configure_make.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 9d963f717d5a3c..6aae844e73467d 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -133,6 +133,10 @@ function(vcpkg_configure_make) message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") endif() + if(DEFINED arg_USE_WRAPPERS AND DEFINED arg_NO_WRAPPERS) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed conflicting options USE_WRAPPERS and NO_WRAPPERS. Please remove one of them!") + endif() + z_vcpkg_get_cmake_vars(cmake_vars_file) debug_message("Including cmake vars from: ${cmake_vars_file}") include("${cmake_vars_file}") From 316c9b8f4687b9e24ec2fa90c726b3fd58eeae42 Mon Sep 17 00:00:00 2001 From: Neumann-A Date: Tue, 12 Jul 2022 12:03:34 +0200 Subject: [PATCH 20/20] remove DEFINED since the options are always defined --- scripts/cmake/vcpkg_configure_make.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 6aae844e73467d..096baf965dffee 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -133,7 +133,7 @@ function(vcpkg_configure_make) message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") endif() - if(DEFINED arg_USE_WRAPPERS AND DEFINED arg_NO_WRAPPERS) + if(arg_USE_WRAPPERS AND arg_NO_WRAPPERS) message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed conflicting options USE_WRAPPERS and NO_WRAPPERS. Please remove one of them!") endif()