2006-04-20 02:14:13 +03:00
|
|
|
ifneq ($(DUMP),)
|
|
|
|
all: dumpinfo
|
|
|
|
else
|
2006-04-14 06:03:32 +03:00
|
|
|
all: compile
|
2006-04-20 06:53:28 +03:00
|
|
|
endif
|
2006-04-14 06:03:32 +03: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 06:45:03 +03:00
|
|
|
$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
|
2006-04-14 06:03:32 +03:00
|
|
|
$(call Build/Configure)
|
|
|
|
touch $$@
|
|
|
|
|
2006-04-20 06:45:03 +03: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 06:03:32 +03:00
|
|
|
$(call Build/Compile)
|
|
|
|
touch $$@
|
|
|
|
|
2006-04-20 06:45:03 +03: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 06:11:20 +03:00
|
|
|
define Build/DefaultTargets
|
|
|
|
endef
|
2006-04-14 06:03:32 +03:00
|
|
|
endef
|
2005-07-24 22:58:14 +03:00
|
|
|
|
2006-04-20 02:56:04 +03:00
|
|
|
define Package/Default
|
2006-04-14 04:22:55 +03: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
|
2006-04-21 03:12:18 +03:00
|
|
|
DEFAULT:=
|
|
|
|
MENU:=
|
2006-04-14 04:22:55 +03:00
|
|
|
TITLE:=
|
|
|
|
DESCRIPTION:=
|
2006-04-20 02:56:04 +03:00
|
|
|
endef
|
2006-04-14 04:22:55 +03:00
|
|
|
|
2006-04-20 02:56:04 +03:00
|
|
|
define BuildPackage
|
2006-04-20 03:03:19 +03:00
|
|
|
$(eval $(call Package/Default))
|
|
|
|
$(eval $(call Package/$(1)))
|
2006-04-14 04:22:55 +03:00
|
|
|
|
2006-04-21 03:37:58 +03:00
|
|
|
ifeq ($(TITLE),)
|
2006-04-14 06:03:32 +03:00
|
|
|
$$(error Package $(1) has no TITLE)
|
2006-04-14 04:22:55 +03:00
|
|
|
endif
|
2006-04-21 03:37:58 +03:00
|
|
|
ifeq ($(CATEGORY),)
|
2006-04-14 06:03:32 +03:00
|
|
|
$$(error Package $(1) has no CATEGORY)
|
2006-04-14 04:22:55 +03:00
|
|
|
endif
|
2006-04-21 03:37:58 +03:00
|
|
|
ifeq ($(PRIORITY),)
|
2006-04-14 06:03:32 +03:00
|
|
|
$$(error Package $(1) has no PRIORITY)
|
2006-04-14 04:22:55 +03:00
|
|
|
endif
|
2006-04-21 03:37:58 +03:00
|
|
|
ifeq ($(VERSION),)
|
2006-04-14 06:03:32 +03:00
|
|
|
$$(error Package $(1) has no VERSION)
|
2006-04-14 04:22:55 +03:00
|
|
|
endif
|
2006-04-21 03:37:58 +03:00
|
|
|
ifeq ($(PKGARCH),)
|
2006-04-14 04:22:55 +03:00
|
|
|
PKGARCH:=$(ARCH)
|
|
|
|
endif
|
2006-04-21 03:37:58 +03:00
|
|
|
$(eval
|
|
|
|
ifeq ($(DESCRIPTION),)
|
|
|
|
DESCRIPTION:=$(TITLE)
|
|
|
|
endif
|
|
|
|
)
|
2006-04-14 04:22:55 +03:00
|
|
|
|
2006-04-14 06:03:32 +03: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 12:33:23 +03:00
|
|
|
|
2006-04-21 12:55:30 +03:00
|
|
|
ifneq ($(CONFIG_PACKAGE_$(1)),)
|
2006-04-20 06:45:03 +03:00
|
|
|
COMPILE_$(1):=1
|
2005-05-09 12:33:23 +03:00
|
|
|
endif
|
2005-05-30 23:22:21 +03:00
|
|
|
ifneq ($(DEVELOPER),)
|
2006-04-20 06:45:03 +03:00
|
|
|
COMPILE_$(1):=1
|
2005-05-30 23:22:21 +03:00
|
|
|
endif
|
2006-04-21 12:55:30 +03:00
|
|
|
ifeq ($(CONFIG_PACKAGE_$(1)),y)
|
2005-10-22 04:40:50 +03:00
|
|
|
install-targets: $$(INFO_$(1))
|
2005-05-09 12:33:23 +03:00
|
|
|
endif
|
|
|
|
|
2006-04-20 06:45:03 +03: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 04:22:55 +03:00
|
|
|
IDEPEND_$(1):=$$(strip $$(DEPENDS))
|
2006-04-20 03:03:19 +03:00
|
|
|
|
|
|
|
DUMPINFO += \
|
2006-04-21 03:12:18 +03:00
|
|
|
echo "Package: $(1)";
|
|
|
|
ifneq ($(MENU),)
|
|
|
|
DUMPINFO += \
|
|
|
|
echo "Menu: $(MENU)";
|
|
|
|
endif
|
|
|
|
ifneq ($(DEFAULT),)
|
|
|
|
DUMPINFO += \
|
|
|
|
echo "Default: $(DEFAULT)";
|
|
|
|
endif
|
|
|
|
DUMPINFO += \
|
2006-04-20 03:03:19 +03:00
|
|
|
echo "Version: $(VERSION)"; \
|
2006-04-21 03:12:18 +03:00
|
|
|
echo "Depends: $$(IDEPEND_$(1))"; \
|
|
|
|
echo "Category: $(CATEGORY)"; \
|
2006-04-20 03:03:19 +03:00
|
|
|
echo "Title: $(TITLE)"; \
|
2006-04-21 03:50:48 +03:00
|
|
|
echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g';
|
|
|
|
ifneq ($(URL),)
|
|
|
|
DUMPINFO += \
|
2006-04-20 03:03:19 +03:00
|
|
|
echo; \
|
2006-04-21 03:50:48 +03:00
|
|
|
echo "$(URL)";
|
|
|
|
endif
|
|
|
|
DUMPINFO += \
|
2006-04-20 03:03:19 +03:00
|
|
|
echo "@@";
|
|
|
|
|
2005-06-27 13:02:35 +03:00
|
|
|
|
2005-05-09 12:33:23 +03:00
|
|
|
$$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
|
2006-04-14 04:22:55 +03:00
|
|
|
mkdir -p $$(IDIR_$(1))/CONTROL
|
2006-04-20 03:03:19 +03:00
|
|
|
echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
|
|
|
|
echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
|
2006-04-21 03:12:18 +03:00
|
|
|
echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control
|
2006-04-20 03:03:19 +03:00
|
|
|
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
|
2006-04-21 03:37:58 +03:00
|
|
|
echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(IDIR_$(1))/CONTROL/control
|
2006-04-14 04:22:55 +03:00
|
|
|
chmod 644 $$(IDIR_$(1))/CONTROL/control
|
2005-05-09 12:33:23 +03:00
|
|
|
for file in conffiles preinst postinst prerm postrm; do \
|
2006-04-14 06:03:32 +03:00
|
|
|
[ -f ./ipkg/$(1).$$$$file ] && cp ./ipkg/$(1).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
|
2005-05-09 12:33:23 +03:00
|
|
|
done
|
|
|
|
|
2006-04-20 06:45:03 +03:00
|
|
|
$$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built
|
2006-04-14 06:03:32 +03:00
|
|
|
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
2006-04-20 06:45:03 +03:00
|
|
|
mkdir -p $(PACKAGE_DIR)
|
2006-04-14 06:03:32 +03:00
|
|
|
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
|
2005-05-12 20:59:08 +03:00
|
|
|
|
2005-05-09 12:33:23 +03:00
|
|
|
$$(INFO_$(1)): $$(IPKG_$(1))
|
|
|
|
$(IPKG) install $$(IPKG_$(1))
|
|
|
|
|
2006-04-14 06:03:32 +03:00
|
|
|
$(1)-clean:
|
2006-04-20 06:45:03 +03:00
|
|
|
rm -f $(PACKAGE_DIR)/$(1)_*
|
2006-04-14 06:03:32 +03:00
|
|
|
clean: $(1)-clean
|
2005-05-09 12:33:23 +03:00
|
|
|
|
2006-04-14 06:03:32 +03:00
|
|
|
ifneq ($(__DEFAULT_TARGETS),1)
|
|
|
|
$(eval $(call Build/DefaultTargets))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
2005-10-22 04:40:50 +03:00
|
|
|
|
2005-04-18 09:17:39 +03:00
|
|
|
ifneq ($(strip $(PKG_SOURCE)),)
|
|
|
|
$(DL_DIR)/$(PKG_SOURCE):
|
2005-10-22 19:14:30 +03:00
|
|
|
@$(CMD_TRACE) "downloading... "
|
2005-10-22 04:40:50 +03:00
|
|
|
$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
|
2006-04-14 06:03:32 +03:00
|
|
|
|
|
|
|
$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
|
2005-04-18 09:17:39 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(PKG_CAT)),)
|
2006-04-14 06:03:32 +03:00
|
|
|
define Build/Prepare/Default
|
2005-12-13 15:01:01 +02: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 09:17:39 +03:00
|
|
|
if [ -d ./patches ]; then \
|
|
|
|
$(PATCH) $(PKG_BUILD_DIR) ./patches ; \
|
|
|
|
fi
|
2006-04-14 06:03:32 +03:00
|
|
|
endef
|
2005-04-18 09:17:39 +03:00
|
|
|
endif
|
|
|
|
|
2006-04-14 06:03:32 +03:00
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure/Default
|
2006-04-21 12:55:30 +03:00
|
|
|
(cd $(PKG_BUILD_DIR); \
|
2006-05-10 02:32:56 +03:00
|
|
|
[ -x configure ] && \
|
2006-04-21 12:55:30 +03:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
CFLAGS="$(TARGET_CFLAGS)" \
|
|
|
|
./configure \
|
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--host=$(GNU_TARGET_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--exec-prefix=/usr \
|
|
|
|
--bindir=/usr/bin \
|
|
|
|
--sbindir=/usr/sbin \
|
|
|
|
--libexecdir=/usr/lib \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--datadir=/usr/share \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--infodir=/usr/info \
|
|
|
|
$(DISABLE_NLS) \
|
|
|
|
$(1); \
|
|
|
|
)
|
2006-04-14 06:03:32 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile/Default
|
2006-04-21 13:03:46 +03:00
|
|
|
$(MAKE) -C $(PKG_BUILD_DIR) \
|
|
|
|
CC=$(TARGET_CC) \
|
|
|
|
CROSS="$(TARGET_CROSS)" \
|
|
|
|
PREFIX="$$(IDIR_$(1))" \
|
|
|
|
EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
|
|
|
|
ARCH="$(ARCH)" \
|
|
|
|
DESTDIR="$$(IDIR_$(1))"
|
2006-04-14 06:03:32 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
$(call Build/Compile/Default)
|
|
|
|
endef
|
2005-04-18 09:17:39 +03:00
|
|
|
|
2006-04-20 06:45:03 +03:00
|
|
|
define Build/Clean
|
|
|
|
$(MAKE) clean
|
|
|
|
endef
|
|
|
|
|
2006-04-20 02:14:13 +03:00
|
|
|
ifneq ($(DUMP),)
|
|
|
|
dumpinfo:
|
|
|
|
$(DUMPINFO)
|
|
|
|
else
|
|
|
|
|
2005-04-18 09:17:39 +03:00
|
|
|
source: $(DL_DIR)/$(PKG_SOURCE)
|
2005-10-22 19:14:30 +03:00
|
|
|
prepare: source
|
2005-10-22 04:40:50 +03:00
|
|
|
@[ -f $(PKG_BUILD_DIR)/.prepared ] || { \
|
2005-10-22 18:10:20 +03:00
|
|
|
$(CMD_TRACE) "preparing... "; \
|
2005-10-22 04:40:50 +03:00
|
|
|
$(MAKE) $(PKG_BUILD_DIR)/.prepared $(MAKE_TRACE); \
|
|
|
|
}
|
|
|
|
|
2005-10-22 18:10:20 +03:00
|
|
|
configure: prepare
|
2005-10-22 04:40:50 +03:00
|
|
|
@[ -f $(PKG_BUILD_DIR)/.configured ] || { \
|
2005-10-22 18:10:20 +03:00
|
|
|
$(CMD_TRACE) "configuring... "; \
|
2005-10-22 04:40:50 +03:00
|
|
|
$(MAKE) $(PKG_BUILD_DIR)/.configured $(MAKE_TRACE); \
|
|
|
|
}
|
|
|
|
|
|
|
|
compile-targets:
|
2005-10-22 18:10:20 +03:00
|
|
|
compile: configure
|
|
|
|
@$(CMD_TRACE) "compiling... "
|
2005-10-22 14:33:25 +03:00
|
|
|
@$(MAKE) compile-targets $(MAKE_TRACE)
|
2005-10-22 04:40:50 +03:00
|
|
|
|
|
|
|
install-targets:
|
2005-05-09 12:33:23 +03:00
|
|
|
install:
|
2005-10-22 18:10:20 +03:00
|
|
|
@$(CMD_TRACE) "installing... "
|
2005-10-22 04:40:50 +03:00
|
|
|
@$(MAKE) install-targets $(MAKE_TRACE)
|
|
|
|
|
2005-06-08 21:57:17 +03:00
|
|
|
rebuild:
|
2005-10-22 18:10:20 +03:00
|
|
|
$(CMD_TRACE) "rebuilding... "
|
2006-04-20 06:45:03 +03:00
|
|
|
$(MAKE) package-clean compile $(MAKE_TRACE)
|
2005-04-18 09:17:39 +03:00
|
|
|
|
2005-05-12 20:59:08 +03:00
|
|
|
$(PACKAGE_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2005-10-22 04:40:50 +03:00
|
|
|
clean-targets:
|
2005-05-09 12:33:23 +03:00
|
|
|
clean:
|
2005-10-22 18:10:20 +03:00
|
|
|
@$(CMD_TRACE) "cleaning... "
|
2005-10-22 04:40:50 +03:00
|
|
|
@$(MAKE) clean-targets $(MAKE_TRACE)
|
2005-05-09 12:33:23 +03:00
|
|
|
rm -rf $(PKG_BUILD_DIR)
|
2006-04-20 02:14:13 +03:00
|
|
|
endif
|
2005-04-18 09:17:39 +03:00
|
|
|
|
2006-04-20 06:45:03 +03:00
|
|
|
.PHONY: all source prepare compile install clean rebuild dumpinfo compile-targets install-targets clean-targets
|