#!/bin/sh

[ -e PKG_ADD ] && mv PKG_ADD PKG_ADD.bak

$octave $octave_options --eval					\
    "pkg ('prefix', [pwd(),'/$debpkg/$mpath'],			\
         [pwd(),'/$debpkg/$bpath']);				\
    pkg ('local_list', [pwd(),'/$local_list']);			\
    pkg ('global_list', [pwd(),'/$global_list']);		\
    save_header_format_string(					\
     '# Generated by Octave during Debian package build');	\
    if (exist ('PKG_ADD.bak') == 2),				\
        movefile ('PKG_ADD.bak', 'PKG_ADD');			\
    endif;							\
    pkg -verbose -nodeps install ."				\
    | sed 's:/tmp/oct-[a-zA-Z0-9]\{6\}:[tmp-build-dir]:g'

$shrpkg/dh/octave-pkg-helper

dh_install --package=$package
