#!/usr/bin/perl -w
#
# $Id$
# Copyright B. Cornec 2005-2014
# Provided under the GPL v2
#
# Get all depedencies from a binary (dynamic libraires reported by ldd and all their links)
#
use strict;
use MondoRescue::File;

=pod

=head1 NAME

mindi-process-ldd keeps track of the dependencies of a binary with its dynamic libraries

=head1 DESCRIPTION

mindi-process-ldd keeps track of the dependencies of a binary with its dynamic libraries by alalyzing the return of ldd on that binary and recursing on all the dependencies to provide the complete list of files needed to have this binary run in a mindi context

=head1 SYNOPSIS

mindi-process-ldd /path/to/binary ...

=head1 ARGUMENTS

=over 4

=item B</path/to/binary> 

This is the path of the binary to analyze and for which we want its perl dependencies to be included

=back

=head1 WEB SITES

The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>.

=head1 USER MAILING LIST

For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>

=head1 AUTHORS

The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.

=head1 COPYRIGHT

MondoRescue is distributed under the GPL v2.0 license or later,
described in the file C<COPYING> included with the distribution.

=cut


my $file = mr_file_process_ldd(@ARGV) if (defined $ARGV[0]);

foreach my $f (sort keys %$file) {
	print "$f\n";
	print "--\n";
	foreach my $l (@{$file->{$f}}) {
		print "$l\n";
	}
	print "--\n";
}
