source: freewrt/package/rules.mk@ 2c09dbb

freewrt_1_0 freewrt_2_0
Last change on this file since 2c09dbb was 2c09dbb, checked in by Thorsten Glaser <tg@…>, 19 years ago

if PKG_CAT is unset we still want to be able to extract

git-svn-id: svn://www.freewrt.org/trunk/freewrt@256 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 2.5 KB
Line 
1# invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
2
3WRKDIR?= ${PKG_BUILD_DIR}/..
4DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
5
6define PKG_template
7IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
8IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
9INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
10
11ifneq ($(BR2_PACKAGE_$(1)),)
12compile-targets: $$(IPKG_$(1))
13endif
14ifneq ($(DEVELOPER),)
15compile-targets: $$(IPKG_$(1))
16endif
17ifeq ($(BR2_PACKAGE_$(1)),y)
18install-targets: $$(INFO_$(1))
19endif
20
21IDEPEND_$(1):=$$(strip $(5))
22
23$$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
24 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
25 if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control; fi
26 for file in conffiles preinst postinst prerm postrm; do \
27 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
28 done
29
30$$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
31
32$$(INFO_$(1)): $$(IPKG_$(1))
33 $(IPKG) install $$(IPKG_$(1))
34
35$(2)-clean:
36 rm -f $$(IPKG_$(1))
37clean: $(2)-clean
38endef
39
40
41ifneq ($(strip $(PKG_SOURCE)),)
42$(DL_DIR)/$(PKG_SOURCE):
43 @$(CMD_TRACE) "downloading... "
44 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
45endif
46
47$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
48 rm -rf $(PKG_BUILD_DIR)
49 ${EXTRACT_CMD}
50 if [ -d ./patches ]; then \
51 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
52 fi
53 touch $(PKG_BUILD_DIR)/.prepared
54
55all: compile
56
57source: $(DL_DIR)/$(PKG_SOURCE)
58prepare: source
59 @[ -f $(PKG_BUILD_DIR)/.prepared ] || { \
60 $(CMD_TRACE) "preparing... "; \
61 $(MAKE) $(PKG_BUILD_DIR)/.prepared $(MAKE_TRACE); \
62 }
63
64configure: prepare
65 @[ -f $(PKG_BUILD_DIR)/.configured ] || { \
66 $(CMD_TRACE) "configuring... "; \
67 $(MAKE) $(PKG_BUILD_DIR)/.configured $(MAKE_TRACE); \
68 }
69
70compile-targets:
71compile: configure
72 @$(CMD_TRACE) "compiling... "
73 @$(MAKE) compile-targets $(MAKE_TRACE)
74
75install-targets:
76install:
77 @$(CMD_TRACE) "installing... "
78 @$(MAKE) install-targets $(MAKE_TRACE)
79
80mostlyclean:
81rebuild:
82 $(CMD_TRACE) "rebuilding... "
83 @-$(MAKE) mostlyclean 2>&1 >/dev/null
84 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
85 $(MAKE) clean $(MAKE_TRACE); \
86 fi
87 $(MAKE) compile $(MAKE_TRACE)
88
89$(PKG_BUILD_DIR)/.configured:
90$(PKG_BUILD_DIR)/.built:
91
92$(PACKAGE_DIR):
93 mkdir -p $@
94
95clean-targets:
96clean:
97 @$(CMD_TRACE) "cleaning... "
98 @$(MAKE) clean-targets $(MAKE_TRACE)
99 rm -rf $(PKG_BUILD_DIR)
100
101.PHONY: all source prepare compile install clean
Note: See TracBrowser for help on using the repository browser.