- Support 'dir' command in pkgdef

- New metainstalldir for when topdir needs to be / (like prngd, openssh)
- Allow make install to be skipped in generic_install
This commit is contained in:
Tom G. Christensen 2004-07-26 18:40:12 +00:00
parent 9994bcd1e5
commit de2bd7d63b
2 changed files with 70 additions and 24 deletions

View File

@ -83,6 +83,7 @@ srcfiles=$buildpkgbase/srcfiles
topinstalldir=/usr/local
prefix=$topinstalldir
metainstalldir=$topinstalldir
# Keep this in hard-quotes to delay expansion
configure_args='--prefix=$prefix --disable-nls'
@ -91,6 +92,7 @@ configure_args='--prefix=$prefix --disable-nls'
_docdir=share/doc
# Other relative dirs
_bindir=bin
_sbindir=sbin
_libdir=lib
_sharedir=share
_mandir=man
@ -119,6 +121,10 @@ dostrip_shared=1 # default to stripping shared objects during the install stage
dostrip_static=1 # default to stripping static archives during the install stage
shortroot=0 # Deep or shallow stagedir?
# This is meant to aid custom install functions that wants
# to skip the clean stage & make install parts of generic_install
custom_install=0
# Distfiles should be named like this
# <name>-<version>-<pkgver>.sb-<os>-<cpu>-<pkgdirdesig>
# ie: libmad-0.14.2b-1.sb-sol5.8-sparcv9-local
@ -496,7 +502,7 @@ generic_build()
if [ $? -ne 0 ]; then
error $E_BAD_CONFIG generic_build
fi
$MAKE_PROG
$MAKE_PROG
if [ $? -ne 0 ]; then
error $E_BAD_MAKE generic_build
fi
@ -513,11 +519,13 @@ generic_install()
if [ "$arg1" != "x" ]; then
destvar=$arg1 # $1 was defined
fi
clean stage
setdir source
$MAKE_PROG $destvar=$stagedir install
if [ $? -ne 0 ]; then
error $E_BAD_MAKE generic_install
if [ "$custom_install" -eq 0 ]; then
clean stage
setdir source
$MAKE_PROG $destvar=$stagedir install
if [ $? -ne 0 ]; then
error $E_BAD_MAKE generic_install
fi
fi
if [ $dostrip -eq 1 ]; then
do_strip

View File

