aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPark DongHa <luncliff@gmail.com>2021-04-20 09:13:08 +0900
committerGitHub <noreply@github.com>2021-04-19 17:13:08 -0700
commit1045e88e429a6ed5a1fc8cb6cc0f6c695908344f (patch)
tree32cffed1fadde359b87d4a54a475a123960aaef9
parent6ba281209fb8165d4559e92b1eca17d49dbc1d6a (diff)
downloadvcpkg-1045e88e429a6ed5a1fc8cb6cc0f6c695908344f.tar.gz
vcpkg-1045e88e429a6ed5a1fc8cb6cc0f6c695908344f.zip
[lua] support iOS triplets (#16107)
* [lua] support iOS triplets * separate interpreter/compiler to lua[tools] feature * update git-tree SHA * [lua] revert feature separation * [lua] update port SHA * [lua] make 'tools' default-feature * set `ENABLE_LUA_CPP` for cmake wrapper * [lua] fix after collision * Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * [lua] import TargetConditionals for apple platform * Update ports/lua/vcpkg.json Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * [lua] remove negations for 'tool' config use FEATURES instread of INVERTED_FEATURES to prevent confusions Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
-rw-r--r--ports/lua/CMakeLists.txt2
-rw-r--r--ports/lua/CONTROL7
-rw-r--r--ports/lua/fix-ios-system.patch29
-rw-r--r--ports/lua/portfile.cmake24
-rw-r--r--ports/lua/vcpkg.json15
-rw-r--r--versions/baseline.json2
-rw-r--r--versions/l-/lua.json5
7 files changed, 67 insertions, 17 deletions
diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt
index 7592a49f3..ff16ff78c 100644
--- a/ports/lua/CMakeLists.txt
+++ b/ports/lua/CMakeLists.txt
@@ -79,7 +79,7 @@ INSTALL ( TARGETS lua
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)
-IF (NOT DEFINED SKIP_INSTALL_TOOLS)
+IF (INSTALL_TOOLS)
ADD_EXECUTABLE ( luac src/luac.c ${SRC_LIBLUA} ) # compiler uses non-exported APIs, so must include sources directly.
ADD_EXECUTABLE ( luai src/lua.c ) # interpreter
TARGET_LINK_LIBRARIES ( luai lua )
diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL
deleted file mode 100644
index 00ec94852..000000000
--- a/ports/lua/CONTROL
+++ /dev/null
@@ -1,7 +0,0 @@
-Source: lua
-Version: 5.4.3
-Homepage: https://www.lua.org
-Description: a powerful, fast, lightweight, embeddable scripting language
-
-Feature: cpp
-Description: Builds lua for C++ linkage. \ No newline at end of file
diff --git a/ports/lua/fix-ios-system.patch b/ports/lua/fix-ios-system.patch
new file mode 100644
index 000000000..3e98ce228
--- /dev/null
+++ b/ports/lua/fix-ios-system.patch
@@ -0,0 +1,29 @@
+diff --git a/src/loslib.c b/src/loslib.c
+index e65e188..3595601 100644
+--- a/src/loslib.c
++++ b/src/loslib.c
+@@ -3,7 +3,9 @@
+ ** Standard Operating System library
+ ** See Copyright Notice in lua.h
+ */
+-
++#if defined(__APPLE__)
++#include <TargetConditionals.h>
++#endif
+ #define loslib_c
+ #define LUA_LIB
+
+@@ -143,7 +145,12 @@ static int os_execute (lua_State *L) {
+ const char *cmd = luaL_optstring(L, 1, NULL);
+ int stat;
+ errno = 0;
+- stat = system(cmd);
++#if defined(__APPLE__) && !TARGET_OS_OSX
++ // system() is __IOS_PROHIBITED, __WATCHOS_PROHIBITED, and __TVOS_PROHIBITED.
++ stat = 127; // error: shell execution failed
++#else
++ stat = system(cmd);
++#endif
+ if (cmd != NULL)
+ return luaL_execresult(L, stat);
+ else {
diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake
index d73e72ad6..11eeac875 100644
--- a/ports/lua/portfile.cmake
+++ b/ports/lua/portfile.cmake
@@ -6,41 +6,49 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
- PATCHES vs2015-impl-c99.patch
+ PATCHES
+ vs2015-impl-c99.patch
+ fix-ios-system.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ tools INSTALL_TOOLS
+)
+if(VCPKG_TARGET_IS_IOS AND "tools" IN_LIST FEATURES)
+ message(FATAL_ERROR "lua[tools] is not supported for iOS platform build")
+endif()
+
+set(ENABLE_LUA_CPP 0)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ OPTIONS_RELEASE
+ ${FEATURE_OPTIONS}
OPTIONS
-DCOMPILE_AS_CPP=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
- -DSKIP_INSTALL_TOOLS=ON
)
-
vcpkg_install_cmake()
-set(ENABLE_LUA_CPP 0)
-if("cpp" IN_LIST FEATURES)
+if("cpp" IN_LIST FEATURES) # lua[cpp] will create lua-c++, which uses C++ name mangling.
set(ENABLE_LUA_CPP 1)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
+ ${FEATURE_OPTIONS}
-DCOMPILE_AS_CPP=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
- -DSKIP_INSTALL_TOOLS=ON
)
-
vcpkg_install_cmake()
endif()
vcpkg_copy_pdbs()
-
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
diff --git a/ports/lua/vcpkg.json b/ports/lua/vcpkg.json
new file mode 100644
index 000000000..36dd26376
--- /dev/null
+++ b/ports/lua/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "name": "lua",
+ "version-string": "5.4.3",
+ "port-version": 1,
+ "description": "A powerful, fast, lightweight, embeddable scripting language",
+ "homepage": "https://www.lua.org",
+ "features": {
+ "cpp": {
+ "description": "Builds Lua for C++ linkage"
+ },
+ "tools": {
+ "description": "Builds Lua compiler and interpreter"
+ }
+ }
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index bbeeca261..de2a50a7b 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -3734,7 +3734,7 @@
},
"lua": {
"baseline": "5.4.3",
- "port-version": 0
+ "port-version": 1
},
"luabridge": {
"baseline": "2.6",
diff --git a/versions/l-/lua.json b/versions/l-/lua.json
index a45533a97..fd0f4da29 100644
--- a/versions/l-/lua.json
+++ b/versions/l-/lua.json
@@ -1,6 +1,11 @@
{
"versions": [
{
+ "git-tree": "0e8966273a1a18cf591cf78046d345c74941a37d",
+ "version-string": "5.4.3",
+ "port-version": 1
+ },
+ {
"git-tree": "8a52fbd7ff551d4c1b7e6d308283cfe92ca81758",
"version-string": "5.4.3",
"port-version": 0