mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
[luv] add new port (#26438)
* [luv] add new port libuv bindings for lua * [lua-compat53] add new port * fixup!: bad indentation * refactor: remove superfluous feature desc
This commit is contained in:
14
ports/lua-compat53/portfile.cmake
Normal file
14
ports/lua-compat53/portfile.cmake
Normal file
@@ -0,0 +1,14 @@
|
||||
#header-only library
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO lunarmodules/lua-compat-5.3
|
||||
REF e245d3a18957e43ef902a59a72c8902e2e4435b9 # v0.10
|
||||
SHA512 541309275f464f611f7c402ec74c84192cbc8209f5624ee96961caaf9a0bc44f8486a2f4be3a25fb0123ce600b6d830489c91bbfddeda09e9cdf2df01beea950
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/c-api/compat-5.3.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
file(INSTALL ${SOURCE_PATH}/c-api/compat-5.3.c DESTINATION ${CURRENT_PACKAGES_DIR}/include)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
4
ports/lua-compat53/usage
Normal file
4
ports/lua-compat53/usage
Normal file
@@ -0,0 +1,4 @@
|
||||
The package lua-compat53 provides a header only C-API and can be used from CMake via:
|
||||
|
||||
find_path(LUA_COMPAT53_INCLUDE_DIRS "compat-5.3.h")
|
||||
target_include_directories(main PRIVATE ${LUA_COMPAT53_INCLUDE_DIRS})
|
||||
17
ports/lua-compat53/vcpkg.json
Normal file
17
ports/lua-compat53/vcpkg.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "lua-compat53",
|
||||
"version": "0.10",
|
||||
"description": "provide Lua-5.3-style C APIs for Lua 5.2 and 5.1",
|
||||
"homepage": "https://github.com/lunarmodules/lua-compat-5.3",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
15
ports/luv/fix-find-libuv.patch
Normal file
15
ports/luv/fix-find-libuv.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e63a431..163bada 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -65,8 +65,8 @@ endif ()
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
if (WITH_SHARED_LIBUV)
|
||||
- find_package(Libuv REQUIRED)
|
||||
- include_directories(${LIBUV_INCLUDE_DIR})
|
||||
+ find_package(libuv CONFIG REQUIRED)
|
||||
+ set(LIBUV_LIBRARIES $<IF:$<TARGET_EXISTS:uv_a>,uv_a,uv>)
|
||||
else (WITH_SHARED_LIBUV)
|
||||
include_directories(deps/libuv/include)
|
||||
add_subdirectory(deps/libuv EXCLUDE_FROM_ALL)
|
||||
28
ports/luv/fix-find-lua-compat53.patch
Normal file
28
ports/luv/fix-find-lua-compat53.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e63a431..1f144c8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -231,13 +231,7 @@ if(APPLE)
|
||||
# )
|
||||
endif()
|
||||
|
||||
-if(NOT LUA_COMPAT53_DIR)
|
||||
- set(LUA_COMPAT53_DIR deps/lua-compat-5.3)
|
||||
-endif()
|
||||
-if(DEFINED ENV{LUA_COMPAT53_DIR})
|
||||
- set(LUA_COMPAT53_DIR $ENV{LUA_COMPAT53_DIR})
|
||||
-endif()
|
||||
-include_directories(${LUA_COMPAT53_DIR}/c-api)
|
||||
+find_path(LUA_COMPAT53_INCLUDE_DIRS "compat-5.3.h")
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DLUA_BUILD_AS_DLL -DLUA_LIB)
|
||||
@@ -263,6 +257,7 @@ foreach(TARGET_NAME ${ACTIVE_TARGETS})
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} ${LIBUV_LIBRARIES})
|
||||
endif()
|
||||
+ target_include_directories(${TARGET_NAME} PRIVATE ${LUA_COMPAT53_INCLUDE_DIRS})
|
||||
endforeach()
|
||||
|
||||
if (NOT LUA)
|
||||
|
||||
33
ports/luv/fix-find-luajit.patch
Normal file
33
ports/luv/fix-find-luajit.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e63a431..841db78 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -125,7 +125,7 @@ else (LUA)
|
||||
# We only link the libs on Windows, so find_package fully succeeding
|
||||
# is only required on Windows
|
||||
if (WIN32 OR CYGWIN)
|
||||
- find_package(LuaJIT REQUIRED)
|
||||
+ find_package(LUAJIT REQUIRED)
|
||||
link_directories(${LUAJIT_LIBRARIES})
|
||||
else()
|
||||
find_package(LuaJIT)
|
||||
diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake
|
||||
index 0d0786e..7121e06 100644
|
||||
--- a/cmake/Modules/FindLuaJIT.cmake
|
||||
+++ b/cmake/Modules/FindLuaJIT.cmake
|
||||
@@ -23,8 +23,12 @@
|
||||
# LUA_VERSION_MINOR - the minor version of Lua
|
||||
# LUA_VERSION_PATCH - the patch version of Lua
|
||||
|
||||
-FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0 luajit-2.1)
|
||||
-FIND_LIBRARY(LUAJIT_LIBRARIES NAMES luajit-5.1 luajit)
|
||||
+FIND_PATH(LUAJIT_INCLUDE_DIR NAMES luajit.h PATH_SUFFIXES luajit-2.0 luajit-2.1 luajit)
|
||||
+set(LUAJIT_LIB_NAMES luajit-5.1 luajit)
|
||||
+if(MSVC)
|
||||
+ list(APPEND LUAJIT_LIB_NAMES lua51)
|
||||
+endif()
|
||||
+FIND_LIBRARY(LUAJIT_LIBRARIES NAMES ${LUAJIT_LIB_NAMES})
|
||||
|
||||
if (LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
|
||||
# At least 5.[012] have different ways to express the version
|
||||
|
||||
26
ports/luv/fix-msvc-build.patch
Normal file
26
ports/luv/fix-msvc-build.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e63a431..aa46c07 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -25,20 +25,6 @@ if (MINGW)
|
||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||
endif (MINGW)
|
||||
|
||||
-if (WIN32)
|
||||
- # replace /MD to /MT to avoid link msvcr*.dll
|
||||
- # this needs to be before add_subdirectory calls so that they inherit the modified flags
|
||||
- set(CompilerFlags
|
||||
- CMAKE_C_FLAGS
|
||||
- CMAKE_C_FLAGS_DEBUG
|
||||
- CMAKE_C_FLAGS_MINSIZEREL
|
||||
- CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
- CMAKE_C_FLAGS_RELEASE)
|
||||
- foreach(CompilerFlag ${CompilerFlags})
|
||||
- string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||
- endforeach()
|
||||
-endif ()
|
||||
-
|
||||
if (NOT WITH_LUA_ENGINE)
|
||||
set(WITH_LUA_ENGINE "LuaJIT"
|
||||
CACHE STRING "Link to LuaJIT or PUC Lua" FORCE)
|
||||
|
||||
35
ports/luv/portfile.cmake
Normal file
35
ports/luv/portfile.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO luvit/luv
|
||||
REF 1f255a7d87cef4a7eb10bd13bbd1e213980e8da2 #v1.44.2
|
||||
SHA512 e9ee9ee6ca8f810c375f3310a119b518da8d15f6e3093aaa6069217f4e3d29a45426cc5e2233b6a8d90876867d9097c938a5b961fb6e46479c62145297f5bb82
|
||||
HEAD_REF master
|
||||
PATCHES fix-find-libuv.patch
|
||||
fix-find-luajit.patch
|
||||
fix-find-lua-compat53.patch
|
||||
fix-msvc-build.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DWITH_SHARED_LIBUV=ON
|
||||
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DLUA_BUILD_TYPE=System
|
||||
-DWITH_LUA_ENGINE=LuaJIT
|
||||
-DUSE_LUAJIT=ON
|
||||
-DBUILD_MODULE=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
24
ports/luv/vcpkg.json
Normal file
24
ports/luv/vcpkg.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "luv",
|
||||
"version-semver": "1.44.2",
|
||||
"description": "Bare libuv bindings for lua",
|
||||
"homepage": "https://github.com/luvit/luv",
|
||||
"license": "Apache-2.0",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libuv",
|
||||
"version>=": "1.44.2"
|
||||
},
|
||||
"lua-compat53",
|
||||
"luajit",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4540,6 +4540,10 @@
|
||||
"baseline": "5.4.4",
|
||||
"port-version": 2
|
||||
},
|
||||
"lua-compat53": {
|
||||
"baseline": "0.10",
|
||||
"port-version": 0
|
||||
},
|
||||
"luabridge": {
|
||||
"baseline": "2.6",
|
||||
"port-version": 1
|
||||
@@ -4568,6 +4572,10 @@
|
||||
"baseline": "2.3.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"luv": {
|
||||
"baseline": "1.44.2",
|
||||
"port-version": 0
|
||||
},
|
||||
"lv2": {
|
||||
"baseline": "1.18.2",
|
||||
"port-version": 1
|
||||
|
||||
9
versions/l-/lua-compat53.json
Normal file
9
versions/l-/lua-compat53.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "3f65429d091c8db2d5dadacce8e6c04ca8939394",
|
||||
"version": "0.10",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
9
versions/l-/luv.json
Normal file
9
versions/l-/luv.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "dfb9cba0c0da80351b575c758df8f2b03048315f",
|
||||
"version-semver": "1.44.2",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user