From dfc03cbd2721a66d4909c79923e413ccdd2ce457 Mon Sep 17 00:00:00 2001 From: glenrgordon <18452241+glenrgordon@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:18:40 -0500 Subject: [PATCH] [antlr4] Update to 4.13 (#32625) --- ports/antlr4/export_guid.patch | 22 ----- ports/antlr4/fix_build_4.11.1.patch | 93 ------------------- ports/antlr4/portfile.cmake | 20 ++-- .../set-export-macro-define-as-private.patch | 26 +++--- ports/antlr4/vcpkg.json | 3 +- versions/a-/antlr4.json | 5 + versions/baseline.json | 4 +- 7 files changed, 30 insertions(+), 143 deletions(-) delete mode 100644 ports/antlr4/export_guid.patch delete mode 100644 ports/antlr4/fix_build_4.11.1.patch diff --git a/ports/antlr4/export_guid.patch b/ports/antlr4/export_guid.patch deleted file mode 100644 index 053a6e2361..0000000000 --- a/ports/antlr4/export_guid.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -urN a/runtime/src/support/Guid.h b/runtime/src/support/Guid.h ---- a/runtime/src/support/Guid.h -+++ b/runtime/src/support/Guid.h -@@ -42,7 +42,7 @@ namespace antlrcpp { - // 16 byte value that can be passed around by value. It also supports - // conversion to string (via the stream operator <<) and conversion from a - // string via constructor. --class Guid final { -+class ANTLR4CPP_PUBLIC Guid final { - public: - using size_type = typename std::array::size_type; - using pointer = typename std::array::pointer; -@@ -131,7 +131,7 @@ private: - // function would no longer be cross-platform if we parameterized the android - // version. Instead, construction of the GuidGenerator may be different on - // each platform, but the use of newGuid is uniform. --class GuidGenerator final { -+class ANTLR4CPP_PUBLIC GuidGenerator final { - public: - #ifdef GUID_ANDROID - GuidGenerator(JNIEnv *env); - diff --git a/ports/antlr4/fix_build_4.11.1.patch b/ports/antlr4/fix_build_4.11.1.patch deleted file mode 100644 index d3f4b352bd..0000000000 --- a/ports/antlr4/fix_build_4.11.1.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt -index a4e4d1c..19cc21c 100644 ---- a/runtime/Cpp/runtime/CMakeLists.txt -+++ b/runtime/Cpp/runtime/CMakeLists.txt -@@ -25,15 +25,21 @@ file(GLOB libantlrcpp_SRC - "${PROJECT_SOURCE_DIR}/runtime/src/tree/xpath/*.cpp" - ) - -+if(BUILD_SHARED_LIBS) - add_library(antlr4_shared SHARED ${libantlrcpp_SRC}) -+else() - add_library(antlr4_static STATIC ${libantlrcpp_SRC}) -+endif() - - # Make sure to link against threads (pthreads) library in order to be able to - # make use of std::call_once in the code without producing runtime errors - # (see also https://github.com/antlr/antlr4/issues/3708 and/or https://stackoverflow.com/q/51584960). - find_package(Threads REQUIRED) -+if(BUILD_SHARED_LIBS) - target_link_libraries(antlr4_shared Threads::Threads) -+else() - target_link_libraries(antlr4_static Threads::Threads) -+endif() - - if (ANTLR_BUILD_CPP_TESTS) - include(FetchContent) -@@ -70,8 +76,11 @@ if (ANTLR_BUILD_CPP_TESTS) - endif() - - if(APPLE) -+ if(BUILD_SHARED_LIBS) - target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) -+ else() - target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) -+ endif() - endif() - - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") -@@ -93,26 +102,32 @@ set(static_lib_suffix "") - - if (WIN32) - set(static_lib_suffix "-static") -+ if(BUILD_SHARED_LIBS) - target_compile_definitions(antlr4_shared PUBLIC ANTLR4CPP_EXPORTS) -+ else() - target_compile_definitions(antlr4_static PUBLIC ANTLR4CPP_STATIC) -+ endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(extra_share_compile_flags "-MP /wd4251") - set(extra_static_compile_flags "-MP") - endif() - endif() - -+if(BUILD_SHARED_LIBS) - set_target_properties(antlr4_shared - PROPERTIES VERSION ${ANTLR_VERSION} - SOVERSION ${ANTLR_VERSION} - OUTPUT_NAME antlr4-runtime - COMPILE_FLAGS "${disabled_compile_warnings} ${extra_share_compile_flags}") - -+else() - set_target_properties(antlr4_static - PROPERTIES VERSION ${ANTLR_VERSION} - SOVERSION ${ANTLR_VERSION} - OUTPUT_NAME "antlr4-runtime${static_lib_suffix}" - COMPILE_PDB_NAME "antlr4-runtime${static_lib_suffix}" - COMPILE_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}") -+endif() - - if (ANTLR_BUILD_CPP_TESTS) - # Copy the generated binaries to dist folder (required by test suite) -@@ -130,18 +145,21 @@ if (ANTLR_BUILD_CPP_TESTS) - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_HOME_DIRECTORY}/dist) - endif() - -+if(BUILD_SHARED_LIBS) - install(TARGETS antlr4_shared - EXPORT antlr4-targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - -+else() - install(TARGETS antlr4_static - EXPORT antlr4-targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - -+endif() - install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/" - DESTINATION "include/antlr4-runtime" - COMPONENT dev diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake index 81e4164485..b5529f3ea0 100644 --- a/ports/antlr4/portfile.cmake +++ b/ports/antlr4/portfile.cmake @@ -1,13 +1,10 @@ -vcpkg_minimum_required(VERSION 2022-10-12) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO antlr/antlr4 - HEAD_REF master - REF "v${VERSION}" - SHA512 a52356410c95ec6d7128b856dcf4c20a17cdd041270d2c4d700ef02ea715c87a00a87c2ad560277424b300435c6e9b196c8bc9c9f50ae5b6804d8214b4d397d0 + HEAD_REF dev + REF "${VERSION}" + SHA512 947ecca28712aa4dd98d7b7e0753e91881e55642f7951ca65a576b94db87440767a1b93d08e82db69ad527ee28bf89f0b2f9c0aaa604a999a7e48c163764ee12 PATCHES - fix_build_4.11.1.patch set-export-macro-define-as-private.patch ) @@ -15,15 +12,16 @@ set(RUNTIME_PATH "${SOURCE_PATH}/runtime/Cpp") message(INFO "Configure at '${RUNTIME_PATH}'") +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) + vcpkg_cmake_configure( SOURCE_PATH "${RUNTIME_PATH}" OPTIONS + -DANTLR_BUILD_STATIC=${BUILD_STATIC} + -DANTLR_BUILD_SHARED=${BUILD_SHARED} -DANTLR4_INSTALL=ON -DANTLR_BUILD_CPP_TESTS=OFF - OPTIONS_DEBUG - "-DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/dist" - OPTIONS_RELEASE - "-DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/dist" ) vcpkg_cmake_install() @@ -34,4 +32,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_ vcpkg_copy_pdbs() -file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/ports/antlr4/set-export-macro-define-as-private.patch b/ports/antlr4/set-export-macro-define-as-private.patch index 91102a35ba..c8c774f516 100644 --- a/ports/antlr4/set-export-macro-define-as-private.patch +++ b/ports/antlr4/set-export-macro-define-as-private.patch @@ -1,13 +1,13 @@ -diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt -index 19cc21c..2a33fe9 100644 ---- a/runtime/Cpp/runtime/CMakeLists.txt -+++ b/runtime/Cpp/runtime/CMakeLists.txt -@@ -103,7 +103,7 @@ set(static_lib_suffix "") - if (WIN32) - set(static_lib_suffix "-static") - if(BUILD_SHARED_LIBS) -- target_compile_definitions(antlr4_shared PUBLIC ANTLR4CPP_EXPORTS) -+ target_compile_definitions(antlr4_shared PRIVATE ANTLR4CPP_EXPORTS) - else() - target_compile_definitions(antlr4_static PUBLIC ANTLR4CPP_STATIC) - endif() +diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt +index 86fdab9..97486fb 100644 +--- a/runtime/Cpp/runtime/CMakeLists.txt ++++ b/runtime/Cpp/runtime/CMakeLists.txt +@@ -120,7 +120,7 @@ set(static_lib_suffix "") + if (WIN32) + set(static_lib_suffix "-static") + if (TARGET antlr4_shared) +- target_compile_definitions(antlr4_shared PUBLIC ANTLR4CPP_EXPORTS) ++ target_compile_definitions(antlr4_shared PRIVATE ANTLR4CPP_EXPORTS) + endif() + if (TARGET antlr4_static) + target_compile_definitions(antlr4_static PUBLIC ANTLR4CPP_STATIC) diff --git a/ports/antlr4/vcpkg.json b/ports/antlr4/vcpkg.json index 185424b77a..e1964c98d2 100644 --- a/ports/antlr4/vcpkg.json +++ b/ports/antlr4/vcpkg.json @@ -1,7 +1,6 @@ { "name": "antlr4", - "version": "4.11.1", - "port-version": 1, + "version": "4.13.0", "description": "ANother Tool for Language Recognition", "homepage": "https://www.antlr.org", "license": "BSD-3-Clause", diff --git a/versions/a-/antlr4.json b/versions/a-/antlr4.json index b155b9d100..33c89444ff 100644 --- a/versions/a-/antlr4.json +++ b/versions/a-/antlr4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1fd51b053d31e5215682e6c2970aca92e24d488b", + "version": "4.13.0", + "port-version": 0 + }, { "git-tree": "162afe92eab004d57c6b0c972ea5e9b371ccb23a", "version": "4.11.1", diff --git a/versions/baseline.json b/versions/baseline.json index 20648d6654..3277a00a24 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -129,8 +129,8 @@ "port-version": 0 }, "antlr4": { - "baseline": "4.11.1", - "port-version": 1 + "baseline": "4.13.0", + "port-version": 0 }, "any-lite": { "baseline": "0.4.0",