lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


@Yuri & @Thijs

Thank you for the replies.

It seems that using the binaries from ZeroBraneStudio and the procedure I deduced from Paul's bash script I managed to have it working.

To see if it still works when compiling from sources I managed also to
concoct the attached makefile (please, don't barf at it, I know it's ugly; I'm no makefile genius and I'm in RAD mode, too! :-) to mimick
the behaviour of that bash script.

After the build target has completed, I just copy the content of the luasocket subdir into the root of my Lua searchpath (I use this manual step to ensure that if something goes awry in that mess of a makefile, it doesn't mess up my Lua installation!) and run the test.

It works!

-- Lorenzo
.PHONY:    build clean

LUA_DIR = $(LD.lua.dir)
LUA_INCLUDE_DIR = $(LUA_DIR)/app/Lua51/include
LUA_DLL_DIR = $(LUA_DIR)/app/Lua51/bin

BUILD_DIR := $(abspath ./)/luasocket

LUASOCKET_BASENAME = luasocket-2.0.3
LUASOCKET_FILENAME = $(LUASOCKET_BASENAME)-rc2.zip

BUILD_FLAGS = -O2 -shared -s -I "$(LUA_INCLUDE_DIR)" -L "$(LUA_DLL_DIR)"


build:
	@echo Building to dir: $(BUILD_DIR)
	unzip -o $(LUASOCKET_FILENAME)
	-mkdir "$(BUILD_DIR)/mime"
	-mkdir "$(BUILD_DIR)/socket"
	cd $(LUASOCKET_BASENAME)/src && \
		gcc $(BUILD_FLAGS) \
			-o "$(BUILD_DIR)/mime/core.dll" mime.c -llua51 && \
		gcc $(BUILD_FLAGS) \
			-o "$(BUILD_DIR)/socket/core.dll" \
			auxiliar.c buffer.c except.c inet.c io.c luasocket.c options.c select.c tcp.c timeout.c udp.c wsocket.c -lwsock32 -llua51 && \
		cp ftp.lua http.lua smtp.lua tp.lua url.lua headers.lua "$(BUILD_DIR)/socket" && \
		cp ltn12.lua mime.lua socket.lua "$(BUILD_DIR)"

clean:
	-rd $(LUASOCKET_BASENAME) /S/Q
	-rd "$(BUILD_DIR)" /S/Q