vcpkg/ports/otl/portfile.cmake
Mengna Li 4c9199d6d3
[otl] update to 4.0.476 ()
* update to 4.0.476

* update
2023-02-14 09:36:49 -08:00

32 lines
1.2 KiB
CMake

set(OTL_VERSION 40476)
vcpkg_download_distfile(ARCHIVE
URLS "http://otl.sourceforge.net/otlv4_${OTL_VERSION}.zip"
FILENAME "otlv4_${OTL_VERSION}-9485a0fe15a7-1.zip"
SHA512 ef43695b4c97d953bd997ba2381ae37ae067efb99a14479e93f502e3ad5d651829a9712bd14698c8663f733114861f6e2ae2277ed0967fad1ac2a068825a9e38
)
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}"
)