diff --git a/ports/getopt-win32/CMakeLists.txt b/ports/getopt-win32/CMakeLists.txt deleted file mode 100644 index 5bf9b11c8d..0000000000 --- a/ports/getopt-win32/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -project(getopt-win32 C) - -if(BUILD_SHARED_LIBS) - add_definitions(-DEXPORTS_GETOPT) -else() - add_definitions(-DSTATIC_GETOPT) -endif() - -add_library(getopt getopt.c) - -TARGET_INCLUDE_DIRECTORIES(getopt INTERFACE $) - -install( - TARGETS getopt - EXPORT unofficial-getopt-win32 - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include -) - -install( - EXPORT unofficial-getopt-win32 - NAMESPACE unofficial::getopt-win32:: - DESTINATION share/unofficial-getopt-win32 - FILE unofficial-getopt-win32-config.cmake -) diff --git a/ports/getopt-win32/portfile.cmake b/ports/getopt-win32/portfile.cmake index 5b1eb8f6d4..9becafe1d7 100644 --- a/ports/getopt-win32/portfile.cmake +++ b/ports/getopt-win32/portfile.cmake @@ -1,34 +1,35 @@ +set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS "enabled") + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO xiaozhuai/getopt-win32 - REF b69a586f0b1aa37b77c3cf0a9dedba1900007678 - SHA512 6e52b6f198073e85b3a29a2fe21435c591fce02c68cb8cf9b546791dd1197e9b91dd9104af449071b4a1d1485817a483f1989a2e585c2d0470cfd079290fe155 - HEAD_REF master + REPO ludvikjerabek/getopt-win + REF v${VERSION} + SHA512 9ca4e7ed7a1fe7bad9d9ef91b5e65c18a716f4c999818e3dd4f644fc861e1ae12e64255c27f12c0df3b1e44757d3d36c068682dd86d184c6f957b2cabda7bbf3 + HEAD_REF getopt_glibc_2.42_port + PATCHES + static-output-name.diff ) -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS) -vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS} + -DBUILD_TESTING=OFF +) vcpkg_cmake_install() -vcpkg_fixup_pkgconfig() - -file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/getopt") if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_replace_string( - "${CURRENT_PACKAGES_DIR}/include/getopt.h" - "defined(STATIC_GETOPT)" - "1" - ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/getopt.h" "defined(STATIC_GETOPT)" "1") endif() -vcpkg_cmake_config_fixup( - CONFIG_PATH "share/unofficial-getopt-win32" - PACKAGE_NAME "unofficial-getopt-win32" -) - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# Legacy polyfill +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-getopt-win32-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-getopt-win32") -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS "enabled") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/getopt-win32/static-output-name.diff b/ports/getopt-win32/static-output-name.diff new file mode 100644 index 0000000000..c5d12aea5f --- /dev/null +++ b/ports/getopt-win32/static-output-name.diff @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1267606..1e4946f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,7 +51,7 @@ if(BUILD_STATIC_LIBS) + $ + ) + set_target_properties(getopt_static PROPERTIES +- OUTPUT_NAME getopt_static ++ OUTPUT_NAME getopt + PUBLIC_HEADER ${GETOPT_HDR} + VERSION ${PROJECT_VERSION} + ) diff --git a/ports/getopt-win32/unofficial-getopt-win32-config.cmake b/ports/getopt-win32/unofficial-getopt-win32-config.cmake new file mode 100644 index 0000000000..f9753e94b3 --- /dev/null +++ b/ports/getopt-win32/unofficial-getopt-win32-config.cmake @@ -0,0 +1,12 @@ +file(READ "${CMAKE_CURRENT_LIST_DIR}/../getopt-win32/usage" usage) +message(WARNING "find_package(unofficial-getopt-win32) is deprecated.\n${usage}") + +include(CMakeFindDependencyMacro) +find_dependency(getopt CONFIG) +if(NOT TARGET unofficial::getopt-win32::getopt) + if(TARGET getopt::getopt_static) + add_library(unofficial::getopt-win32::getopt ALIAS getopt::getopt_static) + else() + add_library(unofficial::getopt-win32::getopt ALIAS getopt::getopt_shared) + endif() +endif() diff --git a/ports/getopt-win32/usage b/ports/getopt-win32/usage index 42843a09cf..97bae6c2e2 100644 --- a/ports/getopt-win32/usage +++ b/ports/getopt-win32/usage @@ -1,4 +1,4 @@ getopt-win32 provides CMake targets: - find_package(unofficial-getopt-win32 REQUIRED) - target_link_libraries(main PRIVATE unofficial::getopt-win32::getopt) + find_package(getopt CONFIG REQUIRED) + target_link_libraries(main PRIVATE $,getopt::getopt_shared,getopt::getopt_static>) diff --git a/ports/getopt-win32/vcpkg.json b/ports/getopt-win32/vcpkg.json index 7429396920..95222c2cec 100644 --- a/ports/getopt-win32/vcpkg.json +++ b/ports/getopt-win32/vcpkg.json @@ -1,8 +1,8 @@ { "name": "getopt-win32", - "version": "1.1.0.20220925", - "description": "An implementation of getopt.", - "homepage": "https://www.codeproject.com/Articles/157001/Full-getopt-Port-for-Unicode-and-Multibyte-Microso/", + "version": "2.42.0", + "description": "Full getopt port for unicode and multibyte windows applications", + "homepage": "https://github.com/ludvikjerabek/getopt-win/", "license": "LGPL-3.0-only", "supports": "windows & !mingw", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 98dade1162..72fd6c9850 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3273,7 +3273,7 @@ "port-version": 3 }, "getopt-win32": { - "baseline": "1.1.0.20220925", + "baseline": "2.42.0", "port-version": 0 }, "gettext": { diff --git a/versions/g-/getopt-win32.json b/versions/g-/getopt-win32.json index cc974aa837..04c1cac29b 100644 --- a/versions/g-/getopt-win32.json +++ b/versions/g-/getopt-win32.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c96f116944f60f80c7288bbeefb7521be56c39a1", + "version": "2.42.0", + "port-version": 0 + }, { "git-tree": "d735f424134507a2d87a4ab6d5a8d768ca555dbc", "version": "1.1.0.20220925",