zeek/auxil/vcpkg/ports/otl/portfile.cmake
Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

32 lines
1.1 KiB
CMake

set(OTL_VERSION 40481)
vcpkg_download_distfile(ARCHIVE
URLS "http://otl.sourceforge.net/otlv4_${OTL_VERSION}.zip"
FILENAME "otlv4_${OTL_VERSION}.zip"
SHA512 5e7001dc9f003264db86228cffc0d44ebc6dffabd2e046a37cb58b6d4d59435db1103b95fb719819c6443e822a9263f5e2efc29dbbee463e91277789c955bd98
)
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
NO_REMOVE_ONE_LEVEL
)
file(INSTALL "${SOURCE_PATH}/otlv${OTL_VERSION}.h"
DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}"
RENAME otlv4.h)
file(READ "${SOURCE_PATH}/otlv${OTL_VERSION}.h" copyright_contents)
string(FIND "${copyright_contents}" "#ifndef OTL_H" start_of_source)
if(start_of_source EQUAL "-1")
message(FATAL_ERROR "Could not find start of source; the header file has changed in a way that we cannot get the license text.")
endif()
string(SUBSTRING "${copyright_contents}" 0 "${start_of_source}" copyright_contents)
string(REGEX REPLACE "// ?" "" copyright_contents "${copyright_contents}")
string(REGEX REPLACE "=+\n" "" copyright_contents "${copyright_contents}")
file(WRITE
"${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright"
"${copyright_contents}"
)