source: freewrt/package/rules.mk@ 1b4c85d

freewrt_1_0 freewrt_2_0
Last change on this file since 1b4c85d was 1b4c85d, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • limit matching of patches to patch-* and *.patch
  • if any patch contains an @@ -0,0 +n,m @@ chunk, touch ${WRKSRC}/.patched-newfiles to be aware of that

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

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