Add package for lpeg

LPeg (http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html) is an expression
parsing library for lua created by the developer of lua.
This commit is contained in:
Stephen E. Baker 2017-06-07 22:23:17 -04:00
parent 9a698d7088
commit 1653cf4363
5 changed files with 73 additions and 0 deletions

28
ports/lpeg/CMakeLists.txt Normal file
View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.0)
project(lpeg)
if(NOT WIN32)
message(FATAL_ERROR "Written for windows only")
endif()
find_path(LUA_INCLUDE_DIR lua.h PATH_SUFFIXES lua)
find_library(LUA_LIBRARY lua)
set(LPEG_INCLUDES ${LUA_INCLUDE_DIR})
set(LPEG_LIBRARIES ${LUA_LIBRARY})
add_library(lpeg
lpvm.c
lptree.c
lpprint.c
lpcap.c
lpcode.c
lpeg.def)
target_include_directories(lpeg PRIVATE ${LPEG_INCLUDES})
target_link_libraries(lpeg PRIVATE ${LPEG_LIBRARIES})
install(TARGETS lpeg
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES re.lua DESTINATION share/lua)

4
ports/lpeg/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: lpeg
Version: 1.0.1
Description: LPeg is a pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs).
Build-Depends: lua

7
ports/lpeg/COPYRIGHT Normal file
View File

@ -0,0 +1,7 @@
Copyright © 2007-2017 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3
ports/lpeg/lpeg.def Normal file
View File

@ -0,0 +1,3 @@
LIBRARY lpeg
EXPORTS
luaopen_lpeg

31
ports/lpeg/portfile.cmake Normal file
View File

@ -0,0 +1,31 @@
#cmake-only scripts
include(vcpkg_common_functions)
set(LPEG_VER 1.0.1)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lpeg-${LPEG_VER})
vcpkg_download_distfile(ARCHIVE
URLS "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-${LPEG_VER}.tar.gz"
FILENAME "lpeg-${LPEG_VER}.tar.gz"
SHA512 7b43fbee7eff443000986684bc56bba6d2796a31cf860740746c70e155bdea1b62a46b93f97e2747e3ef0f63e965148778ac2985d0f2d83e1e37ec4ebbabf4aa
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/lpeg.def DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
)
vcpkg_install_cmake()
# Remove debug share
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lpeg)
# Allow empty include directory
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)