summaryrefslogtreecommitdiffhomepage
path: root/contrib/uci/Makefile
blob: bac8ee8ac15bad5520e0fcd9d614620ae7a92970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
include ../../build/config.mk
include ../../build/gccconfig.mk

UCI_VERSION  = 0.6.0
UCI_APPEND   = +luci2
#UCI_SITE    = http://mirror2.openwrt.org/sources
#UCI_DIR     = uci-$(UCI_VERSION)
#UCI_FILE    = $(UCI_DIR).tar.gz
#UCI_URL     = $(UCI_SITE)/$(UCI_FILE)
UCI_GITREV   = a5256582f5a554c0cbcf45d19bb751e60ea42ce9
UCI_SITE     = http://nbd.name
UCI_DIR      = uci.git
UCI_FILE     = uci-$(UCI_VERSION)$(UCI_APPEND).tar.gz
UCI_URL      = $(UCI_SITE)/gitweb.cgi?p=uci.git;a=snapshot;h=$(UCI_GITREV)
UCI_PATCHDIR = patches

all: compile

include ../../build/module.mk

$(UCI_FILE):
	wget -O $@ "$(UCI_URL)" || rm -f $@

$(UCI_PATCHDIR)/series:
	(cd $(UCI_PATCHDIR); ls *.patch | sort > series)

$(UCI_DIR)/.prepared: $(UCI_FILE)
	rm -rf $(UCI_DIR)
	tar xvfz $(UCI_FILE)
	ln -s ../$(UCI_PATCHDIR) $(UCI_DIR)/patches
	touch $@

$(UCI_DIR)/.patched: $(UCI_DIR)/.prepared $(UCI_PATCHDIR)/series
	(cd $(UCI_DIR); \
		if [ -x "$$(which quilt 2>/dev/null)" ]; then \
			quilt push -a; \
		else \
			cat patches/*.patch | patch -p1; \
		fi; \
	)
	touch $@

refresh: $(UCI_DIR)/.patched
	(cd $(UCI_DIR); \
		for i in $$(quilt series); do \
			quilt refresh $$i; \
		done; \
	)

compile: $(UCI_DIR)/.patched
	$(MAKE) -C $(UCI_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
	mkdir -p dist/usr/lib dist/usr/bin
	$(MAKE) -C $(UCI_DIR) install DESTDIR=../dist prefix=/usr
	$(MAKE) -C $(UCI_DIR)/lua CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
	$(MAKE) -C $(UCI_DIR)/lua install DESTDIR=../../dist luadir=$(LUA_LIBRARYDIR)
	mv dist$(LUA_LIBRARYDIR)/uci.so dist$(LUA_LIBRARYDIR)/uci2.so

compile-all: compile

clean:
	rm -rf $(UCI_DIR) $(UCI_FILE)