2006-06-27 08:35:46 +08:00
|
|
|
#
|
2007-07-31 05:14:08 +08:00
|
|
|
# Copyright (C) 2006-2007 OpenWrt.org
|
2006-06-27 08:35:46 +08:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2007-03-16 07:57:18 +08:00
|
|
|
|
|
|
|
all: $(if $(DUMP),dumpinfo,compile)
|
2006-04-14 11:03:32 +08:00
|
|
|
|
2007-09-03 15:51:56 +08:00
|
|
|
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
2007-03-17 03:18:55 +08:00
|
|
|
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
2007-08-07 08:04:25 +08:00
|
|
|
PKG_MD5SUM ?= unknown
|
2007-03-17 03:18:55 +08:00
|
|
|
|
2006-07-29 19:30:06 +08:00
|
|
|
include $(INCLUDE_DIR)/prereq.mk
|
2006-10-11 05:22:35 +08:00
|
|
|
include $(INCLUDE_DIR)/host.mk
|
2006-10-14 08:40:27 +08:00
|
|
|
include $(INCLUDE_DIR)/unpack.mk
|
2007-04-16 02:28:24 +08:00
|
|
|
include $(INCLUDE_DIR)/depends.mk
|
2006-07-29 19:30:06 +08:00
|
|
|
|
2007-09-21 00:17:50 +08:00
|
|
|
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
|
2007-03-24 03:13:08 +08:00
|
|
|
STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
|
|
|
|
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
|
2007-11-21 06:43:38 +08:00
|
|
|
STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed
|
2007-06-03 14:16:08 +08:00
|
|
|
|
2007-09-29 08:05:48 +08:00
|
|
|
include $(INCLUDE_DIR)/download.mk
|
2007-06-03 14:16:08 +08:00
|
|
|
include $(INCLUDE_DIR)/quilt.mk
|
|
|
|
include $(INCLUDE_DIR)/package-defaults.mk
|
|
|
|
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
|
|
|
include $(INCLUDE_DIR)/package-ipkg.mk
|
2007-09-29 09:21:56 +08:00
|
|
|
include $(INCLUDE_DIR)/package-bin.mk
|
2007-06-03 14:16:08 +08:00
|
|
|
|
2007-07-31 05:14:08 +08:00
|
|
|
override MAKEFLAGS=
|
2006-10-19 23:25:58 +08:00
|
|
|
export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
|
|
|
|
|
2007-07-31 02:39:20 +08:00
|
|
|
ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
|
2007-07-31 07:52:17 +08:00
|
|
|
ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
|
2007-06-12 01:19:43 +08:00
|
|
|
define Build/Autoclean
|
|
|
|
$(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
|
2007-09-01 13:20:21 +08:00
|
|
|
$(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*")
|
|
|
|
$(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*"))
|
2007-06-12 01:19:43 +08:00
|
|
|
endef
|
|
|
|
endif
|
2007-04-16 02:28:24 +08:00
|
|
|
endif
|
|
|
|
|
2007-09-29 08:05:48 +08:00
|
|
|
define Download/default
|
|
|
|
FILE:=$(PKG_SOURCE)
|
|
|
|
URL:=$(PKG_SOURCE_URL)
|
2007-11-01 06:37:56 +08:00
|
|
|
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
2007-09-29 08:05:48 +08:00
|
|
|
PROTO:=$(PKG_SOURCE_PROTO)
|
|
|
|
VERSION:=$(PKG_SOURCE_VERSION)
|
|
|
|
MD5SUM:=$(PKG_MD5SUM)
|
|
|
|
endef
|
2007-07-31 07:52:17 +08:00
|
|
|
|
2006-04-14 11:03:32 +08:00
|
|
|
define Build/DefaultTargets
|
2007-09-29 12:29:11 +08:00
|
|
|
$(if $(QUILT),$(Build/Quilt))
|
2007-09-29 08:05:48 +08:00
|
|
|
$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
|
2007-04-16 02:28:24 +08:00
|
|
|
$(call Build/Autoclean)
|
2006-05-14 17:30:29 +08:00
|
|
|
|
2007-03-24 03:13:08 +08:00
|
|
|
$(STAMP_PREPARED):
|
2006-05-11 08:18:12 +08:00
|
|
|
@-rm -rf $(PKG_BUILD_DIR)
|
|
|
|
@mkdir -p $(PKG_BUILD_DIR)
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Prepare)
|
2006-05-12 07:14:04 +08:00
|
|
|
touch $$@
|
2006-04-14 11:03:32 +08:00
|
|
|
|
2007-03-24 03:13:08 +08:00
|
|
|
$(STAMP_CONFIGURED): $(STAMP_PREPARED)
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Configure)
|
2006-04-14 11:03:32 +08:00
|
|
|
touch $$@
|
|
|
|
|
2007-03-24 03:13:08 +08:00
|
|
|
$(STAMP_BUILT): $(STAMP_CONFIGURED)
|
2007-03-16 07:57:18 +08:00
|
|
|
$(Build/Compile)
|
2007-11-21 06:43:38 +08:00
|
|
|
touch $$@
|
|
|
|
|
|
|
|
$(STAMP_INSTALLED): $(STAMP_BUILT)
|
2007-12-23 08:41:40 +08:00
|
|
|
$(call Build/InstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
|
2006-05-14 17:30:29 +08:00
|
|
|
touch $$@
|
2006-06-01 00:20:27 +08:00
|
|
|
|
2006-08-02 20:07:14 +08:00
|
|
|
ifdef Build/InstallDev
|
2007-11-21 06:43:38 +08:00
|
|
|
compile: $(STAMP_INSTALLED)
|
2006-06-01 08:06:16 +08:00
|
|
|
endif
|
2006-06-01 00:20:27 +08:00
|
|
|
|
2006-05-12 06:36:20 +08:00
|
|
|
define Build/DefaultTargets
|
|
|
|
endef
|
2007-11-16 11:48:43 +08:00
|
|
|
|
|
|
|
prepare: $(STAMP_PREPARED)
|
|
|
|
configure: $(STAMP_CONFIGURED)
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
2005-07-25 03:58:14 +08:00
|
|
|
|
2006-04-20 07:56:04 +08:00
|
|
|
define BuildPackage
|
2007-03-16 07:57:18 +08:00
|
|
|
$(eval $(Package/Default))
|
|
|
|
$(eval $(Package/$(1)))
|
|
|
|
|
2007-10-14 12:49:05 +08:00
|
|
|
ifdef DESCRIPTION
|
|
|
|
$$(error DESCRIPTION:= is obselete, use Package/PKG_NAME/description)
|
|
|
|
endif
|
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
ifndef Package/$(1)/description
|
|
|
|
define Package/$(1)/description
|
2007-10-14 12:49:05 +08:00
|
|
|
$(TITLE)
|
2007-03-16 07:57:18 +08:00
|
|
|
endef
|
|
|
|
endif
|
2006-04-14 09:22:55 +08:00
|
|
|
|
2006-09-25 05:17:17 +08:00
|
|
|
$(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
|
2006-05-12 06:36:20 +08:00
|
|
|
ifeq ($($(FIELD)),)
|
|
|
|
$$(error Package/$(1) is missing the $(FIELD) field)
|
|
|
|
endif
|
|
|
|
)
|
2006-05-11 08:18:12 +08:00
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
$(call shexport,Package/$(1)/description)
|
|
|
|
$(call shexport,Package/$(1)/config)
|
2006-10-10 23:45:36 +08:00
|
|
|
|
2007-09-28 09:23:56 +08:00
|
|
|
$(if $(DUMP), \
|
|
|
|
$(Dumpinfo), \
|
|
|
|
$(foreach target, \
|
|
|
|
$(if $(Package/$(1)/targets),$(Package/$(1)/targets), \
|
|
|
|
$(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg ) \
|
|
|
|
), $(BuildTarget/$(target)) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
$(if $(DUMP),,$(call Build/DefaultTargets,$(1)))
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
2005-10-22 09:40:50 +08:00
|
|
|
|
2007-08-22 04:51:46 +08:00
|
|
|
# prevent libtool from setting rpath when linking
|
2007-08-23 00:15:00 +08:00
|
|
|
define libtool_disable_rpath
|
2007-08-24 20:10:14 +08:00
|
|
|
find $(PKG_BUILD_DIR) -name 'libtool' | $(XARGS) \
|
2007-08-22 04:51:46 +08:00
|
|
|
$(SED) 's,^hardcode_libdir_flag_spec=.*,hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ ",g'
|
|
|
|
endef
|
|
|
|
|
|
|
|
# prevent libtool from linking against host development libraries
|
2007-08-23 00:15:00 +08:00
|
|
|
define libtool_fixup_libdir
|
2007-08-24 20:10:14 +08:00
|
|
|
find $(PKG_BUILD_DIR) -name '*.la' | $(XARGS) \
|
2007-08-23 00:15:00 +08:00
|
|
|
$(SED) "s,^libdir='/usr/lib',libdir='$(strip $(1))/usr/lib',g"
|
2007-08-22 04:51:46 +08:00
|
|
|
endef
|
|
|
|
|
2007-10-07 09:55:03 +08:00
|
|
|
define pkg_install_files
|
2007-10-21 03:13:53 +08:00
|
|
|
$(foreach install_file,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_DATA) $(2)/$(install_file) $(3)/`dirname $(install_file)`;)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define pkg_install_bin
|
2007-12-18 06:24:40 +08:00
|
|
|
$(foreach install_apps,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_apps)`; $(INSTALL_BIN) $(2)/$(install_apps) $(3)/`dirname $(install_apps)`;)
|
2007-10-07 09:55:03 +08:00
|
|
|
endef
|
|
|
|
|
2006-04-14 11:03:32 +08:00
|
|
|
define Build/Prepare
|
2006-09-19 05:56:07 +08:00
|
|
|
$(call Build/Prepare/Default,)
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure
|
2006-05-12 06:36:20 +08:00
|
|
|
$(call Build/Configure/Default,)
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
2006-05-16 04:30:26 +08:00
|
|
|
$(call Build/Compile/Default,)
|
2006-04-14 11:03:32 +08:00
|
|
|
endef
|
2005-04-18 14:17:39 +08:00
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
$(PACKAGE_DIR):
|
2006-05-11 04:32:22 +08:00
|
|
|
mkdir -p $@
|
2006-06-21 07:40:02 +08:00
|
|
|
|
2007-03-16 07:57:18 +08:00
|
|
|
dumpinfo:
|
|
|
|
download:
|
2007-11-16 11:48:43 +08:00
|
|
|
prepare:
|
|
|
|
configure:
|
2007-03-16 07:57:18 +08:00
|
|
|
compile:
|
|
|
|
install:
|
|
|
|
clean: FORCE
|
2007-12-23 08:41:40 +08:00
|
|
|
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
|
2007-03-31 21:45:50 +08:00
|
|
|
$(Build/Clean)
|
2007-08-22 02:07:55 +08:00
|
|
|
@rm -f $(STAGING_DIR)/stamp/.$(PKG_NAME)-installed
|
2007-03-16 07:57:18 +08:00
|
|
|
@rm -rf $(PKG_BUILD_DIR)
|