#!/usr/bin/perl

# Copyright (c) 2005  Rafael Laboissiere <rafael@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

=head1 NAME

erlang-depends - calculates Erlang dependencies

=cut

use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<erlang-depends> [S<I<debhelper options>>]

=head1 DESCRIPTION

erlang-depends is a debhelper-like program that is responsible for generating
the ${erlang-base:Depends}, ${erlang-nox:Depends}, ${erlang-x11:Depends}, and
${erlang-dev:Depends} substitutions and adding them to substvars files.

If you use this program, your package must build-depend on erlang-dev
(>= 1:11.b.2-3).

=cut

init ();

# The current Erlang version
my $version = '1:11.b.2';

foreach my $package (@{$dh{DOPACKAGES}}) {
  delsubstvar($package, "erlang-base:Depends");
  addsubstvar($package, "erlang-base:Depends",
    "erlang-base (>= $version) | erlang-base-hipe (>= $version)");
  delsubstvar($package, "erlang-nox:Depends");
  addsubstvar($package, "erlang-nox:Depends", "erlang-nox (>= $version)");
  delsubstvar($package, "erlang-x11:Depends");
  addsubstvar($package, "erlang-x11:Depends", "erlang-x11 (>= $version)");
  delsubstvar($package, "erlang-dev:Depends");
  addsubstvar($package, "erlang-dev:Depends", "erlang-dev (>= $version)");
}

=head1 SEE ALSO

L<debhelper(7)>

This program is not part of debhelper.

=head1 AUTHOR

Torsten Werner <twerner@debian.org>

Most ideas borrowed from octave-depends by Rafael Laboissiere
<rafael@debian.org>.

=cut
