source: freewrt/package/rules.mk@ ed2dd9f

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

instead of setting WRKBUILD, set WRKSRC and let WRKBUILD?=WRKSRC like mirports
(WRKSRC isn't used anywhere though)

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

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