2006-04-19 23:14:13 +00:00
|
|
|
ifneq ($(DUMP),)
|
|
|
|
all: dumpinfo
|
|
|
|
else
|
2006-04-14 03:03:32 +00:00
|
|
|
all: compile
|
2006-04-20 03:53:28 +00:00
|
|
|
endif
|
2006-04-14 03:03:32 +00:00
|
|
|
|
|
|
|
define Build/DefaultTargets
|
|
|
|
$(PKG_BUILD_DIR)/.prepared:
|
|
|
|
rm -rf $(PKG_BUILD_DIR)
|
|
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
|
|
$(call Build/Prepare)
|
|
|
|
touch $$@
|
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
|
2006-04-14 03:03:32 +00:00
|
|
|
$(call Build/Configure)
|
|
|
|
touch $$@
|
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
ifeq ($(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),.)
|
|
|
|
$(PKG_BUILD_DIR)/.prepared: clean
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
|
2006-04-14 03:03:32 +00:00
|
|
|
$(call Build/Compile)
|
|
|
|
touch $$@
|
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
package-clean:
|
|
|
|
$(call Build/Clean)
|
|
|
|
rm -f $(PKG_BUILD_DIR)/.built
|
|
|
|
|
|
|
|
package-recompile:
|
|
|
|
rm -f $(PKG_BUILD_DIR)/.built
|
|
|
|
|
|
|
|
.PHONY: package-clean package-recompile
|
|
|
|
|
2006-04-14 03:11:20 +00:00
|
|
|
define Build/DefaultTargets
|
|
|
|
endef
|
2006-04-14 03:03:32 +00:00
|
|
|
endef
|
2005-07-24 19:58:14 +00:00
|
|
|
|
2006-04-19 23:56:04 +00:00
|
|
|
define Package/Default
|
2006-04-14 01:22:55 +00:00
|
|
|
CONFIGFILE:=
|
|
|
|
SECTION:=opt
|
|
|
|
CATEGORY:=Extra packages
|
|
|
|
DEPENDS:=
|
|
|
|
MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
|
|
|
|
SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
|
|
|
|
VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
|
|
|
|
PKGARCH:=$(ARCH)
|
|
|
|
PRIORITY:=optional
|
|
|
|
TITLE:=
|
|
|
|
DESCRIPTION:=
|
2006-04-19 23:56:04 +00:00
|
|
|
endef
|
2006-04-14 01:22:55 +00:00
|
|
|
|
2006-04-19 23:56:04 +00:00
|
|
|
define BuildPackage
|
2006-04-20 00:03:19 +00:00
|
|
|
$(eval $(call Package/Default))
|
|
|
|
$(eval $(call Package/$(1)))
|
2006-04-14 01:22:55 +00:00
|
|
|
|
|
|
|
ifeq ($$(TITLE),)
|
2006-04-14 03:03:32 +00:00
|
|
|
$$(error Package $(1) has no TITLE)
|
2006-04-14 01:22:55 +00:00
|
|
|
endif
|
|
|
|
ifeq ($$(CATEGORY),)
|
2006-04-14 03:03:32 +00:00
|
|
|
$$(error Package $(1) has no CATEGORY)
|
2006-04-14 01:22:55 +00:00
|
|
|
endif
|
|
|
|
ifeq ($$(PRIORITY),)
|
2006-04-14 03:03:32 +00:00
|
|
|
$$(error Package $(1) has no PRIORITY)
|
2006-04-14 01:22:55 +00:00
|
|
|
endif
|
|
|
|
ifeq ($$(VERSION),)
|
2006-04-14 03:03:32 +00:00
|
|
|
$$(error Package $(1) has no VERSION)
|
2006-04-14 01:22:55 +00:00
|
|
|
endif
|
|
|
|
ifeq ($$(PKGARCH),)
|
|
|
|
PKGARCH:=$(ARCH)
|
|
|
|
endif
|
|
|
|
|
2006-04-14 03:03:32 +00:00
|
|
|
IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
|
|
|
|
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
|
|
|
|
INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
|
2005-05-09 09:33:23 +00:00
|
|
|
|
2006-04-14 04:27:05 +00:00
|
|
|
ifneq ($(PACKAGE_$(1)),)
|
2006-04-20 03:45:03 +00:00
|
|
|
COMPILE_$(1):=1
|
2005-05-09 09:33:23 +00:00
|
|
|
endif
|
2005-05-30 20:22:21 +00:00
|
|
|
ifneq ($(DEVELOPER),)
|
2006-04-20 03:45:03 +00:00
|
|
|
COMPILE_$(1):=1
|
2005-05-30 20:22:21 +00:00
|
|
|
endif
|
2006-04-14 04:27:05 +00:00
|
|
|
ifeq ($(PACKAGE_$(1)),y)
|
2005-10-22 01:40:50 +00:00
|
|
|
install-targets: $$(INFO_$(1))
|
2005-05-09 09:33:23 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
ifneq ($$(COMPILE_$(1)),)
|
|
|
|
ifeq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg $$(IPKG_$(1)) $(PKG_BUILD_DIR)),$(PKG_BUILD_DIR))
|
|
|
|
$(PKG_BUILD_DIR)/.built: package-recompile
|
|
|
|
endif
|
|
|
|
|
|
|
|
compile-targets: $$(IPKG_$(1))
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2006-04-14 01:22:55 +00:00
|
|
|
IDEPEND_$(1):=$$(strip $$(DEPENDS))
|
2006-04-20 00:03:19 +00:00
|
|
|
|
|
|
|
DUMPINFO += \
|
|
|
|
echo "Package: $(1)"; \
|
|
|
|
echo "Version: $(VERSION)"; \
|
|
|
|
echo "Depends: $(IDEPEND_$(1))"; \
|
|
|
|
echo "Title: $(TITLE)"; \
|
|
|
|
echo "$(DESCRIPTION)" | sed -e 's,\\,\n,g'; \
|
|
|
|
echo; \
|
|
|
|
echo "$(URL)"; \
|
|
|
|
echo "@@";
|
|
|
|
|
2005-06-27 10:02:35 +00:00
|
|
|
|
2005-05-09 09:33:23 +00:00
|
|
|
$$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
|
2006-04-14 01:22:55 +00:00
|
|
|
mkdir -p $$(IDIR_$(1))/CONTROL
|
2006-04-20 00:03:19 +00:00
|
|
|
echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
|
|
|
|
echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
|
|
|
|
echo "Depends: $(IDEPEND_$(1))" >> $$(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: $(TITLE)" >> $$(IDIR_$(1))/CONTROL/control
|
2006-04-20 03:45:03 +00:00
|
|
|
echo " $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(IDIR_$(1))/CONTROL/control
|
2006-04-14 01:22:55 +00:00
|
|
|
chmod 644 $$(IDIR_$(1))/CONTROL/control
|
2005-05-09 09:33:23 +00:00
|
|
|
for file in conffiles preinst postinst prerm postrm; do \
|
2006-04-14 03:03:32 +00:00
|
|
|
[ -f ./ipkg/$(1).$$$$file ] && cp ./ipkg/$(1).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
|
2005-05-09 09:33:23 +00:00
|
|
|
done
|
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
$$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built
|
2006-04-14 03:03:32 +00:00
|
|
|
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
2006-04-20 03:45:03 +00:00
|
|
|
mkdir -p $(PACKAGE_DIR)
|
2006-04-14 03:03:32 +00:00
|
|
|
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
|
2005-05-12 17:59:08 +00:00
|
|
|
|
2005-05-09 09:33:23 +00:00
|
|
|
$$(INFO_$(1)): $$(IPKG_$(1))
|
|
|
|
$(IPKG) install $$(IPKG_$(1))
|
|
|
|
|
2006-04-14 03:03:32 +00:00
|
|
|
$(1)-clean:
|
2006-04-20 03:45:03 +00:00
|
|
|
rm -f $(PACKAGE_DIR)/$(1)_*
|
2006-04-14 03:03:32 +00:00
|
|
|
clean: $(1)-clean
|
2005-05-09 09:33:23 +00:00
|
|
|
|
2006-04-14 03:03:32 +00:00
|
|
|
ifneq ($(__DEFAULT_TARGETS),1)
|
|
|
|
$(eval $(call Build/DefaultTargets))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
2005-10-22 01:40:50 +00:00
|
|
|
|
2005-04-18 06:17:39 +00:00
|
|
|
ifneq ($(strip $(PKG_SOURCE)),)
|
|
|
|
$(DL_DIR)/$(PKG_SOURCE):
|
2005-10-22 16:14:30 +00:00
|
|
|
@$(CMD_TRACE) "downloading... "
|
2005-10-22 01:40:50 +00:00
|
|
|
$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
|
2006-04-14 03:03:32 +00:00
|
|
|
|
|
|
|
$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
|
2005-04-18 06:17:39 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(PKG_CAT)),)
|
2006-04-14 03:03:32 +00:00
|
|
|
define Build/Prepare/Default
|
2005-12-13 13:01:01 +00:00
|
|
|
if [ "$(PKG_CAT)" = "unzip" ]; then \
|
|
|
|
unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) ; \
|
|
|
|
else \
|
|
|
|
$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - ; \
|
|
|
|
fi
|
2005-04-18 06:17:39 +00:00
|
|
|
if [ -d ./patches ]; then \
|
|
|
|
$(PATCH) $(PKG_BUILD_DIR) ./patches ; \
|
|
|
|
fi
|
2006-04-14 03:03:32 +00:00
|
|
|
endef
|
2005-04-18 06:17:39 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-14 03:03:32 +00:00
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure/Default
|
|
|
|
# TODO: add configurable default command
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure
|
|
|
|
$(call Build/Configure/Default)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile/Default
|
|
|
|
# TODO: add configurable default command
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
$(call Build/Compile/Default)
|
|
|
|
endef
|
2005-04-18 06:17:39 +00:00
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
define Build/Clean
|
|
|
|
$(MAKE) clean
|
|
|
|
endef
|
|
|
|
|
2006-04-19 23:14:13 +00:00
|
|
|
ifneq ($(DUMP),)
|
|
|
|
dumpinfo:
|
|
|
|
$(DUMPINFO)
|
|
|
|
else
|
|
|
|
|
2005-04-18 06:17:39 +00:00
|
|
|
source: $(DL_DIR)/$(PKG_SOURCE)
|
2005-10-22 16:14:30 +00:00
|
|
|
prepare: source
|
2005-10-22 01:40:50 +00:00
|
|
|
@[ -f $(PKG_BUILD_DIR)/.prepared ] || { \
|
2005-10-22 15:10:20 +00:00
|
|
|
$(CMD_TRACE) "preparing... "; \
|
2005-10-22 01:40:50 +00:00
|
|
|
$(MAKE) $(PKG_BUILD_DIR)/.prepared $(MAKE_TRACE); \
|
|
|
|
}
|
|
|
|
|
2005-10-22 15:10:20 +00:00
|
|
|
configure: prepare
|
2005-10-22 01:40:50 +00:00
|
|
|
@[ -f $(PKG_BUILD_DIR)/.configured ] || { \
|
2005-10-22 15:10:20 +00:00
|
|
|
$(CMD_TRACE) "configuring... "; \
|
2005-10-22 01:40:50 +00:00
|
|
|
$(MAKE) $(PKG_BUILD_DIR)/.configured $(MAKE_TRACE); \
|
|
|
|
}
|
|
|
|
|
|
|
|
compile-targets:
|
2005-10-22 15:10:20 +00:00
|
|
|
compile: configure
|
|
|
|
@$(CMD_TRACE) "compiling... "
|
2005-10-22 11:33:25 +00:00
|
|
|
@$(MAKE) compile-targets $(MAKE_TRACE)
|
2005-10-22 01:40:50 +00:00
|
|
|
|
|
|
|
install-targets:
|
2005-05-09 09:33:23 +00:00
|
|
|
install:
|
2005-10-22 15:10:20 +00:00
|
|
|
@$(CMD_TRACE) "installing... "
|
2005-10-22 01:40:50 +00:00
|
|
|
@$(MAKE) install-targets $(MAKE_TRACE)
|
|
|
|
|
2005-06-08 18:57:17 +00:00
|
|
|
rebuild:
|
2005-10-22 15:10:20 +00:00
|
|
|
$(CMD_TRACE) "rebuilding... "
|
2006-04-20 03:45:03 +00:00
|
|
|
$(MAKE) package-clean compile $(MAKE_TRACE)
|
2005-04-18 06:17:39 +00:00
|
|
|
|
2005-05-12 17:59:08 +00:00
|
|
|
$(PACKAGE_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2005-10-22 01:40:50 +00:00
|
|
|
clean-targets:
|
2005-05-09 09:33:23 +00:00
|
|
|
clean:
|
2005-10-22 15:10:20 +00:00
|
|
|
@$(CMD_TRACE) "cleaning... "
|
2005-10-22 01:40:50 +00:00
|
|
|
@$(MAKE) clean-targets $(MAKE_TRACE)
|
2005-05-09 09:33:23 +00:00
|
|
|
rm -rf $(PKG_BUILD_DIR)
|
2006-04-19 23:14:13 +00:00
|
|
|
endif
|
2005-04-18 06:17:39 +00:00
|
|
|
|
2006-04-20 03:45:03 +00:00
|
|
|
.PHONY: all source prepare compile install clean rebuild dumpinfo compile-targets install-targets clean-targets
|