aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/luv
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/luv')
-rw-r--r--vcpkg/ports/luv/fix-find-libuv.patch15
-rw-r--r--vcpkg/ports/luv/fix-find-lua-compat53.patch28
-rw-r--r--vcpkg/ports/luv/fix-find-luajit.patch33
-rw-r--r--vcpkg/ports/luv/fix-msvc-build.patch26
-rw-r--r--vcpkg/ports/luv/portfile.cmake35
-rw-r--r--vcpkg/ports/luv/vcpkg.json25
6 files changed, 162 insertions, 0 deletions
diff --git a/vcpkg/ports/luv/fix-find-libuv.patch b/vcpkg/ports/luv/fix-find-libuv.patch
new file mode 100644
index 0000000..1a94fc4
--- /dev/null
+++ b/vcpkg/ports/luv/fix-find-libuv.patch
@@ -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:libuv::uv_a>,libuv::uv_a,libuv::uv>)
+ else (WITH_SHARED_LIBUV)
+ include_directories(deps/libuv/include)
+ add_subdirectory(deps/libuv EXCLUDE_FROM_ALL)
diff --git a/vcpkg/ports/luv/fix-find-lua-compat53.patch b/vcpkg/ports/luv/fix-find-lua-compat53.patch
new file mode 100644
index 0000000..c5c4d60
--- /dev/null
+++ b/vcpkg/ports/luv/fix-find-lua-compat53.patch
@@ -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)
+
diff --git a/vcpkg/ports/luv/fix-find-luajit.patch b/vcpkg/ports/luv/fix-find-luajit.patch
new file mode 100644
index 0000000..32eb75f
--- /dev/null
+++ b/vcpkg/ports/luv/fix-find-luajit.patch
@@ -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
+
diff --git a/vcpkg/ports/luv/fix-msvc-build.patch b/vcpkg/ports/luv/fix-msvc-build.patch
new file mode 100644
index 0000000..cdf37b4
--- /dev/null
+++ b/vcpkg/ports/luv/fix-msvc-build.patch
@@ -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)
+
diff --git a/vcpkg/ports/luv/portfile.cmake b/vcpkg/ports/luv/portfile.cmake
new file mode 100644
index 0000000..10870e5
--- /dev/null
+++ b/vcpkg/ports/luv/portfile.cmake
@@ -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)
diff --git a/vcpkg/ports/luv/vcpkg.json b/vcpkg/ports/luv/vcpkg.json
new file mode 100644
index 0000000..69fc5a0
--- /dev/null
+++ b/vcpkg/ports/luv/vcpkg.json
@@ -0,0 +1,25 @@
+{
+ "name": "luv",
+ "version-semver": "1.44.2",
+ "port-version": 1,
+ "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
+ }
+ ]
+}