forked from minetest-mods/irc
Fixes to build system
This commit is contained in:
parent
d0a19055c5
commit
801869d6fb
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
Build*
|
||||
dists
|
||||
irc-*
|
||||
irc
|
||||
*.zip
|
||||
|
@ -74,24 +74,33 @@ 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
|
||||
#COMPILE_FLAGS "-Wall -Werror"
|
||||
)
|
||||
|
||||
set_target_properties(luasocket_lib PROPERTIES
|
||||
OUTPUT_NAME luasocket)
|
||||
|
||||
if(WIN32)
|
||||
find_library(ws2_32_lib
|
||||
NAMES ws2_32
|
||||
)
|
||||
target_link_libraries(luasocket_lib
|
||||
${ws2_32_lib}
|
||||
)
|
||||
# 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_SOURCE_DIR}/irc/)
|
||||
set(dir ${CMAKE_CURRENT_BINARY_DIR}/irc/)
|
||||
|
||||
if(WIN32)
|
||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/libluasocket.dll")
|
||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/luasocket.dll")
|
||||
else()
|
||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/libluasocket.so")
|
||||
endif()
|
||||
|
19
README.txt
19
README.txt
@ -43,22 +43,27 @@ Under Linux:
|
||||
cmake ..
|
||||
- Use the build tool for the generated build system to compile the
|
||||
native library. For example, if using Code::Blocks, open the generated
|
||||
workspace and build from there. If using make, just run "make" from
|
||||
workspace and build from there. If using `make', just run "make" from
|
||||
within the Build directory.
|
||||
- Use the packmod.sh shell script to copy the files into a ready to use
|
||||
mod directory named `irc'.
|
||||
|
||||
- Again use the build tool to invoke the `pack_mod' target. For example,
|
||||
if using `make', run "make pack_mod" from within the build directory.
|
||||
This will create an `irc-mod/irc' directory inside the build directory.
|
||||
This `irc' directory will be ready to be deployed to your Minetest mods
|
||||
directory. [Currently, there's a problem when compiling for GCC/MinGW32:
|
||||
the library will be named `libluasocket.dll', but the mod looks for
|
||||
`luasocket.dll'. There is a temporary fix to make the mod also search
|
||||
for `libluasocket.dll'.]
|
||||
|
||||
INSTALLING
|
||||
----------
|
||||
Just put theit in any of the
|
||||
directories where Minetest looks for mods. For more information, see:
|
||||
Just put the created `irc' directory in any of the directories where
|
||||
Minetest looks for mods. For more information, see:
|
||||
http://wiki.minetest.net/wiki/Installing_mods
|
||||
|
||||
|
||||
SETTINGS
|
||||
--------
|
||||
All settings are changed directly in the script. If any of these settings
|
||||
All settings are changed in the `config.lua' file. If any of these settings
|
||||
are either nil or false, the default value is used.
|
||||
|
||||
mt_irc.server (string, default "irc.freenode.net")
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
# ONLY FOR MAINTAINER USE!!
|
||||
|
||||
t="`pwd`";
|
||||
cd "`dirname "$0"`/..";
|
||||
basedir="`pwd`";
|
||||
cd "$t";
|
||||
|
||||
ver=0.1.0;
|
||||
|
||||
do_make() # [PLATFORM]
|
||||
@ -15,6 +20,7 @@ do_make() # [PLATFORM]
|
||||
BLD_SFX="-$1";
|
||||
fi
|
||||
|
||||
cd "$basedir";
|
||||
mkdir -p Build$BLD_SFX;
|
||||
cd Build$BLD_SFX;
|
||||
cmake $TC_FILE .. || exit;
|
||||
@ -24,16 +30,16 @@ do_make() # [PLATFORM]
|
||||
|
||||
}
|
||||
|
||||
cd "`dirname "$0"`/..";
|
||||
|
||||
rm -fr irc;
|
||||
mkdir -p "$basedir/dists"
|
||||
|
||||
# Native Version
|
||||
do_make;
|
||||
tar cfz Kaeza-irc-$ver-`uname -s`-`uname -p`.tar.gz irc || exit;
|
||||
rm -fr irc;
|
||||
(do_make \
|
||||
&& cd Build \
|
||||
&& tar cfz "$basedir/dists/Kaeza-irc-$ver-`uname -s`-`uname -p`.tar.gz" irc \
|
||||
) || exit;
|
||||
|
||||
# Linux -> MinGW32 Crosscompiler
|
||||
do_make i586-mingw32msvc;
|
||||
zip -r Kaeza-irc-$ver-Win32.zip irc || exit;
|
||||
rm -fr irc;
|
||||
(do_make i586-mingw32msvc \
|
||||
&& cd Build-i586-mingw32msvc \
|
||||
&& zip -r "$basedir/dists/Kaeza-irc-$ver-Win32.zip" irc \
|
||||
) || exit;
|
||||
|
@ -69,10 +69,6 @@ minetest.register_globalstep(function ( dtime )
|
||||
end
|
||||
end);
|
||||
|
||||
local function strltrim ( s )
|
||||
return s:gsub("^[[:space:]]*", "");
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function ( player )
|
||||
|
||||
if (not mt_irc.connect_ok) then
|
||||
@ -146,14 +142,14 @@ minetest.register_chatcommand("msg", {
|
||||
func = function ( name, param )
|
||||
local pos = param:find(" ", 1, true);
|
||||
if (not pos) then return; end
|
||||
local nick = param:sub(1, pos - 1);
|
||||
local name = param:sub(1, pos - 1);
|
||||
local msg = param:sub(pos + 1);
|
||||
local t = {
|
||||
name=nick;
|
||||
message=msg;
|
||||
};
|
||||
local text = mt_irc.message_format_out:gsub("%$%(([^)]+)%)", t)
|
||||
irc.send("PRIVMSG", nick, text);
|
||||
irc.send("PRIVMSG", name, text);
|
||||
end;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user