@ -251,6 +251,38 @@ add_files()
IFS=$OIFS
}
# add_dir(): Add a single dir entry to the IDB file
# params: $1=dir $2=subsys $3=default permissons $4=defuid $5=defgid
# Currently ops and specattr are unimplemented for dirs
add_dir()
{
local fspec=$(_upls $1)
local prodcat=$2
local defperm=$3
local owner=$4
local group=$5
# Note that dir blablah is *not* added to $metadir/files.tmp
local FILES=$($FIND $fspec -type d -print)
OIFS=$IFS
IFS="
"
for i in $FILES
do
IFS=$OIFS
if [ "$defperm" == "-" ]; then
permlist=$($LS -ld "$i" | $CUT -d " " -f 1)
perm=$(compute_octal $permlist)
else
perm=$defperm
fi
fname=$(fix_fname "$i")
echo "d $perm $owner $group ${topinstalldir:1}/$fname $i ${pkgname}.${prodcat}" >>$idbfile
done
IFS=$OIFS
}
# fetch_imageconf(): Fetch a list of toplevel image entries with descriptions
# params: none
# Discard the ones that we don't have any subsystems for
@ -396,31 +428,38 @@ do_strip_static()
# Note that parse_def does most of the work.
create_idb()
{
local metaprefix
fetch_ops
parse_def
# hackish - FIXME perhaps?
local pcpos=${#pc[@]} # First vacant position in the subsys list array $pc
if [ -d src ]; then # We have a srcdir which means we have patches, so add them to the idb file
add_files "src" opt.src - root sys ""
# Compute relative metaprefix
# as $metainstalldir - $topinstalldir
metaprefix=${metainstalldir##$topinstalldir}
metaprefix="${metaprefix#/*}"
[ ! -z "$metaprefix" ] && metaprefix="${metaprefix}/"
if [ -d "${stagedir}${metainstalldir}/src" ]; then # We have a srcdir which means we have patches, so add them to the idb file
add_files "${metaprefix}src" opt.src - root sys ""
pc[$pcpos]="opt.src"
let "pcpos = pcpos + 1"
fi
if [ -d relnotes ]; then # We have releasenotes, add them to idb file
add_files "relnotes" opt.relnotes - root sys ""
if [ -d "${stagedir}${metainstalldir}/relnotes" ]; then # We have releasenotes, add them to idb file
add_files "${metaprefix}relnotes" opt.relnotes - root sys ""
pc[$pcpos]="opt.relnotes"
let "pcpos = pcpos + 1"
fi
if [ -d dist ]; then # We have spec & idb files
add_files "dist" opt.dist - root sys ""
# if [ -d "${stagedir}${metainstalldir}/dist" ]; then # We have spec & idb files
# add_files "dist" opt.dist - root sys ""
pc[$pcpos]="opt.dist"
fi
# Add entries for the spec & idb files (opt.dist), they will be installed later, after they've actually been created
echo "f 644 root sys ${topinstalldir:1}/dist/$topdir-$version-$pkgver/$topdir.idb dist/$topdir-$version-$pkgver/$topdir.idb ${pkgname}.opt.dist" >>$idbfile
echo "f 644 root sys ${topinstalldir:1}/dist/$topdir-$version-$pkgver/$topdir.spec dist/$topdir-$version-$pkgver/$topdir.spec ${pkgname}.opt.dist" >>$idbfile
echo "dist/$topdir-$version-$pkgver/$topdir.idb" >> $metadir/files.tmp
echo "dist/$topdir-$version-$pkgver/$topdir.spec" >> $metadir/files.tmp
# Add entries for the spec & idb files (opt.dist), they will be installed later, after they've actually been created
echo "f 644 root sys ${metainstalldir}/dist/$topdir-$version-$pkgver/$topdir.idb ${metaprefix}dist/$topdir-$version-$pkgver/$topdir.idb ${pkgname}.opt.dist" >>$idbfile
echo "f 644 root sys ${metainstalldir}/dist/$topdir-$version-$pkgver/$topdir.spec ${metaprefix}dist/$topdir-$version-$pkgver/$topdir.spec ${pkgname}.opt.dist" >>$idbfile
echo "${metaprefix}dist/$topdir-$version-$pkgver/$topdir.idb" >> $metadir/files.tmp
echo "${metaprefix}dist/$topdir-$version-$pkgver/$topdir.spec" >> $metadir/files.tmp
# fi
$SORT +4u -6 < $idbfile > $metadir/idbtemp
lines=$(wc -l < $metadir/idbtemp)
@ -604,8 +643,7 @@ parse_def()
line=${line:5}
fi
if [ "${line:0:4}" == "dir " ]; then
echo "Hit unsupported 'dir' directive"
#add_dir $defaultperms $defaultuid $defaultgid "${line:4}" $secname # Add dir entry
add_dir "${line:4}" $subsys $defaultperms $defaultuid $defaultgid # Add dir entry to idb file
else
add_files "$line" $subsys $defaultperms $defaultuid $defaultgid "$specattr" # Build idb file from filespec
fi
@ -660,7 +698,7 @@ check_unpackaged()
# $prefix/src/$topdir-$version-$pkgver for adding to the opt.src subsystem
auto_src()
{
local distsrcdir="src/$topdir-$version-$pkgver"
local distsrcdir="${stagedir}${metainstalldir}/src/$topdir-$version-$pkgver"
$MKDIR -p $distsrcdir
# Add patches
local numpatch=${#patch[@]}
@ -707,7 +745,7 @@ auto_src()
auto_rel()
{
if [ -r $metadir/relnotes ]; then
local relmetadir=relnotes/$topdir-$version-$pkgver
local relmetadir=${stagedir}${metainstalldir}/relnotes/$topdir-$version-$pkgver
local cf="$(_upls $configure_args)"
local fullcf="./configure $cf"
local compiler_temp="$(gcc --version 2>&1 | $SED -n '1,1p')"
@ -731,7 +769,7 @@ auto_rel()
# the stagedir under dist/$topdir-$version-$pkgver
auto_dist()
{
local distmetadir=dist/$topdir-$version-$pkgver
local distmetadir=${stagedir}${metainstalldir}/dist/$topdir-$version-$pkgver
$MKDIR -p $distmetadir
$CP $idbfile $distmetadir
$CP $specfile $distmetadir