| 1 | # invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
|
|---|
| 2 |
|
|---|
| 3 | ifneq (${PKG_SOURCE_URL},)
|
|---|
| 4 | ifeq (${PKG_SOURCE},)
|
|---|
| 5 | PKG_SOURCE:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
|
|---|
| 6 | endif
|
|---|
| 7 | endif
|
|---|
| 8 | ifneq (${PKG_SOURCE},)
|
|---|
| 9 | DISTFILES?= ${DL_DIR}/${PKG_SOURCE}
|
|---|
| 10 | endif
|
|---|
| 11 |
|
|---|
| 12 | WRKDIR?= ${BUILD_DIR}/w-${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
|
|---|
| 13 | WRKSRC?= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
|
|---|
| 14 | WRKBUILD?= ${WRKSRC}
|
|---|
| 15 | WRKINST?= ${WRKDIR}/ipkg-install
|
|---|
| 16 |
|
|---|
| 17 | define PKG_template
|
|---|
| 18 | IPKG_$(1)= $(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk
|
|---|
| 19 | IDIR_$(1)= $(WRKDIR)/ipkg/$(2)
|
|---|
| 20 | INFO_$(1)= $(IPKG_STATE_DIR)/info/$(2).list
|
|---|
| 21 |
|
|---|
| 22 | ifneq ($(FWRT_PACKAGE_$(1)),)
|
|---|
| 23 | compile-targets: $$(IPKG_$(1))
|
|---|
| 24 | endif
|
|---|
| 25 | ifneq ($(DEVELOPER),)
|
|---|
| 26 | compile-targets: $$(IPKG_$(1))
|
|---|
| 27 | endif
|
|---|
| 28 | ifeq ($(FWRT_PACKAGE_$(1)),y)
|
|---|
| 29 | install-targets: $$(INFO_$(1))
|
|---|
| 30 | endif
|
|---|
| 31 |
|
|---|
| 32 | IDEPEND_$(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))
|
|---|
| 48 | clean: $(2)-clean
|
|---|
| 49 | endef
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | ifneq (${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)
|
|---|
| 56 | endif
|
|---|
| 57 |
|
|---|
| 58 | ifneq (${DISTFILES}${PKG_SOURCE},)
|
|---|
| 59 | $(WRKBUILD)/.prepared: ${DISTFILES}
|
|---|
| 60 | rm -rf ${WRKSRC} ${WRKBUILD}
|
|---|
| 61 | ${EXTRACT_CMD}
|
|---|
| 62 | [ ! -d ./patches ] || $(PATCH) $(WRKSRC) ./patches
|
|---|
| 63 | touch $(WRKBUILD)/.prepared
|
|---|
| 64 | endif
|
|---|
| 65 |
|
|---|
| 66 | all: compile
|
|---|
| 67 |
|
|---|
| 68 | source: ${DISTFILES}
|
|---|
| 69 | prepare: source
|
|---|
| 70 | @[ -f $(WRKBUILD)/.prepared ] || { \
|
|---|
| 71 | $(CMD_TRACE) "preparing... "; \
|
|---|
| 72 | $(MAKE) $(WRKBUILD)/.prepared $(MAKE_TRACE); \
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | configure: prepare
|
|---|
| 76 | @[ -f $(WRKBUILD)/.configured ] || { \
|
|---|
| 77 | $(CMD_TRACE) "configuring... "; \
|
|---|
| 78 | $(MAKE) $(WRKBUILD)/.configured $(MAKE_TRACE); \
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | compile-targets:
|
|---|
| 82 | compile: configure
|
|---|
| 83 | @$(CMD_TRACE) "compiling... "
|
|---|
| 84 | @$(MAKE) compile-targets $(MAKE_TRACE)
|
|---|
| 85 |
|
|---|
| 86 | install-targets:
|
|---|
| 87 | install:
|
|---|
| 88 | @$(CMD_TRACE) "installing... "
|
|---|
| 89 | @$(MAKE) install-targets $(MAKE_TRACE)
|
|---|
| 90 |
|
|---|
| 91 | $(WRKBUILD)/.configured:
|
|---|
| 92 | $(WRKBUILD)/.built:
|
|---|
| 93 |
|
|---|
| 94 | $(PACKAGE_DIR):
|
|---|
| 95 | mkdir -p $@
|
|---|
| 96 |
|
|---|
| 97 | clean-targets:
|
|---|
| 98 | clean:
|
|---|
| 99 | @$(CMD_TRACE) "cleaning... "
|
|---|
| 100 | @$(MAKE) clean-targets $(MAKE_TRACE)
|
|---|
| 101 | rm -rf ${WRKDIR}
|
|---|
| 102 |
|
|---|
| 103 | update-patches:
|
|---|
| 104 | @echo >&2 not ready;exit 1
|
|---|
| 105 | @toedit=$$(WRKDIST='${WRKSRC}' PATCHDIR=$$(pwd)/patches \
|
|---|
| 106 | PATCH_LIST='${PATCH_LIST}' DIFF_ARGS= \
|
|---|
| 107 | DISTORIG=.bak.orig PATCHORIG=.orig \
|
|---|
| 108 | ${BASH} ${TOPDIR}/scripts/update-patches); \
|
|---|
| 109 | if [[ -n $$toedit ]]; then \
|
|---|
| 110 | read i?'edit patches: '; \
|
|---|
| 111 | cd patches && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit; \
|
|---|
| 112 | fi
|
|---|
| 113 |
|
|---|
| 114 | .PHONY: all source prepare compile install clean update-patches
|
|---|