move host build in packages into a separate namespace: package/<name>/host/<target...
authorFelix Fietkau <nbd@openwrt.org>
Tue, 17 Mar 2009 02:20:34 +0000 (02:20 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 17 Mar 2009 02:20:34 +0000 (02:20 +0000)
SVN-Revision: 14905

include/host-build.mk
include/package-dumpinfo.mk
include/package.mk
include/quilt.mk
include/subdir.mk
package/lua/Makefile
scripts/feeds
scripts/metadata.pl
scripts/metadata.pm

index a0ffd83b6e0bec3145a80f4b22741bfeb8b7bf42..892cde91f5b040b5f1a976b0ec0e4a11665fffd5 100644 (file)
@@ -12,6 +12,7 @@ include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/unpack.mk
 include $(INCLUDE_DIR)/depends.mk
 
+BUILD_TYPES += host
 HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
 HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
 HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
@@ -122,7 +123,12 @@ ifndef DUMP
     host-install: $(HOST_STAMP_INSTALLED)
   endif
 
-  $(if $(STAMP_BUILT),compile: host-install)
+  ifndef STAMP_BUILT
+    prepare: host-prepare
+    compile: host-compile
+    install: host-install
+    clean: host-clean
+  endif
   host-prepare: $(HOST_STAMP_PREPARED)
   host-configure: $(HOST_STAMP_CONFIGURED)
   host-compile: $(HOST_STAMP_BUILT)
@@ -135,10 +141,10 @@ ifndef DUMP
   endef
 
   download:
-  prepare: host-prepare
-  compile: host-compile
-  install: host-install
-  clean: host-clean
+  prepare:
+  compile:
+  install:
+  clean:
 
 endif
 
index f08788bbb17ce3d0940f5d9744491d10c90bd4c7..db8d9c11ca53ace356ee09adfcc5527f6b701eb6 100644 (file)
@@ -32,8 +32,10 @@ $(if $(MENU),Menu: $(MENU)
 )Version: $(VERSION)
 Depends: $(DEPENDS)
 Provides: $(PROVIDES)
-Build-Depends: $(PKG_BUILD_DEPENDS)
-Section: $(SECTION)
+$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS)
+)$(if $(HOST_BUILD_DEPENDS),Build-Depends/host: $(HOST_BUILD_DEPENDS)
+)$(if $(BUILD_TYPES),Build-Types: $(BUILD_TYPES)
+)Section: $(SECTION)
 Category: $(CATEGORY)
 Title: $(TITLE)
 Maintainer: $(MAINTAINER)
index 7e0501c55404c6169b6062dc1652212be83a165d..191dec9ca7a2edf384b2744c48e5fd78d9dff35a 100644 (file)
@@ -79,7 +79,7 @@ define Build/DefaultTargets
 
   $(STAMP_CONFIGURED) : export PATH=$$(TARGET_PATH_PKG)
   $(STAMP_CONFIGURED) : export CONFIG_SITE:=$$(CONFIG_SITE)
-  $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(HOST_STAMP_INSTALLED)
+  $(STAMP_CONFIGURED): $(STAMP_PREPARED)
        $(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep))
        $(Build/Configure)
        $(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep))
index 0d63e62fd234a05aca19a00774c326b337b74805..fbb3e01e351d1c3b98bcdd6836b2a08cf5660117 100644 (file)
@@ -67,7 +67,7 @@ ifneq ($(PKG_BUILD_DIR),)
 endif
 
 ifneq ($(HOST_BUILD_DIR),)
-  HOST_QUILT?=$(if $(wildcard $(if $(PKG_BUILD_DIR),$(PKG_BUILD_DIR),$(HOST_BUILD_DIR))/.quilt_used),y)
+  HOST_QUILT?=$(if $(findstring command,$(origin $(QUILT))),$(QUILT),$(if $(wildcard $(HOST_BUILD_DIR)/.quilt_used),y))
   ifneq ($(HOST_QUILT),)
     HOST_STAMP_PATCHED:=$(HOST_BUILD_DIR)/.quilt_patched
     HOST_STAMP_CHECKED:=$(HOST_BUILD_DIR)/.quilt_checked
index 3bf1a4bb7918c8d8095325dd1603bdf503e554ad..e6c8066187401f0aecf1c3d3da9596790670c60e 100644 (file)
@@ -27,6 +27,11 @@ define subdir
   $(foreach bd,$($(1)/builddirs),
     $(call warn,$(1),d,BD $(1)/$(bd))
     $(foreach target,$(SUBTARGETS),
+      $(foreach btype,$(buildtypes-$(bd)),
+        $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
+                 +$$(SUBMAKE) -C $(1)/$(bd) $(btype)-$(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))), || $(call MESSAGE,   ERROR: $(1)/$(bd) [$(btype)] failed to build.))
+        $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(btype)/$(target))
+      )
       $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
                +$$(SUBMAKE) -C $(1)/$(bd) $(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE,   ERROR: $(1)/$(bd) failed to build.))
         $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target))
index 7f0874bd6df0c9dde569076373d16d309c1822ca..67f3175c772fba4fb18988740e92a94d668b7760 100644 (file)
@@ -20,6 +20,8 @@ PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
 PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
 
 HOST_PATCH_DIR=./patches-host
