diff options
Diffstat (limited to 'solenv')
-rwxr-xr-x | solenv/bin/build.pl | 81 | ||||
-rw-r--r-- | solenv/gbuild/tail_build_modules.mk | 48 |
2 files changed, 128 insertions, 1 deletions
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index fbdffcd222d5..74d0f32ee087 100755 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -188,6 +188,12 @@ my $new_line = "\n"; my $incompatible = 0; my $local_host_ip = 'localhost'; + my $tail_build_modules_mk = "$ENV{SOLARENV}/gbuild/tail_build_modules.mk"; + my $tail_build_module_dir = $ENV{"SRCDIR"}; + my $tail_build_prj = "tail_build"; + my $cross_tail_build_prj = "cross_tail_build"; + my $total_modules = 0; + ### main ### get_options(); @@ -545,6 +551,76 @@ sub expand_dependencies { }; # +# Gets list of tail_build modules. +# +sub get_tail_build_modules { + my $tail_build_prj = shift; + my $make = $ENV{'GNUMAKE'}; + + my $tail_build_mk = "$tail_build_module_dir/Module_$tail_build_prj.mk"; + my $modules_str = `$make --no-print-directory -r -f $tail_build_modules_mk get_modules TAIL_BUILD_MK=$tail_build_mk`; + chomp $modules_str; + + my %modules = (); + foreach my $module (split /\s+/, $modules_str) { + $modules{$module} = 1; + } + return %modules; +} + +sub _filter_tail_build_dependencies { + my $deps_hash = shift; + my $tail_build_prj = shift; + + if (!defined $$deps_hash{$tail_build_prj}) { + # nothing to do + return; + } + + my %tail_build_modules = get_tail_build_modules($tail_build_prj); + + # first remove tail_build modules from deps. + foreach my $prj (keys %tail_build_modules) { + if (defined $$deps_hash{$prj}) { + delete $$deps_hash{$prj}; + } + } + + # do the actual replacement + foreach my $prj (keys %$deps_hash) { + my @tail_build_deps = (); + my $deps = $$deps_hash{$prj}; + + # remove deps. that are in tail_build + foreach my $dep (keys %$deps) { + if (defined $tail_build_modules{$dep}) { + print "$prj depends on $tail_build_prj\[$dep\]\n"; + push @tail_build_deps, $dep; + delete $$deps{$dep}; + } + } + + # insert dep. on tail_build, if necessary + if (@tail_build_deps && !defined $$deps{$tail_build_prj}) { + $$deps{$tail_build_prj} = 1; + } + } +} + +# +# Replaces all deps on modules from tail_build by dep on tail_build +# itself. I.e., if a module foo depends on (sal, sfx2, svx) and (sfx2, +# svx) are in tail_build, foo will be depending on (sal, tail_build). +# +# Works on cross_tail_build too, in case of cross-compilation. +# +sub filter_tail_build_dependencies { + my $deps_hash = shift; + _filter_tail_build_dependencies($deps_hash, $tail_build_prj); + _filter_tail_build_dependencies($deps_hash, $cross_tail_build_prj); +} + +# # This procedure fills the second hash with reversed dependencies, # ie, with info about modules "waiting" for the module # @@ -569,6 +645,7 @@ sub build_all { if ($build_all_parents) { my ($prj, $prj_dir, $orig_prj); get_parent_deps( $initial_module, \%global_deps_hash); + filter_tail_build_dependencies(\%global_deps_hash); if (scalar keys %active_modules) { $active_modules{$initial_module}++; $modules_types{$initial_module} = 'mod'; @@ -1916,7 +1993,9 @@ sub print_announce { $text = "Building module $prj\n"; }; - my $total_modules = scalar(keys %build_lists_hash); + if (!$total_modules) { + $total_modules = scalar(keys %global_deps_hash) + 1; + } my $modules_started = scalar(keys %module_announced) + 1; $text = "($modules_started/$total_modules) $text"; diff --git a/solenv/gbuild/tail_build_modules.mk b/solenv/gbuild/tail_build_modules.mk new file mode 100644 index 000000000000..e5301f4d9728 --- /dev/null +++ b/solenv/gbuild/tail_build_modules.mk @@ -0,0 +1,48 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# Major Contributor(s): +# Copyright (C) 2012 Red Hat, Inc., David Tardon <dtardon@redhat.com> +# (initial developer) +# +# All Rights Reserved. +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +TAIL_BUILD_MODULES := + +gb_Module_Module := + +define gb_Module_add_moduledirs +TAIL_BUILD_MODULES += $(2) + +endef + +ifneq ($(value TAIL_BUILD_MK),) +include $(TAIL_BUILD_MK) +else +$(error TAIL_BUILD_MK must be set to path to Module_tail_build.mk) +endif + +.PHONY : get_modules + +get_modules : + @echo $(TAIL_BUILD_MODULES) + +# vim: set shiftwidth=4 tabstop=4 noexpandtab: |