Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/luajit-rocks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Collobert <ronan@collobert.com>2013-10-25 13:55:43 +0400
committerRonan Collobert <ronan@collobert.com>2013-10-25 13:55:43 +0400
commit3f881ec4059b9e47d6d40c2058506a2db7d1ec29 (patch)
treee829123a0a98b7e89c99e6f922a77105aa017d7c
parent6b899f452f94fb0f318799dde3799f4fc3d2a400 (diff)
cmake for luarocks
-rw-r--r--luarocks/CMakeLists.txt107
-rw-r--r--luarocks/cmake/FindMD5.cmake33
-rwxr-xr-xluarocks/src/bin/luarocks-admin.in19
-rwxr-xr-xluarocks/src/bin/luarocks.in27
-rw-r--r--luarocks/src/luarocks/config.lua.in17
-rw-r--r--luarocks/src/luarocks/config.lua.win.in21
-rw-r--r--luarocks/src/luarocks/site_config.lua.in14
7 files changed, 238 insertions, 0 deletions
diff --git a/luarocks/CMakeLists.txt b/luarocks/CMakeLists.txt
new file mode 100644
index 0000000..248ecbc
--- /dev/null
+++ b/luarocks/CMakeLists.txt
@@ -0,0 +1,107 @@
+project(luarocks)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+CMAKE_POLICY(VERSION 2.6)
+
+SET(INSTALL_BIN_SUBDIR "bin" CACHE STRING "installation executable subdirectory name")
+SET(INSTALL_LIB_SUBDIR "lib" CACHE STRING "installation library subdirectory name")
+SET(INSTALL_INCLUDE_SUBDIR "include" CACHE STRING "installation include subdirectory name")
+SET(INSTALL_LUA_PATH_SUBDIR "share/lua/5.1" CACHE STRING "installation library subdirectory name")
+SET(INSTALL_LUA_CPATH_SUBDIR "lib/lua/5.1" CACHE STRING "installation library subdirectory name")
+SET(INSTALL_LUAROCKS_ROCKS_SUBDIR "lib/luarocks/rocks" CACHE STRING "installation luarocks rocks subdirectory name")
+SET(INSTALL_LUAROCKS_SYSCONF_SUBDIR "etc/luarocks" CACHE STRING "installation luarocks sysconfig subdirectory name")
+
+SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+ "${CMAKE_MODULE_PATH}")
+
+IF(WIN32)
+
+ SET(WINUTILS_DLL_FILES
+ win32/bin/7z.dll win32/bin/libeay32.dll win32/bin/libiconv2.dll
+ win32/bin/libintl3.dll win32/bin/libssl32.dll)
+
+ INSTALL(FILES ${WINUTILS_DLL_FILES} DESTINATION "${INSTALL_BIN_SUBDIR}")
+
+ SET(WINUTILS_EXE_FILES
+ win32/bin/7z.exe win32/bin/chmod.exe win32/bin/cp.exe
+ win32/bin/find.exe win32/bin/ls.exe win32/bin/md5sum.exe
+ win32/bin/mkdir.exe win32/bin/mv.exe win32/bin/objdump.exe
+ win32/bin/pwd.exe win32/bin/rm.exe win32/bin/rmdir.exe
+ win32/bin/test.exe win32/bin/uname.exe win32/bin/wget.exe)
+
+ INSTALL(PROGRAMS ${WINUTILS_EXE_FILES} DESTINATION "${INSTALL_BIN_SUBDIR}")
+
+ SET(WGET_EXECUTABLE_NAME "wget")
+ SET(MD5_EXECUTABLE_NAME "md5sum")
+ SET(UNAME_M "x64")
+ SET(SHEBANG
+"rem=rem --[[
+@setlocal& set PATH=${CMAKE_INSTALL_PREFIX}/${INSTALL_BIN_SUBDIR};%PATH% & set luafile=\"%~f0\" & if exist \"%~f0.bat\" set luafile=\"%~f0.bat\"
+@${CMAKE_INSTALL_PREFIX}/${INSTALL_BIN_SUBDIR}/luajit.exe %luafile% %*& exit /b ]]")
+
+ELSE()
+ FIND_PACKAGE(Wget)
+ FIND_PACKAGE(MD5)
+
+ IF(NOT WGET_FOUND)
+ MESSAGE(FATAL_ERROR "Downloader wget not found")
+ ENDIF()
+
+ IF(NOT MD5_FOUND)
+ MESSAGE(FATAL_ERROR "MD5 checker not found")
+ ENDIF()
+
+ GET_FILENAME_COMPONENT(WGET_EXECUTABLE_NAME "${WGET_EXECUTABLE}" NAME)
+ GET_FILENAME_COMPONENT(MD5_EXECUTABLE_NAME "${MD5_EXECUTABLE}" NAME)
+
+ IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
+ EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE UNAME_M RETURN_VALUE val)
+ IF("${val}" GREATER 0)
+ SET(UNAME_M ${CMAKE_SYSTEM_PROCESSOR})
+ ENDIF()
+ ELSE()
+ SET(UNAME_M ${CMAKE_SYSTEM_PROCESSOR})
+ ENDIF()
+
+ SET(SHEBANG "#!${CMAKE_INSTALL_PREFIX}/${INSTALL_BIN_SUBDIR}/luajit")
+
+ENDIF()
+
+SET(LUAROCKS_FILES
+ fs/unix/tools.lua fs/unix.lua fs/win32/tools.lua fs/win32.lua fs/lua.lua
+ persist.lua list.lua require.lua repos.lua dir.lua make_manifest.lua
+ command_line.lua install.lua build/command.lua build/cmake.lua
+ build/make.lua build/builtin.lua fetch/cvs.lua fetch/git.lua
+ fetch/sscm.lua tools/patch.lua fetch/svn.lua tools/zip.lua tools/tar.lua
+ pack.lua type_check.lua make.lua path.lua remove.lua fs.lua manif.lua
+ add.lua deps.lua build.lua search.lua show.lua manif_core.lua fetch.lua
+ unpack.lua validate.lua cfg.lua download.lua help.lua util.lua index.lua
+ cache.lua refresh_cache.lua loader.lua admin_remove.lua fetch/hg.lua
+ fetch/git_file.lua new_version.lua lint.lua purge.lua)
+
+FOREACH(LUAROCKS_FILE ${LUAROCKS_FILES})
+ GET_FILENAME_COMPONENT(_subpath "${LUAROCKS_FILE}" PATH)
+ INSTALL(FILES "src/luarocks/${LUAROCKS_FILE}" DESTINATION "${INSTALL_LUA_PATH_SUBDIR}/luarocks/${_subpath}")
+ENDFOREACH()
+
+CONFIGURE_FILE("src/luarocks/site_config.lua.in" "${CMAKE_CURRENT_BINARY_DIR}/src/luarocks/site_config.lua")
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/luarocks/site_config.lua" DESTINATION "${INSTALL_LUA_PATH_SUBDIR}/luarocks")
+
+IF(WIN32)
+ CONFIGURE_FILE("src/luarocks/config.lua.win.in" "${CMAKE_CURRENT_BINARY_DIR}/src/luarocks/config.lua")
+ELSE()
+ CONFIGURE_FILE("src/luarocks/config.lua.in" "${CMAKE_CURRENT_BINARY_DIR}/src/luarocks/config.lua")
+ENDIF()
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/src/luarocks/config.lua" DESTINATION "${INSTALL_LUAROCKS_SYSCONF_SUBDIR}")
+
+IF(WIN32)
+ CONFIGURE_FILE("src/bin/luarocks.in" "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks.bat")
+ CONFIGURE_FILE("src/bin/luarocks-admin.in" "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks-admin.bat")
+ INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks.bat" DESTINATION "${INSTALL_BIN_SUBDIR}")
+ INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks-admin.bat" DESTINATION "${INSTALL_BIN_SUBDIR}")
+ELSE()
+ CONFIGURE_FILE("src/bin/luarocks.in" "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks")
+ CONFIGURE_FILE("src/bin/luarocks-admin.in" "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks-admin")
+ INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks" DESTINATION "${INSTALL_BIN_SUBDIR}")
+ INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/src/bin/luarocks-admin" DESTINATION "${INSTALL_BIN_SUBDIR}")
+ENDIF()
diff --git a/luarocks/cmake/FindMD5.cmake b/luarocks/cmake/FindMD5.cmake
new file mode 100644
index 0000000..5326128
--- /dev/null
+++ b/luarocks/cmake/FindMD5.cmake
@@ -0,0 +1,33 @@
+# - Find MD5
+# This module looks for md5. This module defines the
+# following values:
+# MD5_EXECUTABLE: the full path to the md5 tool.
+# MD5_FOUND: True if md5 has been found.
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+FIND_PROGRAM(MD5_EXECUTABLE
+ NAMES md5 md5sum
+)
+
+# handle the QUIETLY and REQUIRED arguments and set MD5_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MD5 DEFAULT_MSG MD5_EXECUTABLE)
+
+MARK_AS_ADVANCED( MD5_EXECUTABLE )
+
+# MD5 option is deprecated.
+# use MD5_EXECUTABLE instead.
+SET (MD5 ${MD5_EXECUTABLE} )
diff --git a/luarocks/src/bin/luarocks-admin.in b/luarocks/src/bin/luarocks-admin.in
new file mode 100755
index 0000000..2115ef6
--- /dev/null
+++ b/luarocks/src/bin/luarocks-admin.in
@@ -0,0 +1,19 @@
+@SHEBANG@
+
+package.path = [[@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@/?.lua;@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@/?/init.lua;]]..package.path
+
+local command_line = require("luarocks.command_line")
+
+program_name = "luarocks-admin"
+program_description = "LuaRocks repository administration interface"
+
+commands = {
+}
+
+commands.help = require("luarocks.help")
+commands.make_manifest = require("luarocks.make_manifest")
+commands.add = require("luarocks.add")
+commands.remove = require("luarocks.admin_remove")
+commands.refresh_cache = require("luarocks.refresh_cache")
+
+command_line.run_command(...)
diff --git a/luarocks/src/bin/luarocks.in b/luarocks/src/bin/luarocks.in
new file mode 100755
index 0000000..dd323c7
--- /dev/null
+++ b/luarocks/src/bin/luarocks.in
@@ -0,0 +1,27 @@
+@SHEBANG@
+
+package.path = [[@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@/?.lua;@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@/?/init.lua;]]..package.path
+
+local command_line = require("luarocks.command_line")
+
+program_name = "luarocks"
+program_description = "LuaRocks main command-line interface"
+
+commands = {}
+commands.help = require("luarocks.help")
+commands.pack = require("luarocks.pack")
+commands.unpack = require("luarocks.unpack")
+commands.build = require("luarocks.build")
+commands.install = require("luarocks.install")
+commands.search = require("luarocks.search")
+commands.list = require("luarocks.list")
+commands.remove = require("luarocks.remove")
+commands.make = require("luarocks.make")
+commands.download = require("luarocks.download")
+commands.path = require("luarocks.path")
+commands.show = require("luarocks.show")
+commands.new_version = require("luarocks.new_version")
+commands.lint = require("luarocks.lint")
+commands.purge = require("luarocks.purge")
+
+command_line.run_command(...)
diff --git a/luarocks/src/luarocks/config.lua.in b/luarocks/src/luarocks/config.lua.in
new file mode 100644
index 0000000..01cd875
--- /dev/null
+++ b/luarocks/src/luarocks/config.lua.in
@@ -0,0 +1,17 @@
+-- I do not know what luarocks guys have in mind
+-- If they depend on external commands, it seems
+-- completely irrelevant to install packages to
+-- replace those commands (as you need these freaking
+-- commands anyways to install the first modules!!)
+-- On top of that it breaks features. BOUH.
+fs_use_modules = false
+
+rocks_trees = {
+ home..[[/.luarocks]],
+ {root="@CMAKE_INSTALL_PREFIX@", bin_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_BIN_SUBDIR@", lib_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_CPATH_SUBDIR@", lua_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@"}
+}
+
+rocks_servers = {
+ [[https://raw.github.com/torch/rocks/master]],
+ [[http://luarocks.org/repositories/rocks]]
+}
diff --git a/luarocks/src/luarocks/config.lua.win.in b/luarocks/src/luarocks/config.lua.win.in
new file mode 100644
index 0000000..b4476a4
--- /dev/null
+++ b/luarocks/src/luarocks/config.lua.win.in
@@ -0,0 +1,21 @@
+-- I do not know what luarocks guys have in mind
+-- If they depend on external commands, it seems
+-- completely irrelevant to install packages to
+-- replace those commands (as you need these freaking
+-- commands anyways to install the first modules!!)
+-- On top of that it breaks features. BOUH.
+fs_use_modules = false
+
+rocks_trees = {
+ home..[[/.luarocks]],
+ {root="@CMAKE_INSTALL_PREFIX@", bin_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_BIN_SUBDIR@", lib_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_CPATH_SUBDIR@", lua_dir="@CMAKE_INSTALL_PREFIX@/@INSTALL_LUA_PATH_SUBDIR@"}
+}
+
+rocks_servers = {
+ [[https://raw.github.com/torch/rocks/master]],
+ [[http://luarocks.org/repositories/rocks]]
+}
+
+variables = {
+ LUALIB = [[libluajit.lib]]
+}
diff --git a/luarocks/src/luarocks/site_config.lua.in b/luarocks/src/luarocks/site_config.lua.in
new file mode 100644
index 0000000..eb1f15b
--- /dev/null
+++ b/luarocks/src/luarocks/site_config.lua.in
@@ -0,0 +1,14 @@
+module("luarocks.site_config")
+LUAROCKS_PREFIX=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_PREFIX_SUBDIR@]]
+LUA_INCDIR=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDE_SUBDIR@]]
+LUA_LIBDIR=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_SUBDIR@]]
+LUA_BINDIR=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_BIN_SUBDIR@]]
+LUA_INTERPRETER = [[luajit]]
+LUAROCKS_SYSCONFDIR=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_LUAROCKS_SYSCONF_SUBDIR@]]
+LUAROCKS_ROCKS_TREE=[[@CMAKE_INSTALL_PREFIX@/@INSTALL_PREFIX_SUBDIR@]]
+LUAROCKS_ROCKS_SUBDIR=[[@INSTALL_LUAROCKS_ROCKS_SUBDIR@]]
+LUA_DIR_SET = true
+LUAROCKS_UNAME_S=[[@CMAKE_SYSTEM_NAME@]]
+LUAROCKS_UNAME_M=[[@UNAME_M@]]
+LUAROCKS_DOWNLOADER=[[@WGET_EXECUTABLE_NAME@]]
+LUAROCKS_MD5CHECKER=[[@MD5_EXECUTABLE_NAME@]]