source: freewrt/package/rules.mk@ aee909e

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

allow automatic copy of a hierarchy rooted in extra/
into ${WRKSRC} (and prevent these from being included
in patches)

agreed wbx@ on the phone

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

  • Property mode set to 100644
File size: 3.1 KB
Line 
1# invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
2
3ifneq (${PKG_SOURCE_URL},)
4ifeq (${PKG_SOURCE},)
5PKG_SOURCE:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
6endif
7endif
8ifneq (${PKG_SOURCE},)
9DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
10endif
11
12WRKDIR?= ${BUILD_DIR}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
13WRKSRC?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
14WRKBUILD?= ${WRKSRC}
15WRKINST?= ${WRKDIR}/ipkg-install
16
17define PKG_template
18IPKG_$(1)= $(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
19IDIR_$(1)= $(WRKDIR)/ipkg/$(2)
20INFO_$(1)= $(IPKG_STATE_DIR)/info/$(2).list
21
22ifneq ($(FWRT_PACKAGE_$(1)),)
23compile-targets: $$(IPKG_$(1))
24endif
25ifneq ($(DEVELOPER),)
26compile-targets: $$(IPKG_$(1))
27endif
28ifeq ($(FWRT_PACKAGE_$(1)),y)
29install-targets: $$(INFO_$(1))
30endif
31
32IDEPEND_$(1):= $$(strip $(5))
33
34$$(IDIR_$(1))/CONTROL/control: $(WRKBUILD)/.prepared
35 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(IDIR_$(1)) ./ipkg/$(2).control $(3) $(4)
36 [ -z "$$(IDEPEND_$(1))" ] || echo "Depends: $$(IDEPEND_$(1))" >>$$(IDIR_$(1))/CONTROL/control
37 for file in conffiles preinst postinst prerm postrm; do \
38 [ ! -f ./ipkg/$(2).$$$$file ] || cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file; \
39 done
40
41$$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(WRKBUILD)/.built $(PACKAGE_DIR)
42
43$$(INFO_$(1)): $$(IPKG_$(1))
44 $(IPKG) install $$(IPKG_$(1))
45
46$(2)-clean:
47 rm -f $$(IPKG_$(1))
48clean: $(2)-clean
49endef
50
51
52ifneq (${PKG_SOURCE_URL},)
53$(DL_DIR)/$(PKG_SOURCE):
54 @$(CMD_TRACE) "downloading... "
55 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
56endif
57
58ifneq (${DISTFILES}${PKG_SOURCE},)
59$(WRKBUILD)/.prepared: ${DISTFILES}
60 rm -rf ${WRKSRC} ${WRKBUILD}
61 ${EXTRACT_CMD}
62 [ ! -d ./patches ] || $(PREVENT_PATCH) $(PATCH) $(WRKSRC) ./patches
63 [ ! -d ./extra ] || (cd extra; $(PREVENT_PATCH) pax -rw . ${WRKSRC}/)
64 touch $(WRKBUILD)/.prepared
65endif
66
67all: compile
68
69source: ${DISTFILES}
70prepare: source
71 @[ -f $(WRKBUILD)/.prepared ] || { \
72 $(CMD_TRACE) "preparing... "; \
73 $(MAKE) $(WRKBUILD)/.prepared $(MAKE_TRACE); \
74 }
75
76configure: prepare
77 @[ -f $(WRKBUILD)/.configured ] || { \
78 $(CMD_TRACE) "configuring... "; \
79 $(MAKE) $(WRKBUILD)/.configured $(MAKE_TRACE); \
80 }
81
82compile-targets:
83compile: configure
84 @$(CMD_TRACE) "compiling... "
85 @$(MAKE) compile-targets $(MAKE_TRACE)
86
87install-targets:
88install:
89 @$(CMD_TRACE) "installing... "
90 @$(MAKE) install-targets $(MAKE_TRACE)
91
92$(WRKBUILD)/.configured:
93$(WRKBUILD)/.built:
94
95$(PACKAGE_DIR):
96 mkdir -p $@
97
98clean-targets:
99clean:
100 @$(CMD_TRACE) "cleaning... "
101 @$(MAKE) clean-targets $(MAKE_TRACE)
102 rm -rf ${WRKDIR}
103
104update-patches:
105 @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
106 @test ! -d ${WRKDIR}.orig
107 @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
108 @toedit=$$(WRKDIST='${WRKSRC}' CURDIR=$$(pwd) \
109 PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
110 ${BASH} ${TOPDIR}/scripts/update-patches); \
111 if [[ -n $$toedit && $$toedit != FAIL ]]; then \
112 echo -n 'edit patches: '; read i; \
113 cd patches && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \
114 fi; \
115 rm -rf ${WRKDIR}.orig; \
116 [[ $$toedit != FAIL ]]
117
118.PHONY: all source prepare compile install clean update-patches
Note: See TracBrowser for help on using the repository browser.