Change source URLs to local mirror
[project/luci.git] / contrib / luaposix / Makefile
1 include ../../build/config.mk
2 include ../../build/gccconfig.mk
3
4 LUAPOSIX_VERSION = 5.1.3
5 LUAPOSIX_SITE = http://dev.luci.freifunk-halle.net/sources/
6 LUAPOSIX_DIR = luaposix-$(LUAPOSIX_VERSION)
7 LUAPOSIX_FILE = $(LUAPOSIX_DIR).tar.gz
8 LUAPOSIX_URL = $(LUAPOSIX_SITE)/$(LUAPOSIX_FILE)
9 LUAPOSIX_PATCHDIR = patches
10
11 all: compile
12
13 include ../../build/module.mk
14
15 $(LUAPOSIX_FILE):
16         wget -O $@ $(LUAPOSIX_URL) || rm -f $@
17
18 $(LUAPOSIX_PATCHDIR)/series:
19         (cd $(LUAPOSIX_PATCHDIR); ls *.patch | sort > series)
20
21 $(LUAPOSIX_DIR)/.prepared: $(LUAPOSIX_FILE)
22         rm -rf $(LUAPOSIX_DIR)
23         tar xvfz $(LUAPOSIX_FILE)
24         ln -s ../$(LUAPOSIX_PATCHDIR) $(LUAPOSIX_DIR)/patches
25         touch $@
26
27 $(LUAPOSIX_DIR)/.patched: $(LUAPOSIX_DIR)/.prepared $(LUAPOSIX_PATCHDIR)/series
28         (cd $(LUAPOSIX_DIR); \
29                 if [ -x "$$(which quilt 2>/dev/null)" ]; then \
30                         quilt push -a; \
31                 else \
32                         cat patches/*.patch | patch -p1; \
33                 fi; \
34         )
35         touch $@
36
37 compile: $(LUAPOSIX_DIR)/.patched
38         $(MAKE) -C $(LUAPOSIX_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(LUA_CFLAGS)" LDFLAGS="$(LDFLAGS) $(LUA_SHLIBS)" OS="$(OS)"
39         mkdir -p dist$(LUA_LIBRARYDIR)
40         cp $(LUAPOSIX_DIR)/posix.so dist$(LUA_LIBRARYDIR)
41
42 luasource:
43 luastrip:
44 luacompile:
45 compile-all: compile
46
47 clean:
48         rm -rf $(LUAPOSIX_DIR) $(LUAPOSIX_FILE)
49         rm -f $(LUAPOSIX_PATCHDIR)/series