From b0cfe41eb3831acd2c5049e68e077d00082a765a Mon Sep 17 00:00:00 2001 From: luncliff Date: Mon, 8 Feb 2021 15:30:36 +0900 Subject: [PATCH 01/11] [lua] support iOS triplets * separate interpreter/compiler to lua[tools] feature * update git-tree SHA --- ports/lua/CMakeLists.txt | 2 +- ports/lua/CONTROL | 7 ------- ports/lua/fix-ios-system.patch | 16 +++++++++++++++ ports/lua/portfile.cmake | 37 +++++++++++++++------------------- ports/lua/vcpkg.json | 15 ++++++++++++++ versions/baseline.json | 2 +- versions/l-/lua.json | 5 +++++ 7 files changed, 54 insertions(+), 30 deletions(-) delete mode 100644 ports/lua/CONTROL create mode 100644 ports/lua/fix-ios-system.patch create mode 100644 ports/lua/vcpkg.json diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt index 7592a49f3aecc7..b4eff9d1412100 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 (NOT SKIP_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 ba00f30be20b3e..00000000000000 --- a/ports/lua/CONTROL +++ /dev/null @@ -1,7 +0,0 @@ -Source: lua -Version: 5.4.1 -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 00000000000000..26dfe0804d45fc --- /dev/null +++ b/ports/lua/fix-ios-system.patch @@ -0,0 +1,16 @@ +diff --git a/src/loslib.c b/src/loslib.c +--- a/src/loslib.c ++++ b/src/loslib.c +@@ -143,7 +143,12 @@ static int os_execute (lua_State *L) { + const char *cmd = luaL_optstring(L, 1, NULL); + int stat; + errno = 0; ++#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 0d343cc6f38e6d..77fe4bc5b9b121 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -6,41 +6,36 @@ 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 + cpp COMPILE_AS_CPP + INVERTED_FEATURES + tools SKIP_INSTALL_TOOLS +) +if(VCPKG_TARGET_IS_IOS) + if(FEATURE_OPTIONS MATCHES "-DSKIP_INSTALL_TOOLS=OFF") + message(FATAL_ERROR "lua[tools] is not supported for iOS platform build") + endif() +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DCOMPILE_AS_CPP=OFF + ${FEATURE_OPTIONS} OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON - -DSKIP_INSTALL_TOOLS=ON ) vcpkg_install_cmake() - -set(ENABLE_LUA_CPP 0) -if("cpp" IN_LIST FEATURES) - set(ENABLE_LUA_CPP 1) - vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - 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 00000000000000..a00b4d86c7458e --- /dev/null +++ b/ports/lua/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "lua", + "version-string": "5.4.1", + "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 9dc8cf6dea5629..ef38b6f9abcdb0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3602,7 +3602,7 @@ }, "lua": { "baseline": "5.4.1", - "port-version": 0 + "port-version": 1 }, "luabridge": { "baseline": "2.6", diff --git a/versions/l-/lua.json b/versions/l-/lua.json index cf97ca34ac33f8..1c814459af3fcf 100644 --- a/versions/l-/lua.json +++ b/versions/l-/lua.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "636386cd0e5fadc0564eb4cb1d95ad8aafd3f294", + "version-string": "5.4.1", + "port-version": 1 + }, { "git-tree": "3bf3ea5ddf8760d12d37e7a2e95cb3db3cc51b7f", "version-string": "5.4.1", From c08daedd8f714c746aa8b4d7760cf06b68d3a716 Mon Sep 17 00:00:00 2001 From: luncliff Date: Tue, 9 Feb 2021 11:48:48 +0900 Subject: [PATCH 02/11] [lua] revert feature separation --- ports/lua/portfile.cmake | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 77fe4bc5b9b121..9dfaacf78b2eee 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -15,12 +15,12 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - cpp COMPILE_AS_CPP + # cpp COMPILE_AS_CPP INVERTED_FEATURES tools SKIP_INSTALL_TOOLS ) if(VCPKG_TARGET_IS_IOS) - if(FEATURE_OPTIONS MATCHES "-DSKIP_INSTALL_TOOLS=OFF") + if("tools" IN_LIST FEATURES) message(FATAL_ERROR "lua[tools] is not supported for iOS platform build") endif() endif() @@ -30,11 +30,25 @@ vcpkg_configure_cmake( PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} + -DCOMPILE_AS_CPP=OFF OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON ) - vcpkg_install_cmake() + +if("cpp" IN_LIST FEATURES) # lua[cpp] will create lua-c++, which uses C++ name mangling. + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + ${FEATURE_OPTIONS} + -DCOMPILE_AS_CPP=ON + OPTIONS_DEBUG + -DSKIP_INSTALL_HEADERS=ON + ) + vcpkg_install_cmake() +endif() + vcpkg_copy_pdbs() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/lua) From f94adf3d7fc2e927868552e82d9e5e7da2d7f6c6 Mon Sep 17 00:00:00 2001 From: luncliff Date: Tue, 9 Feb 2021 11:49:33 +0900 Subject: [PATCH 03/11] [lua] update port SHA --- versions/l-/lua.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/lua.json b/versions/l-/lua.json index 1c814459af3fcf..cac5532c3ae3e8 100644 --- a/versions/l-/lua.json +++ b/versions/l-/lua.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "636386cd0e5fadc0564eb4cb1d95ad8aafd3f294", + "git-tree": "b445f38d73eeb80cc5adaf342ec420044e3987a0", "version-string": "5.4.1", "port-version": 1 }, From 7d53833d71bac940150083748d7b56476c119f42 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Thu, 11 Feb 2021 18:53:55 +0900 Subject: [PATCH 04/11] [lua] make 'tools' default-feature * set `ENABLE_LUA_CPP` for cmake wrapper --- ports/lua/portfile.cmake | 2 ++ ports/lua/vcpkg.json | 3 +++ versions/l-/lua.json | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 9dfaacf78b2eee..f9caa38e991c9f 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -25,6 +25,7 @@ if(VCPKG_TARGET_IS_IOS) endif() endif() +set(ENABLE_LUA_CPP 0) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -37,6 +38,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() 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 diff --git a/ports/lua/vcpkg.json b/ports/lua/vcpkg.json index a00b4d86c7458e..c73002026733eb 100644 --- a/ports/lua/vcpkg.json +++ b/ports/lua/vcpkg.json @@ -4,6 +4,9 @@ "port-version": 1, "description": "A powerful, fast, lightweight, embeddable scripting language", "homepage": "https://www.lua.org", + "default-features": [ + "tools" + ], "features": { "cpp": { "description": "Builds Lua for C++ linkage" diff --git a/versions/l-/lua.json b/versions/l-/lua.json index cac5532c3ae3e8..416cc7a9e8863b 100644 --- a/versions/l-/lua.json +++ b/versions/l-/lua.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "b445f38d73eeb80cc5adaf342ec420044e3987a0", + "git-tree": "3a8889f8529a6c008891f44d04eb8844591361b3", "version-string": "5.4.1", "port-version": 1 }, From 5b0c074edfce85f4877873e624e614e5d5861f68 Mon Sep 17 00:00:00 2001 From: luncliff Date: Mon, 29 Mar 2021 18:00:43 +0900 Subject: [PATCH 05/11] [lua] fix after collision --- ports/lua/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/l-/lua.json | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/lua/vcpkg.json b/ports/lua/vcpkg.json index c73002026733eb..1cfb2e38eab719 100644 --- a/ports/lua/vcpkg.json +++ b/ports/lua/vcpkg.json @@ -1,6 +1,6 @@ { "name": "lua", - "version-string": "5.4.1", + "version-string": "5.4.2", "port-version": 1, "description": "A powerful, fast, lightweight, embeddable scripting language", "homepage": "https://www.lua.org", diff --git a/versions/baseline.json b/versions/baseline.json index 3c8d9e5f0ff5f9..e68f3e9b008fcb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3670,7 +3670,7 @@ }, "lua": { "baseline": "5.4.2", - "port-version": 0 + "port-version": 1 }, "luabridge": { "baseline": "2.6", diff --git a/versions/l-/lua.json b/versions/l-/lua.json index a0badb27561fe6..56f7ff4564a166 100644 --- a/versions/l-/lua.json +++ b/versions/l-/lua.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cf577d1374dd9d86475e8723112e72a412424b96", + "version-string": "5.4.2", + "port-version": 1 + }, { "git-tree": "5f3de4a36739615d9ffba11571f50226b385721b", "version-string": "5.4.2", From 7fa23a2d6bcf52fd98b60b6da2fbc6e62170a920 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Sat, 3 Apr 2021 23:19:14 +0900 Subject: [PATCH 06/11] Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher --- ports/lua/portfile.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 5027d7c6ed5cf2..9584f03d688c18 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -19,10 +19,8 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS INVERTED_FEATURES tools SKIP_INSTALL_TOOLS ) -if(VCPKG_TARGET_IS_IOS) - if("tools" IN_LIST FEATURES) - message(FATAL_ERROR "lua[tools] is not supported for iOS platform build") - endif() +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) From 904f127594aa52ba63a1671b48d0d4a7a7f0d645 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Sat, 3 Apr 2021 23:19:20 +0900 Subject: [PATCH 07/11] Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher --- ports/lua/portfile.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 9584f03d688c18..f913f862fca094 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -14,8 +14,6 @@ vcpkg_extract_source_archive_ex( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - # cpp COMPILE_AS_CPP INVERTED_FEATURES tools SKIP_INSTALL_TOOLS ) From 487a263cc5ee15049cb9a2e5fd99ecaa61cfc407 Mon Sep 17 00:00:00 2001 From: luncliff Date: Sat, 3 Apr 2021 23:31:11 +0900 Subject: [PATCH 08/11] [lua] import TargetConditionals for apple platform --- ports/lua/fix-ios-system.patch | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ports/lua/fix-ios-system.patch b/ports/lua/fix-ios-system.patch index 26dfe0804d45fc..3e98ce228ac7d2 100644 --- a/ports/lua/fix-ios-system.patch +++ b/ports/lua/fix-ios-system.patch @@ -1,15 +1,28 @@ diff --git a/src/loslib.c b/src/loslib.c +index e65e188..3595601 100644 --- a/src/loslib.c +++ b/src/loslib.c -@@ -143,7 +143,12 @@ static int os_execute (lua_State *L) { +@@ -3,7 +3,9 @@ + ** Standard Operating System library + ** See Copyright Notice in lua.h + */ +- ++#if defined(__APPLE__) ++#include ++#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 ++ // system() is __IOS_PROHIBITED, __WATCHOS_PROHIBITED, and __TVOS_PROHIBITED. ++ stat = 127; // error: shell execution failed +#else - stat = system(cmd); ++ stat = system(cmd); +#endif if (cmd != NULL) return luaL_execresult(L, stat); From 1a8ee14691734b7054d81f1cf4e16f00cea6f1d6 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Sat, 17 Apr 2021 18:16:18 +0900 Subject: [PATCH 09/11] Update ports/lua/vcpkg.json Co-authored-by: Robert Schumacher --- ports/lua/vcpkg.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/ports/lua/vcpkg.json b/ports/lua/vcpkg.json index 1cfb2e38eab719..dea59129920ffe 100644 --- a/ports/lua/vcpkg.json +++ b/ports/lua/vcpkg.json @@ -4,9 +4,6 @@ "port-version": 1, "description": "A powerful, fast, lightweight, embeddable scripting language", "homepage": "https://www.lua.org", - "default-features": [ - "tools" - ], "features": { "cpp": { "description": "Builds Lua for C++ linkage" From a96600aac89ff9b8328d41163cdc28e8c8cdfa12 Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Sat, 17 Apr 2021 18:16:29 +0900 Subject: [PATCH 10/11] Update ports/lua/portfile.cmake Co-authored-by: Robert Schumacher --- ports/lua/portfile.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 8eac59ba8e66f3..58b6c374d955d4 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -25,8 +25,9 @@ set(ENABLE_LUA_CPP 0) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS + OPTIONS_RELEASE ${FEATURE_OPTIONS} + OPTIONS -DCOMPILE_AS_CPP=OFF OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON From e6b715164aa41742fb2a9a37169f816cfd0a81a9 Mon Sep 17 00:00:00 2001 From: luncliff Date: Sat, 17 Apr 2021 18:21:42 +0900 Subject: [PATCH 11/11] [lua] remove negations for 'tool' config use FEATURES instread of INVERTED_FEATURES to prevent confusions --- ports/lua/CMakeLists.txt | 2 +- ports/lua/portfile.cmake | 4 ++-- ports/lua/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/l-/lua.json | 5 +++++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt index b4eff9d1412100..ff16ff78c80b07 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 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/portfile.cmake b/ports/lua/portfile.cmake index 58b6c374d955d4..11eeac875a23bd 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -14,8 +14,8 @@ vcpkg_extract_source_archive_ex( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - INVERTED_FEATURES - tools SKIP_INSTALL_TOOLS + 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") diff --git a/ports/lua/vcpkg.json b/ports/lua/vcpkg.json index dea59129920ffe..36dd26376c6a4c 100644 --- a/ports/lua/vcpkg.json +++ b/ports/lua/vcpkg.json @@ -1,6 +1,6 @@ { "name": "lua", - "version-string": "5.4.2", + "version-string": "5.4.3", "port-version": 1, "description": "A powerful, fast, lightweight, embeddable scripting language", "homepage": "https://www.lua.org", diff --git a/versions/baseline.json b/versions/baseline.json index e3441409c03ee4..834253157a5581 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 a45533a9768790..fd0f4da290428f 100644 --- a/versions/l-/lua.json +++ b/versions/l-/lua.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0e8966273a1a18cf591cf78046d345c74941a37d", + "version-string": "5.4.3", + "port-version": 1 + }, { "git-tree": "8a52fbd7ff551d4c1b7e6d308283cfe92ca81758", "version-string": "5.4.3",