diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eab6bc83283339..1f8a1efb300a86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,44 +21,7 @@ jobs: # check_disk_space: df -h env: VCPKG_PACKAGES: >- - angle - chromaprint - fdk-aac - ffmpeg - fftw3 - hidapi - hss1394 - libebur128 - libflac - libid3tag - libkeyfinder - libmad - libmodplug - libogg - libopusenc - libshout - libsndfile - libusb - libvorbis - lilv - mp3lame - opus - opusfile portaudio[asio] - portmidi - protobuf - pthreads - qt5-base - qt5-declarative - qt5-script - qt5-svg - qt5-translations - qt5-winextras - qtkeychain - rubberband - soundtouch - taglib - wavpack VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }} VCPKG_OVERLAY_PORTS: overlay/ports DEPS_BASE_NAME: mixxx-deps @@ -96,8 +59,8 @@ jobs: - name: Check available disk space run: ${{ matrix.check_disk_space }} - - name: Upgrade packages in cache - run: ./vcpkg upgrade --no-dry-run + - name: Remove outdated packages from cache + run: ./vcpkg remove --vcpkg-root=${{ matrix.vcpkg_path }} --outdated --recurse working-directory: ${{ matrix.vcpkg_path }} - name: Build packages @@ -112,7 +75,24 @@ jobs: path: ${{ matrix.vcpkg_path }}/buildtrees/**/*.log - name: Create buildenv archive - run: ./vcpkg export ${{ env.VCPKG_PACKAGES }} --zip --output=${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} + run: ./vcpkg export ${{ env.VCPKG_PACKAGES }} --raw --output=${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} + working-directory: ${{ matrix.vcpkg_path }} + + - name: Download ${{ env.DEPS_BASE_NAME }} + id: download-file + uses: carlosperate/download-file-action@v2 + with: + file-url: 'https://downloads.mixxx.org/dependencies/2.3/Windows/mixxx-deps-2.3-x64-windows-049b5ad.zip' + sha256: '82c49c82f54989cca0b35ab331afcb5fed486e929464beeede321583a778940a' + + - name: Inegrate ${{ env.DEPS_BASE_NAME }} + if: ${{ steps.cache.outputs.cache-matched-key == null }} + run: | + cmake -E tar xv ${{ steps.download-file.outputs.file-path }} + cmake -E copy_directory ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} mixxx-deps-2.3-x64-windows-049b5ad + cmake -E rm -r ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} + cmake -E rename mixxx-deps-2.3-x64-windows-049b5ad ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} + cmake -E tar cfv ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }}.zip --format=zip ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.vcpkg_triplet }}-${{ steps.vars.outputs.sha_short }} working-directory: ${{ matrix.vcpkg_path }} - name: "[Windows] Install additional tools" diff --git a/overlay/ports/jack2/CMakeLists.txt b/overlay/ports/jack2/CMakeLists.txt new file mode 100644 index 00000000000000..6c46d8d91d4531 --- /dev/null +++ b/overlay/ports/jack2/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.1) +project(jack VERSION 1.9 LANGUAGES C) + +include_directories(common) + +add_library(jack common/JackWeakAPI.c) +if(WIN32 AND BUILD_SHARED_LIBS) + target_sources(jack PRIVATE jack.def) +endif() +target_link_libraries(jack PRIVATE ${CMAKE_DL_LIBS}) + +include(GNUInstallDirs) +install(TARGETS jack + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" +) + +set(PREFIX "${CMAKE_INSTALL_PREFIX}") +set(LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") +set(INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +set(JACK_VERSION "${CMAKE_PROJECT_VERSION}") +# JackWeak dynamically loads the real JACK library which requires linking CMAKE_DL_LIBS +if(CMAKE_DL_LIBS) + set(CLIENTLIB "jack -l${CMAKE_DL_LIBS}") +else() + set(CLIENTLIB "jack") +endif() +# NOTE: the server_libs variable will be broken but this port does not build the server anyway +configure_file(jack.pc.in "${CMAKE_CURRENT_BINARY_DIR}/jack.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/jack.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + +install(DIRECTORY "common/jack" DESTINATION "include") diff --git a/overlay/ports/jack2/jack.def b/overlay/ports/jack2/jack.def new file mode 100644 index 00000000000000..c542e5337f851b --- /dev/null +++ b/overlay/ports/jack2/jack.def @@ -0,0 +1,96 @@ +LIBRARY JACK + +EXPORTS + +;FIXME these are unimplemented +;jack_port_uuid +;jack_get_cycle_times + +jack_get_version +jack_get_version_string +jack_client_open +jack_client_new +jack_client_close +jack_client_name_size +jack_get_client_name +jack_get_uuid_for_client_name +jack_get_client_name_by_uuid +jack_internal_client_new +jack_internal_client_close +jack_activate +jack_deactivate +jack_client_thread_id +jack_is_realtime +jack_thread_wait +jack_cycle_wait +jack_cycle_signal +jack_set_process_thread +jack_set_thread_init_callback +jack_on_shutdown +jack_on_info_shutdown +jack_set_process_callback +jack_set_freewheel_callback +jack_set_buffer_size_callback +jack_set_sample_rate_callback +jack_set_client_registration_callback +jack_set_port_registration_callback +jack_set_port_connect_callback +jack_set_port_rename_callback +jack_set_graph_order_callback +jack_set_xrun_callback +jack_set_latency_callback +jack_set_freewheel +jack_set_buffer_size +jack_get_sample_rate +jack_get_buffer_size +jack_engine_takeover_timebase +jack_cpu_load +jack_port_register +jack_port_unregister +jack_port_get_buffer +jack_port_name +jack_port_short_name +jack_port_flags +jack_port_type +jack_port_type_id +jack_port_is_mine +jack_port_connected +jack_port_connected_to +jack_port_get_connections +jack_port_get_all_connections +jack_port_tie +jack_port_untie +jack_port_set_name +jack_port_rename +jack_port_set_alias +jack_port_unset_alias +jack_port_get_aliases +jack_port_request_monitor +jack_port_request_monitor_by_name +jack_port_ensure_monitor +jack_port_monitoring_input +jack_connect +jack_disconnect +jack_port_disconnect +jack_port_name_size +jack_port_type_size +jack_port_type_get_buffer_size +jack_port_set_latency +jack_port_get_latency_range +jack_port_set_latency_range +jack_recompute_total_latencies +jack_port_get_latency +jack_port_get_total_latency +jack_recompute_total_latency +jack_get_ports +jack_port_by_name +jack_port_by_id +jack_frames_since_cycle_start +jack_frame_time +jack_last_frame_time +jack_frames_to_time +jack_time_to_frames +jack_get_time +jack_set_error_function +jack_set_info_function +jack_free diff --git a/overlay/ports/jack2/portfile.cmake b/overlay/ports/jack2/portfile.cmake new file mode 100644 index 00000000000000..3ab7e180e06384 --- /dev/null +++ b/overlay/ports/jack2/portfile.cmake @@ -0,0 +1,25 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO jackaudio/jack2 + REF v1.9.21 + SHA512 0e9ce581fca3c5d9ffb1de22b45cae6d94085c6f92ff3554892e25727baf66a2269f10d338d95d991e8380c4be5e0cc1e1453b9f878c7dc2e8a990f3bd458557 + HEAD_REF master +) + +# Install headers and a shim library with JackWeakAPI.c +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" + "${CMAKE_CURRENT_LIST_DIR}/jack.def" + DESTINATION "${SOURCE_PATH}" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/overlay/ports/jack2/vcpkg.json b/overlay/ports/jack2/vcpkg.json new file mode 100644 index 00000000000000..356579f3a8728a --- /dev/null +++ b/overlay/ports/jack2/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "jack2", + "version-semver": "1.9.21", + "description": "Cross-platform API that enables device sharing and inter-application audio routing", + "homepage": "https://jackaudio.org/", + "license": "GPL-2.0", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/overlay/ports/pkgconf/portfile.cmake b/overlay/ports/pkgconf/portfile.cmake new file mode 100644 index 00000000000000..0f269dc13b702e --- /dev/null +++ b/overlay/ports/pkgconf/portfile.cmake @@ -0,0 +1,82 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO pkgconf/pkgconf + REF cef30268e1a3f79efd607c26abcf556aa314c9c4 + SHA512 ea03b81d01521201bdc471a39cdc8b13f9452f7cc78706d5c57056595f3e4e8a3562c022ebb72ce6444f2c7a8dfc778114814ef5064eaef770a70cc294c7f7ee + HEAD_REF master +) + +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + NO_PKG_CONFIG + OPTIONS -Dtests=false +) + +set(systemsuffix "") +set(architectureprefix "") + +set(SYSTEM_LIBDIR "") +set(PKG_DEFAULT_PATH "") +set(SYSTEM_INCLUDEDIR "") +set(PERSONALITY_PATH "personality.d") + + +if(NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_CROSSCOMPILING AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + # These defaults are obtained from pkgconf/pkg-config on Ubuntu and OpenSuse + # vcpkg cannot do system introspection to obtain/set these values since it would break binary caching. + set(SYSTEM_INCLUDEDIR "/usr/include") + # System lib dirs will be stripped from -L from the pkg-config output + set(SYSTEM_LIBDIR "/lib:/lib/i386-linux-gnu:/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnux32:/lib64:/lib32:/libx32:/usr/lib:/usr/lib/i386-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnux32:/usr/lib64:/usr/lib32:/usr/libx32") + set(PKG_DEFAULT_PATH "/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig") + set(PERSONALITY_PATH "/usr/share/pkgconfig/personality.d:/etc/pkgconfig/personality.d") +endif() + +if(DEFINED VCPKG_pkgconf_SYSTEM_LIBDIR) + set(SYSTEM_LIBDIR "${VCPKG_pkgconf_SYSTEM_LIBDIR}") +endif() +if(DEFINED VCPKG_pkgconf_PKG_DEFAULT_PATH) + set(PKG_DEFAULT_PATH "${VCPKG_pkgconf_PKG_DEFAULT_PATH}") +endif() +if(DEFINED VCPKG_pkgconf_SYSTEM_INCLUDEDIR) + set(SYSTEM_INCLUDEDIR "${VCPKG_pkgconf_SYSTEM_INCLUDEDIR}") +endif() +if(DEFINED VCPKG_pkgconf_PERSONALITY_PATH) + set(PERSONALITY_PATH "${VCPKG_pkgconf_PERSONALITY_PATH}") +endif() + + +set(pkgconfig_file "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libpkgconf/config.h") +if(EXISTS "${pkgconfig_file}") + file(READ "${pkgconfig_file}" contents) + string(REGEX REPLACE "#define PKG_DEFAULT_PATH [^\n]+" "#define PKG_DEFAULT_PATH \"${PKG_DEFAULT_PATH}\"" contents "${contents}") + string(REGEX REPLACE "#define SYSTEM_INCLUDEDIR [^\n]+" "#define SYSTEM_INCLUDEDIR \"${SYSTEM_INCLUDEDIR}\"" contents "${contents}") + string(REGEX REPLACE "#define SYSTEM_LIBDIR [^\n]+" "#define SYSTEM_LIBDIR \"${SYSTEM_LIBDIR}\"" contents "${contents}") + string(REGEX REPLACE "#define PERSONALITY_PATH [^\n]+" "#define PERSONALITY_PATH \"${PERSONALITY_PATH}\"" contents "${contents}") + file(WRITE "${pkgconfig_file}" "${contents}") +endif() +set(pkgconfig_file "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libpkgconf/config.h") +if(EXISTS "${pkgconfig_file}") + file(READ "${pkgconfig_file}" contents) + string(REGEX REPLACE "#define PKG_DEFAULT_PATH [^\n]+" "#define PKG_DEFAULT_PATH \"${PKG_DEFAULT_PATH}\"" contents "${contents}") + string(REGEX REPLACE "#define SYSTEM_INCLUDEDIR [^\n]+" "#define SYSTEM_INCLUDEDIR \"${SYSTEM_INCLUDEDIR}\"" contents "${contents}") + string(REGEX REPLACE "#define SYSTEM_LIBDIR [^\n]+" "#define SYSTEM_LIBDIR \"${SYSTEM_LIBDIR}\"" contents "${contents}") + string(REGEX REPLACE "#define PERSONALITY_PATH [^\n]+" "#define PERSONALITY_PATH \"${PERSONALITY_PATH}\"" contents "${contents}") + file(WRITE "${pkgconfig_file}" "${contents}") +endif() + +vcpkg_install_meson() +vcpkg_fixup_pkgconfig(SKIP_CHECK) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/man") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/pkgconf/libpkgconf/libpkgconf-api.h" "#if defined(PKGCONFIG_IS_STATIC)" "#if 1") +endif() + +vcpkg_copy_tools(TOOL_NAMES pkgconf AUTO_CLEAN) + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/overlay/ports/pkgconf/vcpkg.json b/overlay/ports/pkgconf/vcpkg.json new file mode 100644 index 00000000000000..90aa626deb90ba --- /dev/null +++ b/overlay/ports/pkgconf/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "pkgconf", + "version": "1.8.0", + "port-version": 3, + "description": "pkgconf is a program which helps to configure compiler and linker flags for development libraries. It is similar to pkg-config from freedesktop.org.", + "homepage": "https://github.com/pkgconf/pkgconf", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-tool-meson", + "host": true + } + ] +} diff --git a/overlay/ports/portaudio/portfile.cmake b/overlay/ports/portaudio/portfile.cmake index b6c5de1779dca6..c68b6d34f1cae9 100644 --- a/overlay/ports/portaudio/portfile.cmake +++ b/overlay/ports/portaudio/portfile.cmake @@ -1,34 +1,46 @@ -vcpkg_fail_port_install(ON_TARGET "uwp") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO Be-ing/portaudio - REF 0f7ab8fe8b4ab73d9c301385d67eee367d4f3dcc - SHA512 9f75f579349d776c93538f3aa8f4133d148da53029c73bc7635e2a2191709389e29d1f492ae6063b0ae768d4ae0b28738f6fddc65256d3eb1ac31fbba2f9eded - HEAD_REF cmake_rewrite + REPO PortAudio/portaudio + REF c8b9dd2dfc1c12230f172876a0117f42d32e48b2 + SHA512 8aa489de52c40068dc87c7a6b89e5b2fd4d10f57f69b800796c6f5e2c0db71a8094a85a06b4168d6d164a79d868b28adfd525ca4e7a8d3a0193a94face569b65 ) +string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} dynamic PA_BUILD_SHARED) +string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} static PA_BUILD_STATIC) + vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - asio ASIO + FEATURES + asio PA_USE_ASIO + jack PA_USE_JACK ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS ${FEATURE_OPTIONS} - OPTIONS_DEBUG -DDEBUG_OUTPUT:BOOL=ON - PREFER_NINJA + OPTIONS + ${FEATURE_OPTIONS} + -DPA_USE_DS=ON + -DPA_USE_WASAPI=ON + -DPA_USE_WDMKS=ON + -DPA_USE_WMME=ON + -DPA_LIBNAME_ADD_SUFFIX=OFF + -DPA_BUILD_SHARED=${PA_BUILD_SHARED} + -DPA_BUILD_STATIC=${PA_BUILD_STATIC} + -DPA_DLL_LINK_WITH_STATIC_RUNTIME=OFF + OPTIONS_DEBUG + -DPA_ENABLE_DEBUG_OUTPUT:BOOL=ON ) vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/${PORT}") 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}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "copyright") diff --git a/overlay/ports/portaudio/vcpkg.json b/overlay/ports/portaudio/vcpkg.json index c29d53c7c67059..001ea4cc4243bc 100644 --- a/overlay/ports/portaudio/vcpkg.json +++ b/overlay/ports/portaudio/vcpkg.json @@ -1,13 +1,28 @@ { "name": "portaudio", - "version-string": "2021-02-09", + "version-date": "2023-04-04", "description": "PortAudio Portable Cross-platform Audio I/O API PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.", "homepage": "https://app.assembla.com/spaces/portaudio/wiki", "license": "MIT", "supports": "!uwp", + "default-features": [ "jack" ], "features": { + "jack": { + "description": "Build with support for the JACK Audio Connection Kit host API.", + "dependencies": [ + "jack2", + { + "name": "tre", + "platform": "windows | mingw" + }, + { + "name": "pthreads", + "platform": "windows" + } + ] + }, "asio": { - "description": "Build with support for ASIO host API. This automatically downloads the ASIO SDK from Steinberg. Review the ASIO SDK license for details https://www.steinberg.net/en/company/developers.html" + "description": "Build with support for ASIO host API on Windows or MinGW. This automatically downloads the ASIO SDK from Steinberg. Review the ASIO SDK license for details https://www.steinberg.net/en/company/developers.html" } } } diff --git a/overlay/ports/pthreads/vcpkg-cmake-wrapper.cmake b/overlay/ports/pthreads/PThreads4WConfig.cmake similarity index 75% rename from overlay/ports/pthreads/vcpkg-cmake-wrapper.cmake rename to overlay/ports/pthreads/PThreads4WConfig.cmake index f9818d38456d1b..a3a132e9ff22d5 100644 --- a/overlay/ports/pthreads/vcpkg-cmake-wrapper.cmake +++ b/overlay/ports/pthreads/PThreads4WConfig.cmake @@ -46,7 +46,7 @@ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) if(NOT PThreads4W_INCLUDE_DIR) - find_path(PThreads4W_INCLUDE_DIR NAMES pthread.h) + find_path(PThreads4W_INCLUDE_DIR NAMES pthread.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH) endif() set(PThreads4W_MAJOR_VERSION 3) @@ -56,18 +56,18 @@ set(PThreads4W_VERSION "${PThreads4W_MAJOR_VERSION}.${PThreads4W_MINOR_VERSION}. # Allow libraries to be set manually if(NOT PThreads4W_LIBRARY) - find_library(PThreads4W_LIBRARY_RELEASE NAMES pthreadVC${PThreads4W_MAJOR_VERSION}) - find_library(PThreads4W_LIBRARY_DEBUG NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d) + find_library(PThreads4W_LIBRARY_RELEASE NAMES pthreadVC${PThreads4W_MAJOR_VERSION} PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) + find_library(PThreads4W_LIBRARY_DEBUG NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) select_library_configurations(PThreads4W) endif() if(NOT PThreads4W_CXXEXC_LIBRARY) - find_library(PThreads4W_CXXEXC_LIBRARY_RELEASE NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}) - find_library(PThreads4W_CXXEXC_LIBRARY_DEBUG NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d) + find_library(PThreads4W_CXXEXC_LIBRARY_RELEASE NAMES pthreadVCE${PThreads4W_MAJOR_VERSION} PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) + find_library(PThreads4W_CXXEXC_LIBRARY_DEBUG NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) select_library_configurations(PThreads4W_CXXEXC) endif() if(NOT PThreads4W_STRUCTEXC_LIBRARY) - find_library(PThreads4W_STRUCTEXC_LIBRARY_RELEASE NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}) - find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d) + find_library(PThreads4W_STRUCTEXC_LIBRARY_RELEASE NAMES pthreadVSE${PThreads4W_MAJOR_VERSION} PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH) + find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH) select_library_configurations(PThreads4W_STRUCTEXC) endif() @@ -88,23 +88,6 @@ find_file(PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL NAMES pthreadVCE${PThreads4W_MAJOR find_file(PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR}) find_file(PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DEBUG_DLL_DIR}) -#Compatibility definitions, deprecated -set(PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "") -set(PTHREADS_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "") -set(PThreads_windows_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "") -set(PTHREAD_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "") -set(PTHREADS_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "") -set(PTHREAD_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "") -set(PTHREADS_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "") -set(LIBPTHREAD ${PThreads4W_LIBRARY} CACHE STRING "") -set(LIBPTHREADS ${PThreads4W_LIBRARY} CACHE STRING "") -set(PThreads_windows_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "") -set(PThreads_VERSION "${PThreads4W_VERSION}") -if(PThreads4W_FOUND) - set(PThreads_windows_FOUND TRUE) -endif() - -#TARGETS if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_CXXEXC ) if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}" ) add_library( PThreads4W::PThreads4W_CXXEXC SHARED IMPORTED ) @@ -194,34 +177,3 @@ if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W ) endif() endif() endif() - -#Compatibility targets, deprecated -if( PThreads4W_FOUND AND NOT TARGET PThreads_windows::PThreads_windows ) - if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" ) - add_library( PThreads_windows::PThreads_windows SHARED IMPORTED ) - set_target_properties( PThreads_windows::PThreads_windows PROPERTIES - IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}" - IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" - IMPORTED_CONFIGURATIONS Release - IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" ) - set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) - set_target_properties( PThreads_windows::PThreads_windows PROPERTIES - IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}" - IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) - endif() - else() - add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED ) - set_target_properties( PThreads_windows::PThreads_windows PROPERTIES - IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}" - INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" - IMPORTED_CONFIGURATIONS Release - IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" ) - set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) - set_target_properties( PThreads_windows::PThreads_windows PROPERTIES - IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) - endif() - endif() -endif() diff --git a/overlay/ports/pthreads/fix-arm64-version_rc.patch b/overlay/ports/pthreads/fix-arm64-version_rc.patch new file mode 100644 index 00000000000000..696b1ad22a2fc4 --- /dev/null +++ b/overlay/ports/pthreads/fix-arm64-version_rc.patch @@ -0,0 +1,22 @@ +diff --git a/version.rc b/version.rc +index aa0596c..9c8231e 100644 +--- a/version.rc ++++ b/version.rc +@@ -63,6 +63,17 @@ + # define __PTW32_VERSIONINFO_NAME "pthreadVSE2.DLL\0" + # define __PTW32_VERSIONINFO_DESCRIPTION "MS C SEH x86\0" + # endif ++# elif defined (__PTW32_ARCHARM64) ++# if defined(__PTW32_CLEANUP_C) ++# define __PTW32_VERSIONINFO_NAME "pthreadVC2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C arm64\0" ++# elif defined(__PTW32_CLEANUP_CXX) ++# define __PTW32_VERSIONINFO_NAME "pthreadVCE2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C++ arm64\0" ++# elif defined(__PTW32_CLEANUP_SEH) ++# define __PTW32_VERSIONINFO_NAME "pthreadVSE2.DLL\0" ++# define __PTW32_VERSIONINFO_DESCRIPTION "MS C SEH arm64\0" ++# endif + # endif + #elif defined(__GNUC__) + # if defined(_M_X64) diff --git a/overlay/ports/pthreads/fix-install.patch b/overlay/ports/pthreads/fix-install.patch new file mode 100644 index 00000000000000..afccae9aaa42a2 --- /dev/null +++ b/overlay/ports/pthreads/fix-install.patch @@ -0,0 +1,53 @@ +diff --git a/Makefile b/Makefile +index a703b9c..b7b5ea7 100644 +--- a/Makefile ++++ b/Makefile +@@ -80,18 +80,27 @@ help: + @ echo nmake clean VSE-static-debug + + all: ++!IF DEFINED(BUILD_STATIC) ++! IF DEFINED(BUILD_RELEASE) + $(MAKE) /E clean VC-static + $(MAKE) /E clean VCE-static + $(MAKE) /E clean VSE-static ++! ELSE + $(MAKE) /E clean VC-static-debug + $(MAKE) /E clean VCE-static-debug + $(MAKE) /E clean VSE-static-debug ++! ENDIF ++!ELSE ++! IF DEFINED(BUILD_RELEASE) + $(MAKE) /E clean VC + $(MAKE) /E clean VCE + $(MAKE) /E clean VSE ++! ELSE + $(MAKE) /E clean VC-debug + $(MAKE) /E clean VCE-debug + $(MAKE) /E clean VSE-debug ++! ENDIF ++!ENDIF + $(MAKE) /E clean + + TEST_ENV = CFLAGS="$(CFLAGS) /DNO_ERROR_DIALOGS" +@@ -218,8 +227,7 @@ install: + if not exist $(LIBDEST) mkdir $(LIBDEST) + if not exist $(HDRDEST) mkdir $(HDRDEST) + if exist pthreadV*.dll copy pthreadV*.dll $(DLLDEST) +- copy pthreadV*.lib $(LIBDEST) +- copy libpthreadV*.lib $(LIBDEST) ++ if exist pthreadV*.lib copy pthreadV*.lib $(LIBDEST) + copy _ptw32.h $(HDRDEST) + copy pthread.h $(HDRDEST) + copy sched.h $(HDRDEST) +@@ -229,8 +237,8 @@ $(DLLS): $(DLL_OBJS) + $(CC) /LDd /Zi $(DLL_OBJS) /link /implib:$*.lib $(XLIBS) /out:$@ + + $(INLINED_STATIC_STAMPS): $(STATIC_OBJS) +- if exist lib$*.lib del lib$*.lib +- lib $(STATIC_OBJS) /out:lib$*.lib ++ if exist $*.lib del $*.lib ++ lib $(STATIC_OBJS) /out:$*.lib + echo. >$@ + + $(SMALL_STATIC_STAMPS): $(STATIC_OBJS_SMALL) diff --git a/overlay/ports/pthreads/fix-pthread_getname_np.patch b/overlay/ports/pthreads/fix-pthread_getname_np.patch new file mode 100644 index 00000000000000..7eaadea54cace1 --- /dev/null +++ b/overlay/ports/pthreads/fix-pthread_getname_np.patch @@ -0,0 +1,26 @@ +diff --git a/pthread_getname_np.c b/pthread_getname_np.c +index 8fc32b1..7c18655 100644 +--- a/pthread_getname_np.c ++++ b/pthread_getname_np.c +@@ -59,10 +59,18 @@ pthread_getname_np(pthread_t thr, char *name, int len) + + __ptw32_mcs_lock_acquire (&tp->threadLock, &threadLock); + +- for (s = tp->name, d = name; *s && d < &name[len - 1]; *d++ = *s++) +- {} ++ if(tp->name) ++ { ++ for (s = tp->name, d = name; *s && d < &name[len - 1]; *d++ = *s++) ++ {} ++ ++ *d = '\0'; ++ } ++ else ++ { ++ *name = '\0'; ++ } + +- *d = '\0'; + __ptw32_mcs_lock_release (&threadLock); + + return result; diff --git a/overlay/ports/pthreads/fix-uwp-linkage.patch b/overlay/ports/pthreads/fix-uwp-linkage.patch index 77d3a5b15a5e38..22a12f846bda60 100644 --- a/overlay/ports/pthreads/fix-uwp-linkage.patch +++ b/overlay/ports/pthreads/fix-uwp-linkage.patch @@ -15,3 +15,23 @@ index 1579376..3a7d29b 100644 #if !defined (__PTW32_CONFIG_H) # error "config.h was not #included" #endif + +diff --git a/pthread_cancel.c b/pthread_cancel.c +index fddf216..bf16870 100644 +--- a/pthread_cancel.c ++++ b/pthread_cancel.c +@@ -64,12 +64,12 @@ __ptw32_cancel_callback (ULONG_PTR unused) + DWORD + __ptw32_Registercancellation (PAPCFUNC unused1, HANDLE threadH, DWORD unused2) + { +- CONTEXT context; ++ /*CONTEXT context; + + context.ContextFlags = CONTEXT_CONTROL; + GetThreadContext (threadH, &context); + __PTW32_PROGCTR (context) = (DWORD_PTR) __ptw32_cancel_self; +- SetThreadContext (threadH, &context); ++ SetThreadContext (threadH, &context);*/ + return 0; + } + diff --git a/overlay/ports/pthreads/portfile.cmake b/overlay/ports/pthreads/portfile.cmake index 47493940e6a292..7704ad7118499a 100644 --- a/overlay/ports/pthreads/portfile.cmake +++ b/overlay/ports/pthreads/portfile.cmake @@ -3,8 +3,6 @@ if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW) return() endif() -set(PTHREADS4W_VERSION "3.0.0") - if(VCPKG_TARGET_IS_UWP) list(APPEND PATCH_FILES fix-uwp-linkage.patch) # Inject linker option using the `LINK` environment variable @@ -12,97 +10,58 @@ if(VCPKG_TARGET_IS_UWP) # https://docs.microsoft.com/en-us/cpp/build/reference/linking#link-environment-variables set(ENV{LINK} "/APPCONTAINER") endif() + if (VCPKG_CRT_LINKAGE STREQUAL dynamic) list(APPEND PATCH_FILES use-md.patch) else() list(APPEND PATCH_FILES use-mt.patch) endif() +list(APPEND PATCH_FILES fix-pthread_getname_np.patch fix-install.patch) + vcpkg_from_sourceforge( - OUT_SOURCE_PATH SOURCE_PATH - REPO pthreads4w - FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip" - SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013 - PATCHES - fix-arm-macro.patch - ${PATCH_FILES} + OUT_SOURCE_PATH SOURCE_PATH + REPO pthreads4w + FILENAME "pthreads4w-code-v3.0.0.zip" + SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013 + PATCHES + fix-arm-macro.patch + fix-arm64-version_rc.patch # https://sourceforge.net/p/pthreads4w/code/merge-requests/6/ + ${PATCH_FILES} ) -find_program(NMAKE nmake REQUIRED) +file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" DESTROOT_DEBUG) +file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" DESTROOT_RELEASE) -################ -# Release build -################ -message(STATUS "Building ${TARGET_TRIPLET}-rel") -file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL) -vcpkg_execute_required_process( - COMMAND ${NMAKE} -f Makefile all install - "DESTROOT=\"${INST_DIR_REL}\"" - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME nmake-build-${TARGET_TRIPLET}-release -) -message(STATUS "Building ${TARGET_TRIPLET}-rel done") - -################ -# Debug build -################ -message(STATUS "Building ${TARGET_TRIPLET}-dbg") -file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG) -vcpkg_execute_required_process( - COMMAND ${NMAKE} /G -f Makefile all install - "DESTROOT=\"${INST_DIR_DBG}\"" - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME nmake-build-${TARGET_TRIPLET}-debug -) -message(STATUS "Building ${TARGET_TRIPLET}-dbg done") +vcpkg_list(SET OPTIONS_DEBUG "DESTROOT=${DESTROOT_DEBUG}") +vcpkg_list(SET OPTIONS_RELEASE "DESTROOT=${DESTROOT_RELEASE}" "BUILD_RELEASE=1") -file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVC3d.dll") -file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVCE3d.dll") -file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/pthreadVSE3d.dll") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVC3.dll") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVCE3.dll") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/pthreadVSE3.dll") - -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3.lib") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_list(APPEND OPTIONS_DEBUG "BUILD_STATIC=1") + vcpkg_list(APPEND OPTIONS_RELEASE "BUILD_STATIC=1") +endif() -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pthreadVC3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pthreadVCE3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pthreadVSE3d.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVC3.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVCE3.lib") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVSE3.lib") +vcpkg_install_nmake( + CL_LANGUAGE C + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_NAME Makefile + OPTIONS_DEBUG ${OPTIONS_DEBUG} + OPTIONS_RELEASE ${OPTIONS_RELEASE} +) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3.lib") - file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3.lib") - file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3.lib") - file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3d.lib") - file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3d.lib") - file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3d.lib") -endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVC3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVC3.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVCE3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVCE3.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpthreadVSE3.lib ${CURRENT_PACKAGES_DIR}/lib/pthreadVSE3.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVC3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVC3d.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVCE3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVCE3d.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpthreadVSE3d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/pthreadVSE3d.lib) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/PThreads4WConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/PThreads4W") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper-pthread.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/pthread" RENAME vcpkg-cmake-wrapper.cmake) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper-pthreads.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/pthreads" RENAME vcpkg-cmake-wrapper.cmake) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper-pthreads-windows.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/PThreads_windows" RENAME vcpkg-cmake-wrapper.cmake) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthread) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads_windows) +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) diff --git a/overlay/ports/pthreads/usage b/overlay/ports/pthreads/usage index 343c97f4406e59..69dcfd08c2ea1f 100644 --- a/overlay/ports/pthreads/usage +++ b/overlay/ports/pthreads/usage @@ -1,9 +1,4 @@ The package pthreads provides CMake targets: - find_package(pthreads REQUIRED) - + find_package(PThreads4W REQUIRED) target_link_libraries(main PRIVATE PThreads4W::PThreads4W) - #or - target_link_libraries(main PRIVATE PThreads4W::PThreads4W_CXXEXC) - #or - target_link_libraries(main PRIVATE PThreads4W::PThreads4W_STRUCTEXC) \ No newline at end of file diff --git a/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthread.cmake b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthread.cmake new file mode 100644 index 00000000000000..0d0515ce59044e --- /dev/null +++ b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthread.cmake @@ -0,0 +1,13 @@ +_find_package(PThreads4W) +set(PTHREAD_INCLUDE_DIR "${PThreads4W_INCLUDE_DIR}") +set(PTHREAD_LIBRARY "${PThreads4W_LIBRARY}") +set(PTHREAD_LIBRARIES "${PThreads4W_LIBRARY}") +set(PTHREAD_VERSION "${PThreads4W_VERSION}") +set(LIBPTHREAD "${PThreads4W_LIBRARY}") +set(LIBPTHREADS "${PThreads4W_LIBRARY}") + +if(PThreads4W_FOUND) + set(PTHREAD_FOUND TRUE) + set(LIBPTHREAD_FOUND TRUE) + set(LIBPTHREADS_FOUND TRUE) +endif() diff --git a/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads-windows.cmake b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads-windows.cmake new file mode 100644 index 00000000000000..e648ecf640d8b7 --- /dev/null +++ b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads-windows.cmake @@ -0,0 +1,39 @@ +_find_package(PThreads4W) +set(PThreads_windows_INCLUDE_DIR "${PThreads4W_INCLUDE_DIR}") +set(PThreads_windows_LIBRARY "${PThreads4W_LIBRARY}") +set(PThreads_windows_LIBRARIES "${PThreads4W_LIBRARY}") +set(PThreads_windows_VERSION "${PThreads4W_VERSION}") + +if(PThreads4W_FOUND) + set(PThreads_windows_FOUND TRUE) + + if(NOT TARGET PThreads_windows::PThreads_windows) + if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" ) + add_library( PThreads_windows::PThreads_windows SHARED IMPORTED ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) + if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" ) + set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}" + IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) + endif() + else() + add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) + if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" ) + set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) + endif() + endif() + endif() +endif() diff --git a/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads.cmake b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads.cmake new file mode 100644 index 00000000000000..453c5c24ade672 --- /dev/null +++ b/overlay/ports/pthreads/vcpkg-cmake-wrapper-pthreads.cmake @@ -0,0 +1,39 @@ +_find_package(PThreads4W) +set(pthreads_INCLUDE_DIR "${PThreads4W_INCLUDE_DIR}") +set(pthreads_LIBRARY "${PThreads4W_LIBRARY}") +set(pthreads_LIBRARIES "${PThreads4W_LIBRARY}") +set(pthreads_VERSION "${PThreads4W_VERSION}") + +if(PThreads4W_FOUND) + set(pthreads_FOUND TRUE) + + if(NOT TARGET PThreads_windows::PThreads_windows) + if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" ) + add_library( PThreads_windows::PThreads_windows SHARED IMPORTED ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) + if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" ) + set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}" + IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) + endif() + else() + add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) + if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" ) + set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) + set_target_properties( PThreads_windows::PThreads_windows PROPERTIES + IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" ) + endif() + endif() + endif() +endif() diff --git a/overlay/ports/pthreads/vcpkg.json b/overlay/ports/pthreads/vcpkg.json index 494e6e1dcc3522..127ddf938fc9bb 100644 --- a/overlay/ports/pthreads/vcpkg.json +++ b/overlay/ports/pthreads/vcpkg.json @@ -1,7 +1,14 @@ { "name": "pthreads", "version": "3.0.0", - "port-version": 11, - "description": "pthreads for windows", - "homepage": "https://sourceware.org/pub/pthreads-win32/" + "port-version": 13, + "description": "Meta-package that provides PThreads4W on Windows, or assumes presence of system pthreads on POSIX systems.", + "homepage": "https://sourceforge.net/projects/pthreads4w/", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/overlay/ports/vcpkg-pkgconfig-get-modules/copyright b/overlay/ports/vcpkg-pkgconfig-get-modules/copyright new file mode 100644 index 00000000000000..2e4eac8264fa4c --- /dev/null +++ b/overlay/ports/vcpkg-pkgconfig-get-modules/copyright @@ -0,0 +1,23 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/overlay/ports/vcpkg-pkgconfig-get-modules/portfile.cmake b/overlay/ports/vcpkg-pkgconfig-get-modules/portfile.cmake new file mode 100644 index 00000000000000..f82cf371bd6f5c --- /dev/null +++ b/overlay/ports/vcpkg-pkgconfig-get-modules/portfile.cmake @@ -0,0 +1,13 @@ +if(NOT TARGET_TRIPLET STREQUAL HOST_TRIPLET) + # make FATAL_ERROR in CI when issue #16773 fixed + message(WARNING "vcpkg-pkgconfig-get-modules is a host-only port; please mark it as a host port in your dependencies.") +endif() + +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" + "${CMAKE_CURRENT_LIST_DIR}/copyright" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/x_vcpkg_pkgconfig_get_modules.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/x_vcpkg_pkgconfig_get_modules.cmake" @ONLY) + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake b/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake new file mode 100644 index 00000000000000..01c9e6aec63bf6 --- /dev/null +++ b/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/x_vcpkg_pkgconfig_get_modules.cmake") diff --git a/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg.json b/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg.json new file mode 100644 index 00000000000000..f38c13d4d76c4e --- /dev/null +++ b/overlay/ports/vcpkg-pkgconfig-get-modules/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-pkgconfig-get-modules", + "version-date": "2022-02-10", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", + "license": "MIT", + "dependencies": [ + { + "name": "pkgconf", + "host": true, + "default-features": false + } + ] +} diff --git a/overlay/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake b/overlay/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake new file mode 100644 index 00000000000000..0ed124cff4bb1d --- /dev/null +++ b/overlay/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake @@ -0,0 +1,119 @@ +include_guard(GLOBAL) + +function(x_vcpkg_pkgconfig_get_modules) + cmake_parse_arguments(PARSE_ARGV 0 "arg" "CFLAGS;LIBS;LIBRARIES;LIBRARIES_DIR;INCLUDE_DIRS" "PREFIX" "MODULES") + if(NOT DEFINED arg_PREFIX OR arg_PREFIX STREQUAL "") + message(FATAL_ERROR "x_vcpkg_pkgconfig_get_modules requires parameter PREFIX!") + endif() + if(NOT DEFINED arg_MODULES OR arg_MODULES STREQUAL "") + message(FATAL_ERROR "x_vcpkg_pkgconfig_get_modules requires parameter MODULES!") + endif() + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "extra arguments passed to x_vcpkg_pkgconfig_get_modules: ${arg_UNPARSED_ARGUMENTS}") + endif() + + set(PKGCONFIG "${CURRENT_INSTALLED_DIR}/../@HOST_TRIPLET@/tools/pkgconf/pkgconf@VCPKG_HOST_EXECUTABLE_SUFFIX@") + + set(backup_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}") + + set(var_suffixes) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") + if(arg_LIBS) + execute_process( + COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBS_RELEASE) + endif() + if(arg_LIBRARIES) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_RELEASE) + endif() + if(arg_LIBRARIES_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DIRS_RELEASE) + endif() + if(arg_INCLUDE_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes INCLUDE_DIRS_RELEASE) + endif() + if(arg_CFLAGS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_CFLAGS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes CFLAGS_RELEASE) + endif() + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") + if(arg_LIBS) + execute_process( + COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBS_DEBUG) + endif() + if(arg_LIBRARIES) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DEBUG) + endif() + if(arg_LIBRARIES_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DIRS_DEBUG) + endif() + if(arg_INCLUDE_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes INCLUDE_DIRS_DEBUG) + endif() + if(arg_CFLAGS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_CFLAGS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes CFLAGS_DEBUG) + endif() + endif() + set(ENV{PKG_CONFIG_PATH} "${backup_PKG_CONFIG_PATH}") + + foreach(_var IN LISTS var_suffixes) + set("${arg_PREFIX}_${_var}" "${${arg_PREFIX}_${_var}}" PARENT_SCOPE) + endforeach() +endfunction() + +function(z_vcpkg_set_pkgconfig_path _path _backup) + if(NOT _backup STREQUAL "") + set(ENV{PKG_CONFIG_PATH} "${_path}${VCPKG_HOST_PATH_SEPARATOR}${_backup}") + else() + set(ENV{PKG_CONFIG_PATH} "${_path}") + endif() +endfunction() diff --git a/overlay/ports/vcpkg-tool-meson/meson-intl.patch b/overlay/ports/vcpkg-tool-meson/meson-intl.patch new file mode 100644 index 00000000000000..614db056d6acfa --- /dev/null +++ b/overlay/ports/vcpkg-tool-meson/meson-intl.patch @@ -0,0 +1,14 @@ +diff --git a/tools/meson/mesonbuild/dependencies/misc.py b/tools/meson/mesonbuild/dependencies/misc.py +index 537af1f89..43d7febf2 100644 +--- a/tools/meson/mesonbuild/dependencies/misc.py ++++ b/tools/meson/mesonbuild/dependencies/misc.py +@@ -610,7 +610,8 @@ iconv_factory = DependencyFactory( + + intl_factory = DependencyFactory( + 'intl', ++ [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM, DependencyMethods.CMAKE], ++ cmake_name='Intl', +- [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM], + builtin_class=IntlBuiltinDependency, + system_class=IntlSystemDependency, + ) diff --git a/overlay/ports/vcpkg-tool-meson/portfile.cmake b/overlay/ports/vcpkg-tool-meson/portfile.cmake new file mode 100644 index 00000000000000..680083a4591628 --- /dev/null +++ b/overlay/ports/vcpkg-tool-meson/portfile.cmake @@ -0,0 +1,63 @@ +# This port represents a dependency on the Meson build system. +# In the future, it is expected that this port acquires and installs Meson. +# Currently is used in ports that call vcpkg_find_acquire_program(MESON) in order to force rebuilds. + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +set(program MESON) +set(program_version 0.63.0) +set(program_name meson) +set(search_names meson meson.py) +set(interpreter PYTHON3) +set(apt_package_name "meson") +set(brew_package_name "meson") +set(ref bb91cea0d66d8d036063dedec1f194d663399cdf) +set(paths_to_search "${CURRENT_PACKAGES_DIR}/tools/meson") +set(download_urls "https://github.com/mesonbuild/meson/archive/${ref}.tar.gz") +set(download_filename "meson-${ref}.tar.gz") +set(download_sha512 e5888eb35dd4ab5fc0a16143cfbb5a7849f6d705e211a80baf0a8b753e2cf877a4587860a79cad129ec5f3474c12a73558ffe66439b1633d80b8044eceaff2da) +set(supported_on_unix ON) +set(version_command --version) +set(extra_search_args EXACT_VERSION_MATCH) + +vcpkg_find_acquire_program(PYTHON3) + +# Reenable if no patching of meson is required within vcpkg +# z_vcpkg_find_acquire_program_find_external("${program}" +# ${extra_search_args} +# PROGRAM_NAME "${program_name}" +# MIN_VERSION "${program_version}" +# INTERPRETER "${interpreter}" +# NAMES ${search_names} +# VERSION_COMMAND ${version_command} +# ) + +if(NOT "${program}") + vcpkg_download_distfile(archive_path + URLS ${download_urls} + SHA512 "${download_sha512}" + FILENAME "${download_filename}" + ) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools") + vcpkg_execute_in_download_mode( + COMMAND "${CMAKE_COMMAND}" -E tar xzf "${archive_path}" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools" + ) + file(RENAME "${CURRENT_PACKAGES_DIR}/tools/meson-${ref}" "${CURRENT_PACKAGES_DIR}/tools/meson") + z_vcpkg_apply_patches( + SOURCE_PATH "${CURRENT_PACKAGES_DIR}" + PATCHES + meson-intl.patch + ) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/meson/test cases") + configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY) +endif() + +z_vcpkg_find_acquire_program_find_internal("${program}" + INTERPRETER "${interpreter}" + PATHS ${paths_to_search} + NAMES ${search_names} +) + +message(STATUS "Using meson: ${MESON}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/meson/version.txt" "${program_version}") # For vcpkg_find_acquire_program diff --git a/overlay/ports/vcpkg-tool-meson/vcpkg-port-config.cmake b/overlay/ports/vcpkg-tool-meson/vcpkg-port-config.cmake new file mode 100644 index 00000000000000..887c4adbec0c8a --- /dev/null +++ b/overlay/ports/vcpkg-tool-meson/vcpkg-port-config.cmake @@ -0,0 +1 @@ +set(SCRIPT_MESON "${CMAKE_CURRENT_LIST_DIR}/../../tools/meson/meson.py") diff --git a/overlay/ports/vcpkg-tool-meson/vcpkg.json b/overlay/ports/vcpkg-tool-meson/vcpkg.json new file mode 100644 index 00000000000000..70c9690af8578c --- /dev/null +++ b/overlay/ports/vcpkg-tool-meson/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "vcpkg-tool-meson", + "version": "0.63", + "description": "Meson build system", + "homepage": "https://github.com/mesonbuild/meson", + "license": "Apache-2.0", + "supports": "native" +} diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake index 70259991bccbc3..79a15489949a38 100644 --- a/scripts/cmake/vcpkg_acquire_msys.cmake +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -351,8 +351,8 @@ msys_package( DEPS msys2-runtime ) msys_package( - URL "https://repo.msys2.org/msys/x86_64/msys2-runtime-3.1.6-3-x86_64.pkg.tar.xz" - SHA512 f094a7f4926195ef7ba015f0c5c56587b1faa94d85530f07aaaa5557a1494c3bd75257d4687c8401cbf1328d23e5586a92b05f0a872caebb1a7e941a07829776 + URL "https://repo.msys2.org/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst" + SHA512 fbdcf2572d242b14ef3b39f29a6119ee58705bad651c9da48ffd11e80637e8d767d20ed5d562f67d92eecd01f7fc3bc351af9d4f84fb9b321d2a9aff858b3619 ) msys_package( @@ -495,13 +495,13 @@ msys_package( SHA512 bbd4a549efc2a5f4b1e9f1be00331e8726d80401a9c6117afa9d5dd92f4ac42a06cf2ce491a988e5c6ed7a6e536f8f1746081f4944bc6d473ccd16390fea27fe ) msys_package( - URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst" + URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst" NAME mingw-w64-x86_64-libwinpthread - VERSION git-8.0.0.5906.c9a21571-1 + VERSION git-9.0.0.6373.5be8fcd83-1 ANY ZST REPO mingw/x86_64 - SHA512 a6969a5db1c55ba458c1a047d0a2a9d2db6cc24266ea47f740598b149a601995d2de734a0984ac5e57ee611d5982cbc03fd6fc0f498435e8d6401bf15724caad + SHA512 a2c9e60d23b1310a6cec1fadd2b15a8c07223f3fe90d41b1579e9fc27ee2b0b408456291a55fad54a156e6a247efc20f6fcc247cc567e64fe190938aa3b672e9 ) if(PACKAGES) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index dc8fb668ec5355..1677fc382af342 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -441,16 +441,16 @@ function(vcpkg_find_acquire_program VAR) set(VERSION_CMD --version) elseif(CMAKE_HOST_WIN32) if(NOT EXISTS "${PKGCONFIG}") - set(VERSION 0.29.2-2) - set(LIBWINPTHREAD_VERSION git-8.0.0.5906.c9a21571-1) + set(VERSION 0.29.2-3) + set(LIBWINPTHREAD_VERSION git-9.0.0.6373.5be8fcd83-1) vcpkg_acquire_msys( PKGCONFIG_ROOT NO_DEFAULT_PACKAGES DIRECT_PACKAGES "https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-${VERSION}-any.pkg.tar.zst" - 54f8dad3b1a36a4515db47825a3214fbd2bd82f604aec72e7fb8d79068095fda3c836fb2296acd308522d6e12ce15f69e0c26dcf4eb0681fd105d057d912cdb7 + 0c086bf306b6a18988cc982b3c3828c4d922a1b60fd24e17c3bead4e296ee6de48ce148bc6f9214af98be6a86cb39c37003d2dcb6561800fdf7d0d1028cf73a4 "https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-${LIBWINPTHREAD_VERSION}-any.pkg.tar.zst" - 2c3d9e6b2eee6a4c16fd69ddfadb6e2dc7f31156627d85845c523ac85e5c585d4cfa978659b1fe2ec823d44ef57bc2b92a6127618ff1a8d7505458b794f3f01c + c89c27b5afe4cf5fdaaa354544f070c45ace5e9d2f2ebb4b956a148f61681f050e67976894e6f52e42e708dadbf730fee176ac9add3c9864c21249034c342810 ) endif() set(${VAR} "${PKGCONFIG_ROOT}/mingw32/bin/pkg-config.exe" PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_find_fortran.cmake b/scripts/cmake/vcpkg_find_fortran.cmake index fd359d0eeb3f3e..816514704a5f52 100644 --- a/scripts/cmake/vcpkg_find_fortran.cmake +++ b/scripts/cmake/vcpkg_find_fortran.cmake @@ -37,10 +37,10 @@ function(vcpkg_find_fortran additional_cmake_args_out) 113d8b3b155ea537be8b99688d454f781d70c67c810c2643bc02b83b332d99bfbf3a7fcada6b927fda67ef02cf968d4fdf930466c5909c4338bda64f1f3f483e "https://repo.msys2.org/mingw/i686/mingw-w64-i686-gmp-6.2.0-1-any.pkg.tar.xz" 37747f3f373ebff1a493f5dec099f8cd6d5abdc2254d9cd68a103ad7ba44a81a9a97ccaba76eaee427b4d67b2becb655ee2c379c2e563c8051b6708431e3c588 - "https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst" - 2c3d9e6b2eee6a4c16fd69ddfadb6e2dc7f31156627d85845c523ac85e5c585d4cfa978659b1fe2ec823d44ef57bc2b92a6127618ff1a8d7505458b794f3f01c - "https://repo.msys2.org/mingw/i686/mingw-w64-i686-winpthreads-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst" - e87ad4f4071c6b5bba3b13a85abf6657bb494b73c57ebe65bc5a92e2cef1d9de354e6858d1338ee72809e3dc742ba69ce090aaad4560ae1d3479a61dbebf03c6 + "https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst" + c89c27b5afe4cf5fdaaa354544f070c45ace5e9d2f2ebb4b956a148f61681f050e67976894e6f52e42e708dadbf730fee176ac9add3c9864c21249034c342810 + "https://repo.msys2.org/mingw/i686/mingw-w64-i686-winpthreads-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst" + 85980183879da0d0ea74b9ad1fdfb09e5ed9d2e2212877d47d0f621ce721566e205be0b1913a643d0a95b256441e0bafd803fa9c848a8203dffd7d72109e32c2 "https://repo.msys2.org/mingw/i686/mingw-w64-i686-mpc-1.1.0-1-any.pkg.tar.xz" d236b815ec3cf569d24d96a386eca9f69a2b1e8af18e96c3f1e5a4d68a3598d32768c7fb3c92207ecffe531259822c1a421350949f2ffabd8ee813654f1af864 "https://repo.msys2.org/mingw/i686/mingw-w64-i686-mpfr-4.1.0-2-any.pkg.tar.zst" @@ -75,10 +75,10 @@ function(vcpkg_find_fortran additional_cmake_args_out) d17eff08c83d08ef020d999a2ead0d25036ada1c1bf6ed7c02bad9b56840ee5a3304acd790d86f52b83b09c1e788f0cecdf7254dc6760c3c7e478f65882cd32d "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gmp-6.2.0-1-any.pkg.tar.xz" 0b22b7363e27cec706eb79ee0c45b5fe7088a5ca69e0868e7366481ed2ea9b3f6623d340cebba0b5ed3d79e4dfc7cf15f53530eb260c6d4057bfc3d92eb8c7bc - "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst" - a6969a5db1c55ba458c1a047d0a2a9d2db6cc24266ea47f740598b149a601995d2de734a0984ac5e57ee611d5982cbc03fd6fc0f498435e8d6401bf15724caad - "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-winpthreads-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst" - 87ae090a8de855de5580f158f4007f88d6dad341429620685dc736be55b1f060487552040327a76003618e214a11c1f8e5105ca2c7abe164908121627449d679 + "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst" + a2c9e60d23b1310a6cec1fadd2b15a8c07223f3fe90d41b1579e9fc27ee2b0b408456291a55fad54a156e6a247efc20f6fcc247cc567e64fe190938aa3b672e9 + "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-winpthreads-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst" + be03433e6006166e5b4794f2a01730cdb6c9f19fa96bd10a8bc50cf06ad389cbc66d44ea3eda46f53c3b2c89e2fc86aec21a372828e9527b24480c87ed88348c "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-mpc-1.1.0-1-any.pkg.tar.xz" db075a1406690935db5780af293660385f56699881a1b2cd25ab252183643d71d646b0dadf1e34174df8f0744d51ce8b56dccd719e049efcaf9b7e08e80a7ef6 "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-mpfr-4.1.0-2-any.pkg.tar.zst" diff --git a/scripts/cmake/vcpkg_list.cmake b/scripts/cmake/vcpkg_list.cmake new file mode 100644 index 00000000000000..d7fa0fe5bfe32d --- /dev/null +++ b/scripts/cmake/vcpkg_list.cmake @@ -0,0 +1,165 @@ +macro(z_vcpkg_list_escape_once_more lst) + string(REPLACE [[\;]] [[\\;]] "${lst}" "${${lst}}") +endmacro() + +function(vcpkg_list) + # NOTE: as this function replaces an existing CMake command, + # it does not use cmake_parse_arguments + + # vcpkg_list( ...) + # A0 A1 + + if(ARGC LESS "2") + message(FATAL_ERROR "vcpkg_list requires at least two arguments.") + endif() + + if(ARGV1 MATCHES "^ARGV([0-9]*)$|^ARG[CN]$|^CMAKE_CURRENT_FUNCTION") + message(FATAL_ERROR "vcpkg_list does not support the list_var being ${ARGV1}. + Please use a different variable name.") + endif() + + set(list "${${ARGV1}}") + set(operation "${ARGV0}") + set(list_var "${ARGV1}") + + if(operation STREQUAL "SET") + z_vcpkg_function_arguments(args 2) + set("${list_var}" "${args}" PARENT_SCOPE) + return() + endif() + + # Normal reading functions + if(operation STREQUAL "LENGTH") + # vcpkg_list(LENGTH ) + # A0 A1 A2 + if(NOT ARGC EQUAL "3") + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires two arguments.") + endif() + list(LENGTH list out) + set("${ARGV2}" "${out}" PARENT_SCOPE) + return() + endif() + if(operation MATCHES "^(GET|JOIN|FIND)$") + # vcpkg_list( ) + # A0 A1 A2 A3 + if(NOT ARGC EQUAL "4") + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires three arguments.") + endif() + if(operation STREQUAL "GET") + list(LENGTH list length) + if(length EQUAL "0") + message(FATAL_ERROR "vcpkg_list GET given empty list") + elseif(ARGV2 GREATER_EQUAL length OR ARGV2 LESS "-${length}") + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} is not in range") + endif() + endif() + list("${operation}" list "${ARGV2}" out) + set("${ARGV3}" "${out}" PARENT_SCOPE) + return() + endif() + if(operation STREQUAL "SUBLIST") + # vcpkg_list(SUBLIST ) + # A0 A1 A2 A3 A4 + if(NOT ARGC EQUAL "5") + message(FATAL_ERROR "vcpkg_list sub-command SUBLIST requires four arguments.") + endif() + list(LENGTH list length) + if(ARGV2 LESS "0" OR (ARGV2 GREATER_EQUAL length AND NOT ARGV2 EQUAL "0")) + message(FATAL_ERROR "vcpkg_list begin index: ${ARGV2} is out of range") + endif() + z_vcpkg_list_escape_once_more(list) + list(SUBLIST list "${ARGV2}" "${ARGV3}" out) + set("${ARGV4}" "${out}" PARENT_SCOPE) + return() + endif() + + # modification functions + + if(operation MATCHES "^(APPEND|PREPEND)$") + # vcpkg_list( [...]) + # A0 A1 A2... + + # if ARGC <= 2, then we don't have to do anything + if(ARGC GREATER 2) + z_vcpkg_function_arguments(args 2) + if(list STREQUAL "") + set("${list_var}" "${args}" PARENT_SCOPE) + elseif(operation STREQUAL "APPEND") + set("${list_var}" "${list};${args}" PARENT_SCOPE) + else() + set("${list_var}" "${args};${list}" PARENT_SCOPE) + endif() + endif() + return() + endif() + if(operation STREQUAL "INSERT") + # vcpkg_list(INSERT [...]) + # A0 A1 A2 A3... + + list(LENGTH list length) + if(ARGV2 LESS "-{$length}" OR ARGV2 GREATER length) + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} out of range") + endif() + if(ARGC GREATER 3) + # list(LENGTH) is one of the few subcommands that's fine + list(LENGTH list length) + if(ARGV2 LESS "0") + math(EXPR ARGV2 "${length} + ${ARGV2}") + endif() + if(ARGV2 LESS "0" OR ARGV2 GREATER length) + message(FATAL_ERROR "list index: ${ARGV2} out of range (-${length}, ${length})") + endif() + + z_vcpkg_function_arguments(args 3) + if(list STREQUAL "") + set("${list_var}" "${args}" PARENT_SCOPE) + elseif(ARGV2 EQUAL "0") + set("${list_var}" "${args};${list}" PARENT_SCOPE) + elseif(ARGV2 EQUAL length) + set("${list_var}" "${list};${args}" PARENT_SCOPE) + else() + vcpkg_list(SUBLIST list 0 "${ARGV2}" list_start) + vcpkg_list(SUBLIST list "${ARGV2}" -1 list_end) + set("${list_var}" "${list_start};${args};${list_end}" PARENT_SCOPE) + endif() + elseif(ARGC LESS 3) + message(FATAL_ERROR "vcpkg_list sub-command INSERT requires at least two arguments.") + endif() + return() + endif() + + if(operation MATCHES "^(POP_BACK|POP_FRONT|REVERSE|REMOVE_DUPLICATES)$") + # vcpkg_list( ) + # A0 A1 + if(NOT ARGC EQUAL 2) + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires one argument.") + endif() + z_vcpkg_list_escape_once_more(list) + list("${operation}" list) + set("${list_var}" "${list}" PARENT_SCOPE) + return() + endif() + + if(operation MATCHES "^(REMOVE_AT|REMOVE_ITEM)$") + # vcpkg_list( ) + # A0 A1 A2 + if(NOT ARGC EQUAL 3) + message(FATAL_ERROR "vcpkg_list sub-command ${operation} requires two arguments.") + endif() + if(operation STREQUAL "REMOVE_AT") + list(LENGTH list length) + if(ARGV2 GREATER_EQUAL length OR ARGV2 LESS "-${length}") + message(FATAL_ERROR "vcpkg_list index: ${ARGV2} out of range") + endif() + endif() + + z_vcpkg_list_escape_once_more(list) + string(REPLACE [[;]] [[\;]] ARGV2 "${ARGV2}") + + list("${operation}" list "${ARGV2}") + set("${list_var}" "${list}" PARENT_SCOPE) + return() + endif() + + message(FATAL_ERROR "vcpkg_list sub-command ${operation} is not yet implemented.") +endfunction() diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 4adb481493abde..5c434605d8843e 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -133,6 +133,7 @@ if(CMD MATCHES "^BUILD$") include("${SCRIPTS}/cmake/vcpkg_install_nmake.cmake") include("${SCRIPTS}/cmake/vcpkg_install_qmake.cmake") include("${SCRIPTS}/cmake/vcpkg_internal_get_cmake_vars.cmake") + include("${SCRIPTS}/cmake/vcpkg_list.cmake") include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake") include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake")