From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 28CDB6B966; Tue, 13 Apr 2021 16:29:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 28CDB6B966 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618320541; bh=aNacS4q3bfMsGR9x3z9Grq4NIinRGikYNmeHrzKJX6Y=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qYQHEY5e8Taa/O5k7zPKjr+6gQO6znPs++/ASP0QTOyb54LJc5gZcNgIktNylkjFC y8QMFlRO0mct8ewACS9oPSfeLQCNfyYetitu+UiJZoQBhcRXZN16Q9rVB7pn3QazAM 9ztcOpRtLbxWDdp8bIDKnyHgRQbaP3r1JuRH/PCE= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 773636BD2D for ; Tue, 13 Apr 2021 16:28:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 773636BD2D Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lWJ5i-0000dj-H8; Tue, 13 Apr 2021 16:28:30 +0300 To: Sergey Ostanevich , Igor Munkin Date: Tue, 13 Apr 2021 16:27:02 +0300 Message-Id: X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D5E28B957962BB550182A05F5380850403276E81E1BC36C86615BE42777ECD7F9B6FA057C6BBFCB4144DE06CD20CC3882 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74FF5DF51D335CFFFEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373C9FC9F3BACECB908638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2DBE22A431C719A9EE7D23C624EFFF4F6BDFBBEFFF4125B51D2E47CDBA5A96583C09775C1D3CA48CF4964A708C60C975A117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77FFCE1C639F4728C9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4933F735096452955E3026D3A1080F4EF5CC4224003CC83647689D4C264860C145E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CB69F9342289A40B310050276E185AAE60A33937E23A407FB9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F8A2DF183797A6A83E32F1B8E5201F68097A5E8356D7E2976DF62EC02DB047B539A986B49AE29A161D7E09C32AA3244C7CE064D6D671046A4E938EE848F6E40A3C6EB905E3A8056B927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXEfsBEcQT2bvA== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB40E31D006E76A510B0CB0C4669B49AB2C4FC44C16C84DF5F4F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v3 02/29] test: build auxiliary C libs from PUC-Rio Lua 5.1 X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch adds rules to create additional LuaC libraries for tests in . Also, it renames `luaL_reg` to `luaL_Reg` in and to be consistent with the current LuaJIT's LuaC API. Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 --- test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt | 3 +- .../PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt | 49 ++++++++++++++++++- test/PUC-Rio-Lua-5.1-tests/libs/lib1.c | 2 +- test/PUC-Rio-Lua-5.1-tests/libs/lib2.c | 2 +- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt index e3bbc9de..aab2d2fc 100644 --- a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt +++ b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt @@ -16,7 +16,8 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) # variable as proposed in the first case. set(LUA_PATH "?\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua") -# Establish PUC-Lua-5.1-tests-prepare target that creates +# Establish PUC-Lua-5.1-tests-prepare target that contains rules +# for libraries compilation and creates # subdirectory. add_subdirectory(libs) diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt index f24e7f30..b31ba130 100644 --- a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt +++ b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt @@ -4,11 +4,58 @@ # See the rationale in the root CMakeLists.txt. cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +# Build additional C libraries for tests. +macro(BuildTestCLib lib sources) + add_library(${lib} SHARED EXCLUDE_FROM_ALL ${sources}) + target_include_directories(${lib} PRIVATE + ${LUAJIT_SOURCE_DIR} + ) + set_target_properties(${lib} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + PREFIX "" + ) + # XXX: The dynamic libraries are loaded with LuaJIT binary and + # use symbols from it. So it is totally OK to have unresolved + # symbols at build time. + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_target_properties(${lib} PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" + ) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # XXX: This is necessary mostly for openSUSE builds, see also + # https://bugzilla.suse.com/show_bug.cgi?id=1012388. + # Just strip out the linker flag to suppress this linker + # option. + string(REPLACE "-Wl,--no-undefined" "" + CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" + ) + endif() + list(APPEND TESTLIBS ${lib}) +endmacro() + +BuildTestCLib(lib1 lib1.c) +BuildTestCLib(lib11 lib1.c lib11.c) +BuildTestCLib(lib2 lib2.c) +BuildTestCLib(lib21 lib2.c lib21.c) + +# Create the exact copy of the lib2 library for tests +# in . +set(LIB2ORIG "${CMAKE_CURRENT_BINARY_DIR}/lib2${CMAKE_SHARED_LIBRARY_SUFFIX}") +set(LIB2COPY "${CMAKE_CURRENT_BINARY_DIR}/-lib2${CMAKE_SHARED_LIBRARY_SUFFIX}") +add_custom_command( + OUTPUT ${LIB2COPY} + COMMENT "Copying lib2 to -lib2 for PUC-Rio Lua 5.1 tests" + COMMAND ${CMAKE_COMMAND} -E copy ${LIB2ORIG} ${LIB2COPY} + DEPENDS ${TESTLIBS} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +list(APPEND TESTLIBS ${LIB2COPY}) + # The original tarball contains subdirectory "libs" with an empty # subdirectory "libs/P1", to be used by tests. # Instead of tracking empty directory with some anchor-file for # git, create this directory via CMake. -add_custom_target(PUC-Lua-5.1-tests-prepare) +add_custom_target(PUC-Lua-5.1-tests-prepare DEPENDS ${TESTLIBS}) add_custom_command(TARGET PUC-Lua-5.1-tests-prepare COMMENT "Create directory for PUC-Rio Lua 5.1 tests" COMMAND ${CMAKE_COMMAND} -E make_directory P1 diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/lib1.c b/test/PUC-Rio-Lua-5.1-tests/libs/lib1.c index 812bb9ac..22fe6dee 100644 --- a/test/PUC-Rio-Lua-5.1-tests/libs/lib1.c +++ b/test/PUC-Rio-Lua-5.1-tests/libs/lib1.c @@ -14,7 +14,7 @@ static int id (lua_State *L) { } -static const struct luaL_reg funcs[] = { +static const struct luaL_Reg funcs[] = { {"id", id}, {NULL, NULL} }; diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/lib2.c b/test/PUC-Rio-Lua-5.1-tests/libs/lib2.c index 9972cbe4..876a212f 100644 --- a/test/PUC-Rio-Lua-5.1-tests/libs/lib2.c +++ b/test/PUC-Rio-Lua-5.1-tests/libs/lib2.c @@ -12,7 +12,7 @@ static int id (lua_State *L) { } -static const struct luaL_reg funcs[] = { +static const struct luaL_Reg funcs[] = { {"id", id}, {NULL, NULL} }; -- 2.31.0