[Pkg-octave-devel] Centralized installation paths and octave2.1 dependency

Rafael Laboissiere Rafael Laboissiere <rafael@debian.org>
Mon, 21 Feb 2005 09:53:48 +0100


--w7PDEPdKQumQfZlR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

In the forthcoming release of octave2.1_2.1.65, I would like to add some
common build infrastructure in the octave2.1-headers package.  This will
make our packages more uniform and will avoid that infamous incompatibility
problem at every new release of Octave, even when the API counter is not
incremented.

Here is how it would go, as regards instructions for the developers:

1) Build-Depends on octave2.1-headers (>= 2.1.65).  This is necessary to get
   access to files defs.make and octave-depends (attached below).

2) At the top of debian/rules put the following:

   include /usr/share/octave/debian/defs.make

   This defines the Makefile variables MDIR and OCTDIR containing the
   installation paths for .m scripts and .oct loadable modules.  Use these
   variables to install files in the package.

   For instance, the following examples:

   ##########################################   
   include /usr/share/octave/debian/defs.make
   all:
   	@echo MDIR: $(MDIR)
   	@echo OCTDIR: $(OCTDIR)
   ##########################################

   would give:

   $ make
   MDIR: /usr/share/octave/site/m
   OCTDIR: /usr/lib/octave/site/oct/api-v13/i386-pc-linux-gnu

3) In the install rule of debian/rules, call 'octave-depends' (typically
   near dh_shlibdeps).  This is a debhelper-like program that calculates the
   right Octave dependency.  If you have in debian/control:

       Depends: ${octave:Depends}

   then octave-depends will give something like:

       Depends: octave2.1 (>= 2.1.65)

Notice that the dependency above will keep compatibility with later versions
of octave2.1.  This is also insured by the fact that the $(OCTDIR) path does
not contain a version number, only the API number. Only in the event a newer
version of octave2.1 bumps the API number, then we will have to rebuild all
the packages containing .oct files.

What do you think?  If nobody objects, I will do the changes to the
octave2.1-headers package.

-- 
Rafael

--w7PDEPdKQumQfZlR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="defs.make"

# Installation paths for use in debian/rules of Octave-related packages
# Written by Rafael Laboissiere <rafael@debian.org>
# $Id$

MDIR = $(shell octave-config  --print LOCALFCNFILEDIR)
OCTDIR = $(shell octave-config  --print LOCALAPIOCTFILEDIR)

--w7PDEPdKQumQfZlR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=octave-depends

#!/usr/bin/perl -w

# 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

octave-deps - calculates Octave dependencies

=cut

use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<octave-deps> [S<I<debhelper options>>]

=head1 DESCRIPTION

octave-deps is a debhelper-like program that is responsible for generating
the ${octave:Depends} substitutions and adding them to substvars files.

If you use this program, your package must build-depend on octave2.1-headers
(>= 2.1.65).

=cut

init ();

my $octcfg = 'octave-config';
my $octpkg = 'octave2.1';

# The current Octave version
my $octver = `$octcfg --version 2>&1`
	or die "Command $octcfg not found";
chomp $octver;
  
foreach my $package (@{$dh{DOPACKAGES}}) {

	delsubstvar($package, "octave:Depends");
	addsubstvar($package, "octave:Depends", $octpkg, ">= $octver");

}

=head1 SEE ALSO

L<debhelper(7)>

This program is not part of debhelper.

=head1 AUTHOR

Rafael Laboissiere <rafael@debian.org>

Most ideas borrowed from dh_python by Josselin Mouette <joss@debian.org>,
who apparently took ideas from Brendan O'Dea <bod@debian.org>.

=cut

--w7PDEPdKQumQfZlR--