move configure args to CONFIGURE_ARGS and configure variable to CONFIGURE_VARS to...
[openwrt.git] / include / package.mk
index cf8771a..0400d08 100644 (file)
@@ -14,14 +14,14 @@ include $(INCLUDE_DIR)/prereq.mk
 include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/unpack.mk
 
+PKG_CONFIGURE_PATH:=.
 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
 
 define Build/DefaultTargets
   ifeq ($(DUMP),)
     ifeq ($(CONFIG_AUTOREBUILD),y)
-      _INFO:=
-      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR))
-        _INFO+=$(subst $(TOPDIR)/,,$(PKG_BUILD_DIR))
+      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
+        $$(info Forcing package rebuild)
         $(PKG_BUILD_DIR)/.prepared: package-clean
       endif
     endif
@@ -176,9 +176,11 @@ define BuildPackage
        echo "Version: $(VERSION)"; \
        echo "Depends: $$(IDEPEND_$(1))"; \
        echo "Provides: $(PROVIDES)"; \
-       echo "Build-Depends: $(PKG_BUILDDEP)"; \
+       echo "Build-Depends: $(PKG_BUILD_DEPENDS)"; \
+       echo "Section: $(SECTION)"; \
        echo "Category: $(CATEGORY)"; \
        echo "Title: $(TITLE)"; \
+       echo "Maintainer: $(MAINTAINER)"; \
        if isset $(call shvar,Package/$(1)/description); then \
                echo -n "Description: "; \
                getvar $(call shvar,Package/$(1)/description); \
@@ -211,6 +213,7 @@ define BuildPackage
   $(eval $(call BuildIPKGVariable,$(1),prerm))
   $(eval $(call BuildIPKGVariable,$(1),postrm))
   $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
+       @rm -f $(PACKAGE_DIR)/$(1)_*
        mkdir -p $$(IDIR_$(1))/CONTROL
        echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
        echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
@@ -261,12 +264,8 @@ define BuildPackage
       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))
+            $$(info Rebuilding $(subst $(TOPDIR)/,,$$(IPKG_$(1))))
           endif
         endif
       endif
@@ -287,17 +286,7 @@ define Build/Prepare
   $(call Build/Prepare/Default,)
 endef
 
-define Build/Configure/Default
-       (cd $(PKG_BUILD_DIR)/$(strip $(3)); \
-       if [ -x configure ]; then \
-               $(TARGET_CONFIGURE_OPTS) \
-               CFLAGS="$(TARGET_CFLAGS)" \
-               CXXFLAGS="$(TARGET_CFLAGS)" \
-               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
-               PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
-               $(2) \
-               ./configure \
+CONFIGURE_ARGS := \
                --target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \
                --build=$(GNU_HOST_NAME) \
@@ -313,7 +302,24 @@ define Build/Configure/Default
                --localstatedir=/var \
                --mandir=/usr/man \
                --infodir=/usr/info \
-               $(DISABLE_NLS) \
+               $(DISABLE_NLS)
+
+CONFIGURE_VARS:= \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CXXFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
+               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+               PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
+               PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig"
+
+define Build/Configure/Default
+       (cd $(PKG_BUILD_DIR)/$(strip $(3)); \
+       if [ -x configure ]; then \
+               $(CONFIGURE_VARS) \
+               $(2) \
+               $(PKG_CONFIGURE_PATH)/configure \
+               $(CONFIGURE_ARGS) \
                $(1); \
        fi; \
        )
@@ -324,11 +330,12 @@ define Build/Configure
 endef
 
 define Build/Compile/Default
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
+       LDFLAGS="$(EXTRA_LDFLAGS) " \
        $(MAKE) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
                CROSS="$(TARGET_CROSS)" \
-               EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include " \
-               EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib " \
+               CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
                ARCH="$(ARCH)" \
                $(1);
 endef
This page took 0.020565 seconds and 4 git commands to generate.