- ifeq ($(PKGARCH),)
- PKGARCH:=$(ARCH)
- endif
-
- ifeq ($(DESCRIPTION),)
- $(eval DESCRIPTION:=$(TITLE))
- endif
-
- IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
- IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
- INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
-
- ifdef Package/$(1)/install
- ifeq ($(CONFIG_PACKAGE_$(1)),y)
- install-targets: $$(INFO_$(1))
- endif
-
- ifneq ($(CONFIG_PACKAGE_$(1)),)
- compile-targets: $$(IPKG_$(1))
- else
- compile-targets: $(1)-disabled
- $(1)-disabled:
- @echo "WARNING: skipping $(1) -- package not selected"
- endif
- endif
-
- ifeq ($(FORCEREBUILD),y)
- $$(IPKG_$(1)): FORCE
- endif
-
- IDEPEND_$(1):=$$(strip $$(DEPENDS))
-
- ifneq ($(DUMP),)
- DUMPINFO += \
- echo "Package: $(1)";
-
- ifneq ($(MENU),)
- DUMPINFO += \
- echo "Menu: $(MENU)";
- endif
-
- ifneq ($(SUBMENU),)
- DUMPINFO += \
- echo "Submenu: $(SUBMENU)";
- ifneq ($(SUBMENUDEP),)
- DUMPINFO += \
- echo "Submenu-Depends: $(SUBMENUDEP)";
- endif
- endif
-
- ifneq ($(DEFAULT),)
- DUMPINFO += \
- echo "Default: $(DEFAULT)";
- endif
-
- DUMPINFO += \
- echo "Version: $(VERSION)"; \
- echo "Depends: $$(IDEPEND_$(1))"; \
- echo "Build-Depends: $(PKG_BUILDDEP)"; \
- echo "Category: $(CATEGORY)"; \
- echo "Title: $(TITLE)"; \
- echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g';
-
- ifneq ($(URL),)
- DUMPINFO += \
- echo; \
- echo "$(URL)";
- endif
-
- DUMPINFO += \
- echo "@@";
-
- ifneq ($(CONFIG),)
- DUMPINFO += \
- echo "Config: $(CONFIG)" | sed -e 's,\\,\n,g'; \
- echo "@@";
- endif
- endif
-
- $(eval $(call BuildIPKGVariable,$(1),conffiles))
- $(eval $(call BuildIPKGVariable,$(1),preinst))
- $(eval $(call BuildIPKGVariable,$(1),postinst))
- $(eval $(call BuildIPKGVariable,$(1),prerm))
- $(eval $(call BuildIPKGVariable,$(1),postrm))
- $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
- mkdir -p $$(IDIR_$(1))/CONTROL
- echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
- echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
- ( \
- DEPENDS=; \
- for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
- DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
- done; \
- echo "Depends: $(EXTRA_DEPENDS) $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
- )
- echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
- echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
- echo "Priority: $(PRIORITY)" >> $$(IDIR_$(1))/CONTROL/control
- echo "Maintainer: $(MAINTAINER)" >> $$(IDIR_$(1))/CONTROL/control
- echo "Architecture: $(PKGARCH)" >> $$(IDIR_$(1))/CONTROL/control
- echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(IDIR_$(1))/CONTROL/control
- chmod 644 $$(IDIR_$(1))/CONTROL/control
- (cd $$(IDIR_$(1))/CONTROL; \
- $($(1)_COMMANDS) \
- )
-
- $$(IPKG_$(1)): $(PKG_BUILD_DIR)/.built $$(IDIR_$(1))/CONTROL/control
- $(call Package/$(1)/install,$$(IDIR_$(1)))
- mkdir -p $(PACKAGE_DIR)
- -find $$(IDIR_$(1)) -name CVS | xargs rm -rf
- -find $$(IDIR_$(1)) -name .svn | xargs rm -rf
- -find $$(IDIR_$(1)) -name '.#*' | xargs rm -f
- $(RSTRIP) $$(IDIR_$(1))
- $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
- @[ -f $$(IPKG_$(1)) ] || false
-
- $$(INFO_$(1)): $$(IPKG_$(1))
- $(IPKG) install $$(IPKG_$(1))
-
- $(1)-clean:
- rm -f $(PACKAGE_DIR)/$(1)_*
-
- clean: $(1)-clean
-
- $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(PKG_BUILD_DIR)/.prepared
- -@rm $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null
- @touch $$@
-
- $$(eval $$(call Build/DefaultTargets,$(1)))
-
- ifneq ($$(CONFIG_PACKAGE_$(1)),)
- ifneq ($(MAKECMDGOALS),prereq)
- ifneq ($(DUMP),1)
- ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install $$(IPKG_$(1)) $(PKG_BUILD_DIR)),$$(IPKG_$(1)))
- _INFO+=$(subst $(TOPDIR)/,,$$(IPKG_$(1)))
- $(PKG_BUILD_DIR)/.built: package-rebuild
- endif
-
- ifneq ($$(_INFO),)
- $$(info Rebuilding $$(_INFO))
- endif
- endif
- endif
- endif
-endef
-
-ifneq ($(strip $(PKG_CAT)),)
- ifeq ($(PKG_CAT),unzip)
- UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
- else
- UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
- endif
- define Build/Prepare/Default
- $(UNPACK)
- @if [ -d ./patches ]; then \
- $(PATCH) $(PKG_BUILD_DIR) ./patches; \
- fi
- endef
-endif