Index: Makefile --- Makefile.orig 2008-10-25 17:26:26 +0200 +++ Makefile 2010-02-08 12:01:53 +0100 @@ -1,37 +1,35 @@ # TODO: support for abi&libtool, installation of lua-curl.h -LIBNAME=liblua5.1-curl +LIBNAME=libcurl LIBTOOL=libtool --silent --tag=CC -HEADER=/usr/include/curl/curl.h +HEADER=$(PREFIX)/include/curl/curl.h PREFIX=/usr/local/ #LUA=lua50 -LUA=lua5.1 -LUADOC= luadoc +LUA=$(PREFIX)/bin/lua +LUADOC= $(PREFIX)/bin/luadoc VERSION_INFO=0:0:0 CONSTANTS:= curlopt.h curl_netrcopt.h \ curl_form.h curl_authopt.h curl_ftpauthopt.h curl_ftpmethods.h -CURL_CFLAGS:= $(shell curl-config --cflags 2>/dev/null) $(shell getconf LFS_CFLAGS) +CURL_CFLAGS:= $(shell curl-config --cflags 2>/dev/null) CURL_LDFLAGS:= $(shell curl-config --libs 2>/dev/null) REALSO:=$(LIBNAME).so.$(subst :,.,$(VERSION_INFO)) # ------------------------------ lua5.1 stuff --------------------------------- -ifeq "$(LUA)" "lua5.1" -LUA_CFLAGS := $(shell pkg-config lua5.1 --cflags) $(shell getconf LFS_CFLAGS) +LUA_CFLAGS := $(shell pkg-config lua --cflags) # This retrieves the name of the libtool convenience library for Lua # (e.g. "/usr/lib/liblua5.1.la") used by --mode=link. -LUA_LIBTOOL_S := $(shell pkg-config lua5.1 --variable=libtool_lib) +LUA_LIBTOOL_S := $(shell pkg-config lua --variable=libtool_lib) LUA_LIBTOOL_D := $(LUA_LIBTOOL_S) # this is the path where you'll eventually install the module -LUA_RPATH:=$(shell pkg-config lua5.1 --define-variable=prefix=$(PREFIX) \ +LUA_RPATH:=$(shell pkg-config lua --define-variable=prefix=$(PREFIX) \ --variable=INSTALL_CMOD) # this is the path where you'll eventually install the C header file -LUA_HPATH:=$(shell pkg-config lua5.1 --define-variable=prefix=$(PREFIX) \ +LUA_HPATH:=$(shell pkg-config lua --define-variable=prefix=$(PREFIX) \ --variable=includedir)/lua5.1 LUA_DPATH:=$(PREFIX)/share/doc/luacurl/ LUA_LPATH:=$(PREFIX)/lib/ -OBJS:= lua-curl.lo luabind.lo -endif +OBJS:= lua-curl.o luabind.o # ------------------------------ lua50 stuff --------------------------------- ifeq "$(LUA)" "lua50" @@ -47,7 +45,7 @@ endif # ------------------------- Here the Makefile -------------------------------- -all: $(LIBNAME).la +all: curl.so constants:$(CONSTANTS) doc: doc/curl.html doc/curl.html: lua-curl.luadoc @@ -55,20 +53,16 @@ $(LUADOC) -d `pwd`/doc/ `pwd`/doc/*.lua rm -f doc/*.lua doc/index.html -%.lo: %.c - $(LIBTOOL) --mode=compile $(CC) -c -Wall -O2 $(LUA_CFLAGS) $< +%.o: %.c + $(CC) -c -Wall -O2 -fPIC $(CURL_CFLAGS) $(LUA_CFLAGS) $< # link objects to make static and dynamic libraries. The .so will be # left in "./.libs/". Note that the Lua library and its dependencies are # not called out on the link line since they are assumed to be part of # whatever our library is linked to. We want to avoid duplicate library # copies, which is a waste of space and can cause run-time problems. -$(LIBNAME).la curl.so: constants $(OBJS) - $(LIBTOOL) --mode=link $(CC) \ - -rpath $(LUA_RPATH) -o $(LIBNAME).la \ - -version-info $(VERSION_INFO) \ - $(CURL_LDFLAGS) $(OBJS) - ln -sf ./.libs/$(REALSO) curl.so +curl.so: constants $(OBJS) + $(CC) -shared -o curl.so $(OBJS) $(CURL_LDFLAGS) -llua # If all went well, we can dynamically load the module into Lua. The # following will load the library into the interpreter and call a function.