Add a doc function to automate the copying of docs from srcdir to a
predefined location. Add shortroot modifier variable to replace passing the shortroot argument to generic_pack.
This commit is contained in:
parent
56201570f9
commit
4db33ad718
@ -75,6 +75,9 @@ srcfiles=$buildpkgbase/srcfiles
|
||||
topinstalldir=/usr/local
|
||||
prefix=$topinstalldir
|
||||
|
||||
# Docdir relative to $prefix
|
||||
docdir=doc
|
||||
|
||||
# pkg information.
|
||||
# The following 3 vars can be used when constructing pkg metadata
|
||||
# Override as necessary.
|
||||
@ -87,6 +90,7 @@ pkgdirdesig=${topinstalldir##/*/} # topinstalldir suffix
|
||||
# Functionality controls
|
||||
catman=0 # Don't fix manpages pr. default
|
||||
dostrip=1 # default to stripping binaries during the install stage
|
||||
shortroot=0 # Shallow or deep stagedir?
|
||||
|
||||
# Distfiles should be named like this
|
||||
# <name>-<version>-<pkgver>.sb-<os>-<cpu>-<pkgdirdesig>
|
||||
@ -108,6 +112,7 @@ E_BAD_MAKE=38
|
||||
E_BAD_CLEANOPTIONS=39
|
||||
E_BAD_STRIP=40
|
||||
E_BAD_ARGS=41
|
||||
E_ARG_OBSO=42
|
||||
|
||||
error_txt[$E_BAD_FILE]="File not found"
|
||||
error_txt[$E_PATCH_FAILED]="Patch failed"
|
||||
@ -118,6 +123,7 @@ error_txt[$E_BAD_COMPRESS]="Unknown compression method"
|
||||
#error_txt[$E_BAD_MAKE]="make failed"
|
||||
error_txt[$E_MISSING_ARGS]="A required argument was missing"
|
||||
error_txt[$E_BAD_ARGS]="An illegal argument was passed"
|
||||
error_txt[$E_ARG_OBSO]="Function nolonger supports the argument you passed"
|
||||
|
||||
#####################################################
|
||||
# Helper functions
|
||||
@ -303,6 +309,28 @@ fix_man()
|
||||
done
|
||||
}
|
||||
|
||||
# doc(): Add files from srcdir to 'docs' location
|
||||
# params: $1..$x
|
||||
# Copies files from $srcdir to $docdir/$topdir-$version
|
||||
doc()
|
||||
{
|
||||
if [ ! -z $# ]; then
|
||||
setdir source
|
||||
if [ "$shortroot" -eq 1 ]; then
|
||||
docdir=$stagedir/$docdir/$topdir-$version
|
||||
else
|
||||
docdir=$stagedir/$prefix/$docdir/$topdir-$version
|
||||
fi
|
||||
mkdir -p $docdir
|
||||
echo "Adding docs"
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
($TAR -cf - "$1")|(cd $docdir; tar -xvBpf -)
|
||||
shift
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#####################################################
|
||||
# Define generic functions for different build stages
|
||||
#####################################################
|
||||
|
@ -11,6 +11,9 @@ GZIP=/usr/people/tgc/bin/gzip
|
||||
BZIP2=/usr/local/bin/bzip2
|
||||
STRIP=/bin/true
|
||||
|
||||
# This is the hostname command we'll want on Irix
|
||||
HOSTNAME=/usr/bsd/hostname
|
||||
|
||||
# Configuration vars
|
||||
imageconf=$buildpkgbase/scripts/image.conf
|
||||
subsysconf=$buildpkgbase/scripts/subsys.conf
|
||||
@ -45,7 +48,7 @@ cpu=mips3
|
||||
META_CLEAN="$topdir.spec $topdir.idb"
|
||||
|
||||
# Host specific configuration
|
||||
[ -r $buildpkgbase/scripts/config.`hostname -s`.irix ] && . $buildpkgbase/scripts/config.`hostname -s`.irix
|
||||
[ -r $buildpkgbase/scripts/config.$($HOSTNAME -s).irix ] && . $buildpkgbase/scripts/config.$($HOSTNAME -s).irix
|
||||
|
||||
distfile=$topdir-$version-$pkgver.tgc-$os-$cpu-$pkgdirdesig.tardist
|
||||
|
||||
@ -456,12 +459,15 @@ create_spec()
|
||||
}
|
||||
|
||||
# make_dist(): Create inst image
|
||||
# params: $1=[shortroot]
|
||||
# params: none
|
||||
# Run gendist to create the instimage
|
||||
make_dist()
|
||||
{
|
||||
local arg1=${1-'x'}
|
||||
if [ "$arg1" == "shortroot" ]; then
|
||||
if [ "$1" == "shortroot" ]; then
|
||||
error $E_ARG_OBSO make_dist
|
||||
fi
|
||||
|
||||
if [ "$shortroot" -eq 1 ]; then
|
||||
sbase=$stagedir
|
||||
else
|
||||
sbase=$stagedir/$topinstalldir
|
||||
@ -482,33 +488,28 @@ make_dist()
|
||||
# params: $1 - indicating whether or not the root is complete as described below
|
||||
# We expect generic_install to have made $stagedir the "root" dir
|
||||
# in that all paths below will be complete (ie. /usr/local/bin and not
|
||||
# just bin) *unless* $1=shortroot.
|
||||
# just bin) *unless* shortroot=1.
|
||||
generic_pack()
|
||||
{
|
||||
if [ "$1" == "shortroot" ]; then
|
||||
error $E_ARG_OBSO generic_pack
|
||||
fi
|
||||
clean meta
|
||||
|
||||
# Verify if $1 is defined
|
||||
local arg1=${1-'x'}
|
||||
case $arg1 in
|
||||
'x') if [ $catman -eq 1 -a -d $stagedir$topinstalldir/man ]; then
|
||||
setdir $stagedir$topinstalldir/man
|
||||
fix_man
|
||||
fi
|
||||
setdir $stagedir$topinstalldir
|
||||
create_idb
|
||||
create_spec
|
||||
make_dist
|
||||
;;
|
||||
'shortroot') if [ $catman -eq 1 -a -d $stagedir/man ]; then
|
||||
setdir $stagedir/man
|
||||
fix_man
|
||||
fi
|
||||
setdir stage
|
||||
create_idb
|
||||
create_spec
|
||||
make_dist shortroot
|
||||
;;
|
||||
'*') error $E_BAD_ARGS generic_pack
|
||||
;;
|
||||
esac
|
||||
if [ "$shortroot" -eq 1 ]; then
|
||||
if [ $catman -eq 1 -a -d $stagedir/man ]; then
|
||||
setdir $stagedir/man
|
||||
fix_man
|
||||
fi
|
||||
setdir stage
|
||||
else
|
||||
if [ $catman -eq 1 -a -d $stagedir$topinstalldir/man ]; then
|
||||
setdir $stagedir$topinstalldir/man
|
||||
fix_man
|
||||
fi
|
||||
setdir $stagedir$topinstalldir
|
||||
fi
|
||||
create_idb
|
||||
create_spec
|
||||
make_dist
|
||||
}
|
||||
|
@ -154,22 +154,21 @@ add_file()
|
||||
# Define generic functions for different build stages
|
||||
#####################################################
|
||||
# generic_pack(): Build package using files from 'install' stage
|
||||
# params: $1 - indicating whether or not the root is complete as described below
|
||||
# params: none
|
||||
# We expect generic_install to have made $stagedir the "root" dir
|
||||
# in that all paths below will be complete (ie. /usr/local/bin and not
|
||||
# just bin) *unless* $1=shortroot.
|
||||
# just bin) *unless* shortroot=1.
|
||||
generic_pack()
|
||||
{
|
||||
if [ "$1" == "shortroot" ]; then
|
||||
error $E_ARG_OBSO generic_pack
|
||||
fi
|
||||
clean meta
|
||||
# Verify if $1 is defined
|
||||
local arg1=${1-'x'}
|
||||
case $arg1 in
|
||||
'x') setdir "$stagedir$prefix" # arg1 was undefined
|
||||
;;
|
||||
'shortroot') setdir "$stagedir"
|
||||
;;
|
||||
'*') error $E_BAD_ARGS generic_pack
|
||||
esac
|
||||
if [ "$shortroot" -eq 1" ]; then
|
||||
setdir "$stagedir"
|
||||
else
|
||||
setdir "$stagedir$prefix"
|
||||
fi
|
||||
pack_info
|
||||
prototype root bin script
|
||||
make_pkg
|
||||
|
Loading…
x
Reference in New Issue
Block a user