source: freewrt/package/rules.mk@ 021d11b

freewrt_1_0 freewrt_2_0
Last change on this file since 021d11b was 2744f3f, checked in by Thorsten Glaser <tg@…>, 19 years ago

allow CPIO distfiles

agreed wbx@

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

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