aboutsummaryrefslogtreecommitdiff
path: root/ports/lua
diff options
context:
space:
mode:
authorJan HrubĂ˝ <jhruby.web@gmail.com>2017-03-13 08:56:05 +0100
committerGitHub <noreply@github.com>2017-03-13 08:56:05 +0100
commit665f4118f603c5858217ed7a2f2f824b18ff4fc5 (patch)
treef0167041edf71e90f2331b5025f603392a8de67a /ports/lua
parent1bec0fcb73073b5b1719f454c368a63f1bff625e (diff)
parent1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff)
downloadvcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.tar.gz
vcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.zip
Merge pull request #1 from Microsoft/master
pull
Diffstat (limited to 'ports/lua')
-rw-r--r--ports/lua/CMakeLists.txt77
-rw-r--r--ports/lua/CONTROL3
-rw-r--r--ports/lua/COPYRIGHT6
-rw-r--r--ports/lua/portfile.cmake40
4 files changed, 126 insertions, 0 deletions
diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt
new file mode 100644
index 000000000..faef8018b
--- /dev/null
+++ b/ports/lua/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Lua can be compiled as either C or C++.
+# Default configuration is C, set COMPILE_AS_CPP to ON to use C++.
+# See http://stackoverflow.com/questions/13560945/c-and-c-library-using-longjmp for why would you want to do that.
+# Primary differences:
+# - Exceptions will be used instead of setjmp/longjmp
+# - The name mangling for functions will be C++ instead of C.
+# - This is a source-incompatible change because extern "C" is chosen by the including application.
+# - The lua.hpp header will not be available.
+
+PROJECT ( lua )
+
+IF( NOT WIN32 )
+ message( FATAL_ERROR "Written for window only" )
+ENDIF()
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+SET (HDR_LIBLUA
+src/lapi.h src/lauxlib.h src/lcode.h src/lctype.h src/ldebug.h src/ldo.h src/lfunc.h
+src/lgc.h src/llex.h src/llimits.h src/lmem.h src/lobject.h src/lopcodes.h src/lparser.h
+src/lstate.h src/lstring.h src/ltable.h src/ltm.h src/lua.h src/luaconf.h src/lualib.h
+src/lundump.h src/lvm.h src/lzio.h
+)
+
+# Build Libraries
+SET (SRC_LIBLUA
+src/lapi.c src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcode.c src/lcorolib.c
+src/lctype.c src/ldblib.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c
+src/linit.c src/liolib.c src/llex.c src/lmathlib.c src/lmem.c src/loadlib.c src/lobject.c
+src/lopcodes.c src/loslib.c src/lparser.c src/lstate.c src/lstring.c src/lstrlib.c
+src/ltable.c src/ltablib.c src/ltm.c src/lundump.c src/lutf8lib.c src/lvm.c src/lzio.c
+)
+
+IF (COMPILE_AS_CPP)
+ SET_SOURCE_FILES_PROPERTIES(${SRC_LIBLUA} src/lua.c src/luac.c PROPERTIES LANGUAGE CXX)
+ENDIF ()
+
+# append headers to sources to make them show up in MSVC GUI
+LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA})
+
+# remove warnings
+ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS )
+
+#DLL
+ADD_LIBRARY ( lua ${SRC_LIBLUA} )
+
+IF (BUILD_SHARED_LIBS)
+ TARGET_COMPILE_DEFINITIONS (lua PRIVATE -DLUA_BUILD_AS_DLL )
+ENDIF ()
+
+INSTALL ( TARGETS lua
+ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+)
+
+IF (NOT DEFINED SKIP_INSTALL_TOOLS)
+ ADD_EXECUTABLE ( luac src/luac.c ${SRC_LIBLUA} ) # compiler
+ ADD_EXECUTABLE ( luai src/lua.c ${SRC_LIBLUA} ) # interpreter
+ SET_TARGET_PROPERTIES ( luai PROPERTIES OUTPUT_NAME lua PDB_NAME luai )
+ INSTALL ( TARGETS luai luac RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/tools )
+ENDIF ()
+
+IF (NOT DEFINED SKIP_INSTALL_HEADERS)
+ INSTALL(
+ FILES
+ src/lualib.h
+ src/lua.h
+ src/luaconf.h
+ src/lauxlib.h
+ DESTINATION include
+ )
+ # If using C++, don't install extern "C" wrapper.
+ IF (NOT COMPILE_AS_CPP)
+ INSTALL(FILES src/lua.hpp DESTINATION include)
+ ENDIF ()
+ENDIF ()
diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL
new file mode 100644
index 000000000..266bd153c
--- /dev/null
+++ b/ports/lua/CONTROL
@@ -0,0 +1,3 @@
+Source: lua
+Version: 5.3.4
+Description: a powerful, fast, lightweight, embeddable scripting language
diff --git a/ports/lua/COPYRIGHT b/ports/lua/COPYRIGHT
new file mode 100644
index 000000000..729a2ccd5
--- /dev/null
+++ b/ports/lua/COPYRIGHT
@@ -0,0 +1,6 @@
+Copyright © 1994–2016 Lua.org, PUC-Rio.
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake
new file mode 100644
index 000000000..beda8362e
--- /dev/null
+++ b/ports/lua/portfile.cmake
@@ -0,0 +1,40 @@
+# Common Ambient Variables:
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# TARGET_TRIPLET is the current triplet (x86-windows, etc)
+# PORT is the current port name (zlib, etc)
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lua-5.3.4)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.lua.org/ftp/lua-5.3.4.tar.gz"
+ FILENAME "lua-5.3.4.tar.gz"
+ SHA512 739e31f82e6a60fa99910c2005e991b3a1e21339af52847f653cb190b30842054d189ca116ffcfdf9b36e07888c9ce5642b1dd2988cc7eff9f8789f9a2e34997
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DCOMPILE_AS_CPP=OFF
+ OPTIONS_DEBUG
+ -DSKIP_INSTALL_HEADERS=ON
+ -DSKIP_INSTALL_TOOLS=ON
+)
+
+vcpkg_install_cmake()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(READ ${CURRENT_PACKAGES_DIR}/include/luaconf.h LUA_CONF_H)
+ string(REPLACE "defined(LUA_BUILD_AS_DLL)" "1" LUA_CONF_H "${LUA_CONF_H}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/include/luaconf.h "${LUA_CONF_H}")
+endif()
+
+# Handle copyright
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua)
+vcpkg_copy_pdbs()