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