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
|
topinstalldir=/usr/local
|
||||||
prefix=$topinstalldir
|
prefix=$topinstalldir
|
||||||
|
|
||||||
|
# Docdir relative to $prefix
|
||||||
|
docdir=doc
|
||||||
|
|
||||||
# pkg information.
|
# pkg information.
|
||||||
# The following 3 vars can be used when constructing pkg metadata
|
# The following 3 vars can be used when constructing pkg metadata
|
||||||
# Override as necessary.
|
# Override as necessary.
|
||||||
@ -87,6 +90,7 @@ pkgdirdesig=${topinstalldir##/*/} # topinstalldir suffix
|
|||||||
# Functionality controls
|
# Functionality controls
|
||||||
catman=0 # Don't fix manpages pr. default
|
catman=0 # Don't fix manpages pr. default
|
||||||
dostrip=1 # default to stripping binaries during the install stage
|
dostrip=1 # default to stripping binaries during the install stage
|
||||||
|
shortroot=0 # Shallow or deep stagedir?
|
||||||
|
|
||||||
# Distfiles should be named like this
|
# Distfiles should be named like this
|
||||||
# <name>-<version>-<pkgver>.sb-<os>-<cpu>-<pkgdirdesig>
|
# <name>-<version>-<pkgver>.sb-<os>-<cpu>-<pkgdirdesig>
|
||||||
@ -108,6 +112,7 @@ E_BAD_MAKE=38
|
|||||||
E_BAD_CLEANOPTIONS=39
|
E_BAD_CLEANOPTIONS=39
|
||||||
E_BAD_STRIP=40
|
E_BAD_STRIP=40
|
||||||
E_BAD_ARGS=41
|
E_BAD_ARGS=41
|
||||||
|
E_ARG_OBSO=42
|
||||||
|
|
||||||
error_txt[$E_BAD_FILE]="File not found"
|
error_txt[$E_BAD_FILE]="File not found"
|
||||||
error_txt[$E_PATCH_FAILED]="Patch failed"
|
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_BAD_MAKE]="make failed"
|
||||||
error_txt[$E_MISSING_ARGS]="A required argument was missing"
|
error_txt[$E_MISSING_ARGS]="A required argument was missing"
|
||||||
error_txt[$E_BAD_ARGS]="An illegal argument was passed"
|
error_txt[$E_BAD_ARGS]="An illegal argument was passed"
|
||||||
|
error_txt[$E_ARG_OBSO]="Function nolonger supports the argument you passed"
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
# Helper functions
|
# Helper functions
|
||||||
@ -303,6 +309,28 @@ fix_man()
|
|||||||
done
|
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
|
# Define generic functions for different build stages
|
||||||
#####################################################
|
#####################################################
|
||||||
|
@ -11,6 +11,9 @@ GZIP=/usr/people/tgc/bin/gzip
|
|||||||
BZIP2=/usr/local/bin/bzip2
|
BZIP2=/usr/local/bin/bzip2
|
||||||
STRIP=/bin/true
|
STRIP=/bin/true
|
||||||
|
|
||||||
|
# This is the hostname command we'll want on Irix
|
||||||
|
HOSTNAME=/usr/bsd/hostname
|
||||||
|
|
||||||
# Configuration vars
|
# Configuration vars
|
||||||
imageconf=$buildpkgbase/scripts/image.conf
|
imageconf=$buildpkgbase/scripts/image.conf
|
||||||
subsysconf=$buildpkgbase/scripts/subsys.conf
|
subsysconf=$buildpkgbase/scripts/subsys.conf
|
||||||
@ -45,7 +48,7 @@ cpu=mips3
|
|||||||
META_CLEAN="$topdir.spec $topdir.idb"
|
META_CLEAN="$topdir.spec $topdir.idb"
|
||||||
|
|
||||||
# Host specific configuration
|
# 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
|
distfile=$topdir-$version-$pkgver.tgc-$os-$cpu-$pkgdirdesig.tardist
|
||||||
|
|
||||||
@ -456,12 +459,15 @@ create_spec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# make_dist(): Create inst image
|
# make_dist(): Create inst image
|
||||||
# params: $1=[shortroot]
|
# params: none
|
||||||
# Run gendist to create the instimage
|
# Run gendist to create the instimage
|
||||||
make_dist()
|
make_dist()
|
||||||
{
|
{
|
||||||
local arg1=${1-'x'}
|
if [ "$1" == "shortroot" ]; then
|
||||||
if [ "$arg1" == "shortroot" ]; then
|
error $E_ARG_OBSO make_dist
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$shortroot" -eq 1 ]; then
|
||||||
sbase=$stagedir
|
sbase=$stagedir
|
||||||
else
|
else
|
||||||
sbase=$stagedir/$topinstalldir
|
sbase=$stagedir/$topinstalldir
|
||||||
@ -482,33 +488,28 @@ make_dist()
|
|||||||
# params: $1 - indicating whether or not the root is complete as described below
|
# params: $1 - indicating whether or not the root is complete as described below
|
||||||
# We expect generic_install to have made $stagedir the "root" dir
|
# 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
|
# 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()
|
generic_pack()
|
||||||
{
|
{
|
||||||
|
if [ "$1" == "shortroot" ]; then
|
||||||
|
error $E_ARG_OBSO generic_pack
|
||||||
|
fi
|
||||||
clean meta
|
clean meta
|
||||||
|
|
||||||
# Verify if $1 is defined
|
if [ "$shortroot" -eq 1 ]; then
|
||||||
local arg1=${1-'x'}
|
if [ $catman -eq 1 -a -d $stagedir/man ]; then
|
||||||
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
|
setdir $stagedir/man
|
||||||
fix_man
|
fix_man
|
||||||
fi
|
fi
|
||||||
setdir stage
|
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_idb
|
||||||
create_spec
|
create_spec
|
||||||
make_dist shortroot
|
make_dist
|
||||||
;;
|
|
||||||
'*') error $E_BAD_ARGS generic_pack
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
@ -154,22 +154,21 @@ add_file()
|
|||||||
# Define generic functions for different build stages
|
# Define generic functions for different build stages
|
||||||
#####################################################
|
#####################################################
|
||||||
# generic_pack(): Build package using files from 'install' stage
|
# 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
|
# 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
|
# 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()
|
generic_pack()
|
||||||
{
|
{
|
||||||
|
if [ "$1" == "shortroot" ]; then
|
||||||
|
error $E_ARG_OBSO generic_pack
|
||||||
|
fi
|
||||||
clean meta
|
clean meta
|
||||||
# Verify if $1 is defined
|
if [ "$shortroot" -eq 1" ]; then
|
||||||
local arg1=${1-'x'}
|
setdir "$stagedir"
|
||||||
case $arg1 in
|
else
|
||||||
'x') setdir "$stagedir$prefix" # arg1 was undefined
|
setdir "$stagedir$prefix"
|
||||||
;;
|
fi
|
||||||
'shortroot') setdir "$stagedir"
|
|
||||||
;;
|
|
||||||
'*') error $E_BAD_ARGS generic_pack
|
|
||||||
esac
|
|
||||||
pack_info
|
pack_info
|
||||||
prototype root bin script
|
prototype root bin script
|
||||||
make_pkg
|
make_pkg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user