+PKG_BUILD_DEPENDS:=lua/host
+
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 
index deafaca126c6fd89cadf97715f30c506c4a6c63c..e51b17c37245b003055c35f4f77b4022cb2a8da1 100755 (executable)
@@ -327,10 +327,11 @@ sub install_package {
 
        # install all dependencies
        foreach my $vpkg (@{$srcpackage{$src}}, $pkg) {
-               foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}) {
+               foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}, @{$vpkg->{"builddepends/host"}}) {
                        next if $dep =~ /@/;
                        $dep =~ s/^\+//;
                        $dep =~ s/^.+://;
+                       $dep =~ s/\/.+$//;
                        next unless $dep;
                        install_package($feed, $dep) == 0 or $ret = 1;
                }
index 40025590077b3f994682413804262603072f0669..3d9d68a654b4fb5b8f3c4c2745ca42dd3d3ea2e2 100755 (executable)
@@ -551,6 +551,20 @@ EOF
        }
 }
 
+sub get_conditional_dep($$) {
+       my $condition = shift;
+       my $depstr = shift;
+       if ($condition) {
+               if ($condition =~ /^!(.+)/) {
+                       return "\$(if \$(CONFIG_$1),,$depstr)";
+               } else {
+                       return "\$(if \$(CONFIG_$condition),$depstr)";
+               }
+       } else {
+               return $depstr;
+       }
+}
+
 sub gen_package_mk() {
        my %conf;
        my %dep;
@@ -582,6 +596,10 @@ sub gen_package_mk() {
                next if $done{$pkg->{src}};
                $done{$pkg->{src}} = 1;
 
+               if (@{$pkg->{buildtypes}} > 0) {
+                       print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
+               }
+
                foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
                        foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
                                $dep =~ /@/ or do {
@@ -590,17 +608,60 @@ sub gen_package_mk() {
                                };
                        }
                }
+               foreach my $type (@{$pkg->{buildtypes}}) {
+                       my @extra_deps;
+                       my %deplines;
+
+                       next unless $pkg->{"builddepends/$type"};
+                       foreach my $dep (@{$pkg->{"builddepends/$type"}}) {
+                               my $suffix = "";
+                               my $condition;
+
+                               if ($dep =~ /^(.+):(.+)/) {
+                                       $condition = $1;
+                                       $dep = $2;
+                               }
+                               if ($dep =~ /^(.+)(\/.+)/) {
+                                       $dep = $1;
+                                       $suffix = $2;
+                               }
+                               my $pkg_dep = $package{$dep};
+                               next unless $pkg_dep;
+
+                               my $idx = "";
+                               if (defined $pkg_dep->{src}) {
+                                       $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
+                               } elsif (defined($srcpackage{$dep})) {
+                                       $idx = $subdir{$dep}.$dep;
+                               }
+                               my $depstr = "\$(curdir)/$idx$suffix/compile";
+                               my $depline = get_conditional_dep($condition, $depstr);
+                               if ($depline) {
+                                       $deplines{$dep} = $depline;
+                               }
+                       }
+                       my $depline = join(" ", values %deplines);
+                       if ($depline) {
+                               $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/$type/compile += $depline\n";
+                       }
+               }
 
                my $hasdeps = 0;
                my %deplines;
                foreach my $deps (@srcdeps) {
                        my $idx;
                        my $condition;
+                       my $prefix = "";
+                       my $suffix = "";
 
                        if ($deps =~ /^(.+):(.+)/) {
                                $condition = $1;
                                $deps = $2;
                        }
+                       if ($deps =~ /^(.+)(\/.+)/) {
+                               $deps = $1;
+                               $suffix = $2;
+                       }
 
                        my $pkg_dep = $package{$deps};
                        my @deps;
@@ -627,21 +688,13 @@ sub gen_package_mk() {
                                        my $depstr;
 
                                        if ($pkg_dep->{vdepends}) {
-                                               $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx/compile)";
+                                               $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx$suffix/compile)";
                                                $dep{$pkg->{src}."->($dep)".$idx} = 1;
                                        } else {
-                                               $depstr = "\$(curdir)/$idx/compile";
+                                               $depstr = "\$(curdir)/$idx$suffix/compile";
                                                $dep{$pkg->{src}."->".$idx} = 1;
                                        }
-                                       if ($condition) {
-                                               if ($condition =~ /^!(.+)/) {
-                                                       $depline = "\$(if \$(CONFIG_$1),,$depstr)";
-                                               } else {
-                                                       $depline = "\$(if \$(CONFIG_$condition),$depstr)";
-                                               }
-                                       } else {
-                                               $depline = $depstr;
-                                       }
+                                       $depline = get_conditional_dep($condition, $depstr);
                                        if ($depline) {
                                                $deplines{$idx.$dep} = $depline;
                                        }
index defa7b9346ffa823c11482a30bded9ef05ff586e..8ce4ea8b1e24eee13175a273b69849d7a161fc37 100644 (file)
@@ -63,6 +63,7 @@ sub parse_package_metadata($) {
                        $pkg->{default} = "m if ALL";
                        $pkg->{depends} = [];
                        $pkg->{builddepends} = [];
+                       $pkg->{buildtypes} = [];
                        $pkg->{subdir} = $subdir;
                        $pkg->{tristate} = 1;
                        $package{$1} = $pkg;
@@ -91,6 +92,8 @@ sub parse_package_metadata($) {
                /^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
                /^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
                /^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
+               /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
+               /^Build-Types:\s*(.+)\s*$/ and $pkg->{buildtypes} = [ split /\s+/, $1 ];
                /^Category: \s*(.+)\s*$/ and do {
                        $pkg->{category} = $1;
                        defined $category{$1} or $category{$1} = {};