forked from minetest-mods/irc
Switch build system to SConstruct
This commit is contained in:
parent
4c70a06e87
commit
f88760a273
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
Build/
|
||||
irc/
|
||||
CMakeFiles/
|
||||
build/
|
||||
.scons*
|
||||
|
||||
|
|
139
CMakeLists.txt
139
CMakeLists.txt
|
@ -1,139 +0,0 @@
|
|||
|
||||
# :mode=cmake:
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(MINETEST_IRC C)
|
||||
|
||||
# Also update init.lua
|
||||
set(MINETEST_IRC_VERSION 0.2.0)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
set(LUA_SRCS
|
||||
src/lua/lapi.c
|
||||
src/lua/lcode.c
|
||||
src/lua/ldebug.c
|
||||
src/lua/ldo.c
|
||||
src/lua/ldump.c
|
||||
src/lua/lfunc.c
|
||||
src/lua/lgc.c
|
||||
src/lua/llex.c
|
||||
src/lua/lmem.c
|
||||
src/lua/lobject.c
|
||||
src/lua/lopcodes.c
|
||||
src/lua/lparser.c
|
||||
src/lua/lstate.c
|
||||
src/lua/lstring.c
|
||||
src/lua/ltable.c
|
||||
src/lua/ltm.c
|
||||
src/lua/lundump.c
|
||||
src/lua/lvm.c
|
||||
src/lua/lzio.c
|
||||
src/lua/lauxlib.c
|
||||
src/lua/lbaselib.c
|
||||
src/lua/ldblib.c
|
||||
src/lua/liolib.c
|
||||
src/lua/lmathlib.c
|
||||
src/lua/loslib.c
|
||||
src/lua/ltablib.c
|
||||
src/lua/lstrlib.c
|
||||
src/lua/loadlib.c
|
||||
src/lua/linit.c
|
||||
)
|
||||
|
||||
set(LUASOCKET_SRCS
|
||||
src/luasocket/compat51.c
|
||||
src/luasocket/luasocket.c
|
||||
src/luasocket/timeout.c
|
||||
src/luasocket/buffer.c
|
||||
src/luasocket/io.c
|
||||
src/luasocket/auxiliar.c
|
||||
src/luasocket/options.c
|
||||
src/luasocket/inet.c
|
||||
src/luasocket/tcp.c
|
||||
src/luasocket/udp.c
|
||||
src/luasocket/except.c
|
||||
src/luasocket/select.c
|
||||
src/luasocket/mime.c
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND LUASOCKET_SRCS src/luasocket/wsocket.c)
|
||||
set(LUASOCKET_EXTRA_LIBS -lwininet)
|
||||
else()
|
||||
list(APPEND LUASOCKET_SRCS src/luasocket/usocket.c src/luasocket/unix.c)
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lua)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/luasocket)
|
||||
|
||||
add_library(luasocket_lib MODULE ${LUASOCKET_SRCS} ${LUA_SRCS})
|
||||
|
||||
set_target_properties(luasocket_lib PROPERTIES
|
||||
OUTPUT_NAME luasocket)
|
||||
|
||||
if(WIN32)
|
||||
# When using MinGW32, CMake prefixes DLLs with "lib". Force remove
|
||||
# this prefix regardless of compiler.
|
||||
set_target_properties(luasocket_lib PROPERTIES
|
||||
PREFIX "")
|
||||
if (NOT MSVC) # GCC?
|
||||
# The `-fPIC' flag generates a warning on MinGW32, which combined
|
||||
# with `-Werror' makes that an error though `-fPIC' is ignored.
|
||||
# We use `-fno-PIC' to avoid that.
|
||||
set_target_properties(luasocket_lib PROPERTIES
|
||||
COMPILE_FLAGS "-fno-PIC -Wall -Werror")
|
||||
endif()
|
||||
find_library(ws2_32_lib NAMES ws2_32)
|
||||
target_link_libraries(luasocket_lib ${ws2_32_lib})
|
||||
else() # Possibly Unix
|
||||
set_target_properties(luasocket_lib PROPERTIES
|
||||
COMPILE_FLAGS "-Wall -Werror")
|
||||
endif()
|
||||
|
||||
set(dir ${CMAKE_CURRENT_BINARY_DIR}/irc/)
|
||||
|
||||
if(WIN32)
|
||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/luasocket.dll")
|
||||
else()
|
||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/libluasocket.so")
|
||||
endif()
|
||||
|
||||
add_custom_target(pack_mod ALL
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
# LuaIRC
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory src/LuaIRC ${dir}/irc
|
||||
|
||||
# luasocket
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/ftp.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/http.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/ltn12.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/mime.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/smtp.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/socket.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/tp.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/url.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/LICENSE.txt ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${dir}
|
||||
|
||||
# IRC mod
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/init.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/hooks.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/messages.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/config.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/callback.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/chatcmds.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/botcmds.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/player_part.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/util.lua ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy README.txt ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/API.txt ${dir}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy src/LICENSE.txt ${dir}
|
||||
)
|
||||
|
34
README.txt
34
README.txt
|
@ -3,16 +3,15 @@ IRC Mod for Minetest
|
|||
|
||||
INTRODUCTION
|
||||
------------
|
||||
This mod is just a glue between luasocket, LuaIRC, and Minetest. It
|
||||
provides a two-way communication between the in-game chat, and an
|
||||
arbitrary IRC channel.
|
||||
This mod is just a glue between IRC and Minetest. It provides two-way
|
||||
communication between the in-game chat, and an arbitrary IRC channel.
|
||||
|
||||
The forum topic is at http://minetest.net/forum/viewtopic.php?id=3905
|
||||
|
||||
|
||||
COMPILING
|
||||
---------
|
||||
Make sure you have CMake (http://cmake.org/), and of course, a C compiler,
|
||||
Make sure you have SCons (http://scons.org/), and of course, a C compiler,
|
||||
on your system before proceeding.
|
||||
For Windows, try MinGW32 (http://mingw.org/).
|
||||
For Unix-based systems, you should not have any problems with the C compiler
|
||||
|
@ -21,26 +20,19 @@ For Unix-based systems, you should not have any problems with the C compiler
|
|||
ISO), since vanilla Puppy does not come with 'gcc'. See your Puppy docs for
|
||||
more info about how to install additional SFS files.
|
||||
|
||||
Quick one line build for linux.
|
||||
|
||||
git clone https://github.com/kaeza/minetest-irc.git && cd minetest-irc && git submodule update --init && ./quick_install.sh <mod directory>
|
||||
Please change <mod directory> to fit your install of minetest.
|
||||
Quick one line build for linux:
|
||||
git clone https://github.com/kaeza/minetest-irc.git && cd minetest-irc && git submodule update --init && ./quick_install.sh <Mod directory>
|
||||
Please change <Mod directory> to fit your installation of minetest.
|
||||
|
||||
To compile and pack the mod:
|
||||
|
||||
- Open a command prompt/terminal and CD to the minetest-irc directory.
|
||||
- (optional) Create a directory named "Build", and CD into it:
|
||||
mkdir Build
|
||||
cd Build
|
||||
- Run CMake to generate the build system (see your CMake docs for more
|
||||
information about command line options, in particular the '-G' option).
|
||||
cmake . (cmake .. if you made a seperate build directory)
|
||||
- Use the build tool for the generated build system to compile the
|
||||
native library. For example, if using Microsoft Visual Studio, open
|
||||
the generated workspace and build from there. If using make, just run
|
||||
"make" from within the Build directory.
|
||||
- After building you will have a folder named 'irc' in your build folder.
|
||||
Move that to your mod folder.
|
||||
- Open a command prompt/terminal and move to the minetest-irc directory.
|
||||
- Initialize and update submodules if needed.
|
||||
git submodule init # Only needed first time
|
||||
git submodule update # Only needed first time and after updating
|
||||
- Run SCons to compile luasocket. (see `scons -h` for extra options)
|
||||
scons
|
||||
- After building you will have a folder named `irc` in your `build` folder. Move that to your mod folder.
|
||||
|
||||
|
||||
INSTALLING
|
||||
|
|
96
SConstruct
Normal file
96
SConstruct
Normal file
|
@ -0,0 +1,96 @@
|
|||
|
||||
vars = Variables(None, ARGUMENTS)
|
||||
|
||||
vars.AddVariables(
|
||||
PathVariable("prefix", "Installation prefix", "build",
|
||||
PathVariable.PathIsDirCreate)
|
||||
)
|
||||
|
||||
env = Environment(variables = vars)
|
||||
|
||||
Help(vars.GenerateHelpText(env))
|
||||
|
||||
env.VariantDir("$prefix", "src", 0)
|
||||
|
||||
lua_srcs = Split("""
|
||||
$prefix/lua/lapi.c
|
||||
$prefix/lua/lcode.c
|
||||
$prefix/lua/ldebug.c
|
||||
$prefix/lua/ldo.c
|
||||
$prefix/lua/ldump.c
|
||||
$prefix/lua/lfunc.c
|
||||
$prefix/lua/lgc.c
|
||||
$prefix/lua/llex.c
|
||||
$prefix/lua/lmem.c
|
||||
$prefix/lua/lobject.c
|
||||
$prefix/lua/lopcodes.c
|
||||
$prefix/lua/lparser.c
|
||||
$prefix/lua/lstate.c
|
||||
$prefix/lua/lstring.c
|
||||
$prefix/lua/ltable.c
|
||||
$prefix/lua/ltm.c
|
||||
$prefix/lua/lundump.c
|
||||
$prefix/lua/lvm.c
|
||||
$prefix/lua/lzio.c
|
||||
$prefix/lua/lauxlib.c
|
||||
$prefix/lua/lbaselib.c
|
||||
$prefix/lua/ldblib.c
|
||||
$prefix/lua/liolib.c
|
||||
$prefix/lua/lmathlib.c
|
||||
$prefix/lua/loslib.c
|
||||
$prefix/lua/ltablib.c
|
||||
$prefix/lua/lstrlib.c
|
||||
$prefix/lua/loadlib.c
|
||||
$prefix/lua/linit.c
|
||||
""")
|
||||
|
||||
luasocket_srcs = Split("""
|
||||
$prefix/luasocket/compat51.c
|
||||
$prefix/luasocket/luasocket.c
|
||||
$prefix/luasocket/timeout.c
|
||||
$prefix/luasocket/buffer.c
|
||||
$prefix/luasocket/io.c
|
||||
$prefix/luasocket/auxiliar.c
|
||||
$prefix/luasocket/options.c
|
||||
$prefix/luasocket/inet.c
|
||||
$prefix/luasocket/tcp.c
|
||||
$prefix/luasocket/udp.c
|
||||
$prefix/luasocket/except.c
|
||||
$prefix/luasocket/select.c
|
||||
$prefix/luasocket/mime.c
|
||||
""")
|
||||
|
||||
luasocket_libs = []
|
||||
env.MergeFlags("-Wall -Werror")
|
||||
|
||||
if env["PLATFORM"] == "win32":
|
||||
luasocket_srcs += ["$prefix/luasocket/wsocket.c"]
|
||||
luasocket_libs += ["wininet", "ws2_32"]
|
||||
if "mingw" in env['CC']:
|
||||
# The '-fPIC' flag generates a warning on MinGW32, which combined
|
||||
# with '-Werror' makes that an error though '-fPIC' is ignored.
|
||||
# We use '-fno-PIC' to avoid that.
|
||||
env.MergeFlags("-fno-PIC")
|
||||
else:
|
||||
luasocket_srcs += ["$prefix/luasocket/usocket.c",
|
||||
"$prefix/luasocket/unix.c"]
|
||||
|
||||
|
||||
luasocket_out = env.LoadableModule(
|
||||
target = "$prefix/luasocket",
|
||||
source = luasocket_srcs + lua_srcs,
|
||||
LIBS = luasocket_libs,
|
||||
CPPPATH = ["src/luasocket/", "src/lua/"]
|
||||
)
|
||||
|
||||
|
||||
env.InstallAs("$prefix/irc/irc", "src/LuaIRC")
|
||||
env.Install("$prefix/irc", Glob("src/luasocket/*.lua"))
|
||||
env.Install("$prefix/irc", Glob("src/*.lua"))
|
||||
env.Install("$prefix/irc", Glob("src/*.txt"))
|
||||
env.Install("$prefix/irc", "README.txt")
|
||||
env.Install("$prefix/irc", luasocket_out)
|
||||
|
||||
env.Alias("pack", "$prefix/irc")
|
||||
env.Clean("pack", "$prefix/irc")
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
# :mode=cmake:
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(PLATFORM i586-mingw32msvc)
|
||||
|
||||
set(MGW_TOOLCHAIN_PATH
|
||||
/usr/${PLATFORM}
|
||||
)
|
||||
|
||||
set(WIN32 1)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/${PLATFORM}-gcc)
|
||||
set(CMAKE_RC_COMPILER /usr/bin/${PLATFORM}-windres)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${MGW_TOOLCHAIN_PATH})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -1,8 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
mkdir -p Build &&\
|
||||
cd Build &&\
|
||||
cmake .. &&\
|
||||
make &&\
|
||||
ln -s $(pwd)/irc $1
|
||||
scons &&\
|
||||
ln -s $(pwd)/build/irc $1
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user