Skip to content

Commit

Permalink
[luasec] Add unix support for luasec
Browse files Browse the repository at this point in the history
Static linking cannot work on any platform due to the conflict
with luasocket.

There is a PR against luasocket that would resolve the situation but
it has not been merged in a number of years:
lunarmodules/luasocket#346

Also change the upstream repo to lunarmodules since it was moved.
  • Loading branch information
TheCycoONE committed Mar 13, 2024
1 parent 72c3812 commit b770a57
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
18 changes: 13 additions & 5 deletions ports/luasec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ set(LUASEC_LIBRARIES
${LUA_LIBRARY}
OpenSSL::SSL
OpenSSL::Crypto
OpenSSL::applink
ws2_32)
OpenSSL::applink)
if(WIN32)
set(PLATFORM_LIBRARIES ws2_32)
endif()

add_library(lua-ssl
src/config.c
Expand All @@ -22,11 +24,17 @@ add_library(lua-ssl
src/options.c
src/luasocket/buffer.c
src/luasocket/io.c
src/luasocket/timeout.c
src/luasocket/wsocket.c)
src/luasocket/timeout.c)
if(WIN32)
target_sources(lua-ssl PRIVATE
src/luasocket/wsocket.c)
else()
target_sources(lua-ssl PRIVATE
src/luasocket/usocket.c)
endif()

target_include_directories(lua-ssl PRIVATE ${LUASEC_INCLUDES})
target_link_libraries(lua-ssl PRIVATE ${LUASEC_LIBRARIES})
target_link_libraries(lua-ssl PRIVATE ${LUASEC_LIBRARIES} ${PLATFORM_LIBRARIES})
set_target_properties(lua-ssl PROPERTIES PREFIX "")

install(TARGETS lua-ssl
Expand Down
7 changes: 2 additions & 5 deletions ports/luasec/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@

if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
endif()
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO brunoos/luasec
REPO lunarmodules/luasec
REF "v${VERSION}"
SHA512 8f0c4b5ff87c024685b23770e1d342467554b8dc19a1704076e184d9e84b966f171091c31d1da135ab009e850275adc2bf2720fc9f32c83ac23f0a42f13d311f
HEAD_REF master
Expand Down
4 changes: 2 additions & 2 deletions ports/luasec/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "luasec",
"version": "1.3.2",
"port-version": 1,
"maintainers": "Stephen Baker <[email protected]>",
"description": "LuaSec depends on OpenSSL, and integrates with LuaSocket to make it easy to add secure connections to any Lua applications or scripts.",
"homepage": "https://github.com/brunoos/luasec",
"homepage": "https://github.com/lunarmodules/luasec",
"license": "MIT",
"supports": "!(windows & static)",
"dependencies": [
"lua",
"luasocket",
Expand Down

0 comments on commit b770a57

Please sign in to comment.