diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/tre | |
Diffstat (limited to 'vcpkg/ports/tre')
| -rw-r--r-- | vcpkg/ports/tre/CMakeLists.txt | 49 | ||||
| -rw-r--r-- | vcpkg/ports/tre/fix-config.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/tre/portfile.cmake | 29 | ||||
| -rw-r--r-- | vcpkg/ports/tre/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/tre/vcpkg.json | 18 |
5 files changed, 117 insertions, 0 deletions
diff --git a/vcpkg/ports/tre/CMakeLists.txt b/vcpkg/ports/tre/CMakeLists.txt new file mode 100644 index 0000000..bfef821 --- /dev/null +++ b/vcpkg/ports/tre/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required (VERSION 3.9) +project (tre) + +set (HEADERS + lib/regex.h + include/tre/tre.h + include/tre/tre-config.h +) + +set (SRCS + lib/regcomp.c + lib/regerror.c + lib/regexec.c + lib/tre-ast.c + lib/tre-compile.c + lib/tre-match-approx.c + lib/tre-match-backtrack.c + lib/tre-match-parallel.c + lib/tre-mem.c + lib/tre-parse.c + lib/tre-stack.c + lib/xmalloc.c + win32/tre.def +) + +include_directories(win32 include/tre) +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -DHAVE_CONFIG_H) +if (WIN32) + add_definitions(-DHAVE_MALLOC_H) +endif() +add_library(tre ${SRCS}) + +target_include_directories(tre PUBLIC "$<INSTALL_INTERFACE:include>") + +install( + TARGETS tre + EXPORT unofficial-tre-targets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install( + EXPORT unofficial-tre-targets + NAMESPACE unofficial::tre:: + FILE unofficial-tre-config.cmake + DESTINATION share/unofficial-tre) + +install(FILES ${HEADERS} DESTINATION include/tre) diff --git a/vcpkg/ports/tre/fix-config.patch b/vcpkg/ports/tre/fix-config.patch new file mode 100644 index 0000000..89303ae --- /dev/null +++ b/vcpkg/ports/tre/fix-config.patch @@ -0,0 +1,17 @@ +diff --git a/win32/config.h b/win32/config.h +index 93b8210..db7a9e1 100644 +--- a/win32/config.h ++++ b/win32/config.h +@@ -20,7 +20,6 @@ + /* #undef HAVE_ALLOCA_H */
+
+ /* Define to 1 if you have <malloc.h> and it should be used. */
+-#define HAVE_MALLOC_H 1
+
+ /* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+@@ -180,4 +179,3 @@ + /* Avoid silly warnings about "insecure" functions. */
+ #define _CRT_SECURE_NO_DEPRECATE 1
+
+-#define snprintf sprintf_s
diff --git a/vcpkg/ports/tre/portfile.cmake b/vcpkg/ports/tre/portfile.cmake new file mode 100644 index 0000000..1bb2e7c --- /dev/null +++ b/vcpkg/ports/tre/portfile.cmake @@ -0,0 +1,29 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO laurikari/tre + REF 6fb7206b935b35814c5078c20046dbe065435363 + SHA512 f1d664719eab23b665d71e34ca3d11f8ba49da23ff20dc28f46d4ce30fe155c12208ba7fd212dbeb20a7037e069909f0c2120ce1fc01074656399805e3289a90 + HEAD_REF master + PATCHES + fix-config.patch +) + +if(VCPKG_TARGET_IS_MINGW) + vcpkg_replace_string("${SOURCE_PATH}/win32/tre.def" "tre.dll" "libtre.dll") +endif() + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT}) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/tre/usage b/vcpkg/ports/tre/usage new file mode 100644 index 0000000..df5d666 --- /dev/null +++ b/vcpkg/ports/tre/usage @@ -0,0 +1,4 @@ +tre provides CMake targets:
+
+ find_package(unofficial-tre CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::tre::tre)
diff --git a/vcpkg/ports/tre/vcpkg.json b/vcpkg/ports/tre/vcpkg.json new file mode 100644 index 0000000..e4ce1b2 --- /dev/null +++ b/vcpkg/ports/tre/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "tre", + "version": "0.8.0", + "port-version": 6, + "description": "TRE is a lightweight, robust, and efficient POSIX compliant regexp matching library with some exciting features such as approximate (fuzzy) matching.", + "homepage": "https://github.com/laurikari/tre", + "license": "BSD-2-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |