source: freewrt/package/rules.mk@ 7ffa231

freewrt_1_0 freewrt_2_0
Last change on this file since 7ffa231 was 7ffa231, checked in by Waldemar Brodkorb <wbx@…>, 19 years ago

fix patch apply, files did not get expanded

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

  • Property mode set to 100644
File size: 3.2 KB
Line 
1# $FreeWRT$
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 {patch-*,*.patch}
64 [ ! -d ./patches ] || (fgrep -q '@@ -0,0 ' patches/{patch-*,*.patch} \
65 >/dev/null 2>&1 && touch ${WRKSRC}/.patched-newfiles || :)
66 [ ! -d ./extra ] || (cd extra; $(PREVENT_PATCH) pax -rw . ${WRKSRC}/)
67 touch $(WRKBUILD)/.prepared
68endif
69
70all: compile
71
72source: ${DISTFILES}
73prepare: source
74 @[ -f $(WRKBUILD)/.prepared ] || { \
75 $(CMD_TRACE) "preparing... "; \
76 $(MAKE) $(WRKBUILD)/.prepared $(MAKE_TRACE); \
77 }
78
79configure: prepare
80 @[ -f $(WRKBUILD)/.configured ] || { \
81 $(CMD_TRACE) "configuring... "; \
82 $(MAKE) $(WRKBUILD)/.configured $(MAKE_TRACE); \
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
95$(WRKBUILD)/.configured:
96$(WRKBUILD)/.built:
97
98$(PACKAGE_DIR):
99 mkdir -p $@
100
101clean-targets:
102clean:
103 @$(CMD_TRACE) "cleaning... "
104 @$(MAKE) clean-targets $(MAKE_TRACE)
105 rm -rf ${WRKDIR}
106
107update-patches:
108 @test ! -d ${WRKDIR}.orig || rm -rf ${WRKDIR}.orig
109 @test ! -d ${WRKDIR}.orig
110 @$(MAKE) -s V=0 prepare WRKDIR=${WRKDIR}.orig PREVENT_PATCH=:
111 @toedit=$$(WRKDIST='${WRKSRC}' CURDIR=$$(pwd) \
112 PATCH_LIST='patch-* *.patch' WRKDIR1='${WRKDIR}' \
113 ${BASH} ${TOPDIR}/scripts/update-patches); \
114 if [[ -n $$toedit && $$toedit != FAIL ]]; then \
115 echo -n 'edit patches: '; read i; \
116 cd patches && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \
117 fi; \
118 rm -rf ${WRKDIR}.orig; \
119 [[ $$toedit != FAIL ]]
120
121.PHONY: all source prepare compile install clean update-patches
Note: See TracBrowser for help on using the repository browser.