Installing LuaSocket

From FreeSWITCH Wiki
Jump to: navigation, search
Warning

Superseded by https://confluence.freeswitch.org/display/FREESWITCH/Installing+LuaSocket

 


Following works only with FreeSWITCH prior to release 1.4

To install Luasocket, first we need to download the source file from http://luaforge.net/frs/?group_id=23&release_id=837.

Once you've downloaded the package, unpack it, open the directory, and open the config file for editing. There are only a few lines we need to add/change (in bold):

#------
# LuaSocket makefile configuration
#

#------
# Output file names
#
EXT=so
SOCKET_V=2.0.2
MIME_V=1.0.2
SOCKET_SO=socket.$(EXT).$(SOCKET_V)
MIME_SO=mime.$(EXT).$(MIME_V)
UNIX_SO=unix.$(EXT)

PREFIX = /usr/local

#------
# Lua includes and libraries
#
LUAINC=-I/usr/local/src/freeswitch/src/mod/languages/mod_lua/lua
#LUAINC=-I/usr/local/include/lua5.1
#LUAINC=-Ilua-5.1.1/src

#------
# Compat-5.1 directory
#
#COMPAT=compat-5.1r5

#------
# Top of your Lua installation
# Relative paths will be inside the src tree
#
#INSTALL_TOP_SHARE=/usr/local/share/lua/5.0
#INSTALL_TOP_LIB=/usr/local/lib/lua/5.0
INSTALL_TOP_SHARE=${PREFIX}/share/lua/5.1
INSTALL_TOP_LIB=${PREFIX}/lib/lua/5.1

INSTALL_DATA=cp
INSTALL_EXEC=cp

#------
# Compiler and linker settings
# for Mac OS X
#
#CC=gcc
#DEF= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN
#CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common
#LDFLAGS=-bundle -undefined dynamic_lookup
#LD=export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc

#------
# Compiler and linker settings
# for Linux
CC=gcc
DEF=-DLUASOCKET_DEBUG
CFLAGS= $(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic
LDFLAGS=-O -shared -fpic
LD=gcc

#------
# End of makefile configuration
#

I'm actually not sure that anything but the first is necessary. All the original settings in the config file worked for me beyond these changes.