|
|
|
@ -19,7 +19,30 @@
|
|
|
|
|
# $2: $sbindir $bindir |
|
|
|
|
# |
|
|
|
|
pkg_djb_hierarchy=$1 |
|
|
|
|
pkg_djb_altdir=${2:-$bindir} |
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
# prepare root links for DJB filesystem hierarchy inside chrooted env. |
|
|
|
|
# |
|
|
|
|
if [ "$SDECFG_PKG_DJB_LAYOUT" == "1" ]; then |
|
|
|
|
for x in package command service; do |
|
|
|
|
eval "pkg_djb_${x}dir='$root/$x'" |
|
|
|
|
var_append flistroot ' ' $x |
|
|
|
|
done |
|
|
|
|
elif [ "$SDECFG_PKG_DJB_LAYOUT" == "0" ]; then |
|
|
|
|
pkg_djb_packagedir= |
|
|
|
|
pkg_djb_commanddir="$root${2:-$bindir}" |
|
|
|
|
pkg_djb_servicedir="$root/var/service" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# create them if it doesn't exist |
|
|
|
|
for x in package command service; do |
|
|
|
|
y=$( eval echo \$pkg_djb_${x}dir ) |
|
|
|
|
if [ -n "$y" ]; then |
|
|
|
|
mkdir -p "$y" |
|
|
|
|
# TODO: research where 1755 comes from |
|
|
|
|
[ "$x" = command ] || chmod 1755 "$y" |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# $logdir |
|
|
|
|
if [ "${localstatedir%$pkg}" != "$localstatedir" ]; then |
|
|
|
@ -40,6 +63,7 @@ fi
|
|
|
|
|
srcdir="$pkg_djb_hierarchy/$pkg-$ver" |
|
|
|
|
|
|
|
|
|
if [ "$createdocs" != "0" ]; then |
|
|
|
|
# let us handle the installation of the docs |
|
|
|
|
createdocs=0 |
|
|
|
|
hook_add postdoc 2 'pkg_djb_installdoc $pkg_djb_hierarchy' |
|
|
|
|
fi |
|
|
|
@ -51,29 +75,14 @@ pkg_djb_main() {
|
|
|
|
|
hook_eval premake |
|
|
|
|
./package/compile |
|
|
|
|
hook_eval inmake |
|
|
|
|
pkg_djb_installpackage $pkg_djb_hierarchy $pkg_djb_altdir |
|
|
|
|
pkg_djb_installpackage $pkg_djb_hierarchy |
|
|
|
|
hook_eval postmake |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# FIXME: join pkg_djb_safecopy and pkg_djb_safelink |
|
|
|
|
pkg_djb_safecopy() { |
|
|
|
|
local source="$( echo "${1#$root}/$3" | tr -s '/' ) " |
|
|
|
|
local target="$( echo "${2#$root}/$3" | tr -s '/' ) " |
|
|
|
|
echo "'$source' -> '$target'" |
|
|
|
|
cp -vfp $source ${root}$target |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pkg_djb_safelink() { |
|
|
|
|
local source="$( echo "${1#$root}/$3" | tr -s '/' ) " |
|
|
|
|
local target="$( echo "${2#$root}/$3" | tr -s '/' ) " |
|
|
|
|
echo "create symbolic link '$source' to '$target'" |
|
|
|
|
ln -snvf $source ${root}$target |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pkg_djb_substitute() { |
|
|
|
|
sed \ |
|
|
|
|
-e "s,D_commanddir,$pkg_djb_commanddir,g" \ |
|
|
|
|
-e "s,D_servicedir,$pkg_djb_servicedir,g" \ |
|
|
|
|
-e "s,D_commanddir,${pkg_djb_commanddir#$root},g" \ |
|
|
|
|
-e "s,D_servicedir,${pkg_djb_servicedir#$root},g" \ |
|
|
|
|
-e "s,D_logdir,$logdir,g" \ |
|
|
|
|
$1 |
|
|
|
|
} |
|
|
|
@ -86,37 +95,24 @@ pkg_djb_installpackage() {
|
|
|
|
|
|
|
|
|
|
local x= y= cmddir= |
|
|
|
|
local package=$1 |
|
|
|
|
local altdir=$2 |
|
|
|
|
|
|
|
|
|
# FIXME: rework to loop over ./package/commands just once |
|
|
|
|
if [ "$pkg_djb_packagedir" ]; then |
|
|
|
|
cmddir="$pkg_djb_packagedir/$package/$pkg-$ver/command" |
|
|
|
|
|
|
|
|
|
echo 'Copying commands to package directory...' |
|
|
|
|
mkdir -p "$cmddir" |
|
|
|
|
for x in `cat ./package/commands`; do |
|
|
|
|
pkg_djb_safecopy ./command "$cmddir" $x |
|
|
|
|
done |
|
|
|
|
x="$pkg_djb_packagedir/$package" |
|
|
|
|
echo "Creating ${x#$root}/{$pkg,$pkg-$ver}..." |
|
|
|
|
mkdir -p "$x/$pkg-$ver/command" |
|
|
|
|
ln -svnf "$pkg-$ver" "$x/$pkg" |
|
|
|
|
|
|
|
|
|
echo "Creating symlink $pkg -> $pkg-$ver..." |
|
|
|
|
ln -svnf $pkg-$ver $pkg_djb_packagedir/$package/$pkg |
|
|
|
|
cmddir="$x/$pkg-$ver/command" |
|
|
|
|
else |
|
|
|
|
cmddir="./command" |
|
|
|
|
cmddir="$pkg_djb_commanddir" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ "$pkg_djb_commanddir" ]; then |
|
|
|
|
echo "Making command links in $pkg_djb_commanddir..." |
|
|
|
|
y=pkg_djb_safelink |
|
|
|
|
else |
|
|
|
|
echo 'Copying commands to $altdir...' |
|
|
|
|
pkg_djb_commanddir=$root/$altdir |
|
|
|
|
y=pkg_djb_safecopy |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
mkdir -p $pkg_djb_commanddir |
|
|
|
|
for x in `cat package/commands`; do |
|
|
|
|
$y $cmddir $pkg_djb_commanddir $x |
|
|
|
|
echo "Installing commands at ${cmddir#$root}..." |
|
|
|
|
for x in `cat ./package/commands`; do |
|
|
|
|
cp -vfp "./command/$x" "$cmddir/" |
|
|
|
|
[ -z "$pkg_djb_packagedir" ] || ln -snvf "${cmddir#$root}/$x" "$pkg_djb_commanddir/$x" |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# installs documentation to package directory or $docdir as requested |
|
|
|
@ -127,26 +123,26 @@ pkg_djb_installdoc() {
|
|
|
|
|
|
|
|
|
|
echo 'Copying documentation....' |
|
|
|
|
if [ "$pkg_djb_packagedir" ]; then |
|
|
|
|
docpkg=$pkg_djb_packagedir/$package/$pkg-$ver/package |
|
|
|
|
docdir=$pkg_djb_packagedir/$package/$pkg-$ver/doc |
|
|
|
|
else |
|
|
|
|
# $pkg_djb_* includes $root, $docdir doesn't. |
|
|
|
|
docpkg=$root/$docdir |
|
|
|
|
docpkg=${pkg_djb_packagedir#$root}/$package/$pkg-$ver/package |
|
|
|
|
docdir=${pkg_djb_packagedir#$root}/$package/$pkg-$ver/doc |
|
|
|
|
mkdir -p $root$docpkg $root$docdir |
|
|
|
|
else |
|
|
|
|
docpkg=$docdir |
|
|
|
|
fi |
|
|
|
|
mkdir -p $docpkg $docdir |
|
|
|
|
|
|
|
|
|
# ./package |
|
|
|
|
for x in `ls ./package`; do |
|
|
|
|
case $x in |
|
|
|
|
compile|install*|upgrade) |
|
|
|
|
/bin/true ;; |
|
|
|
|
*) cp -vf ./package/$x $docpkg ;; |
|
|
|
|
*) cp -vf ./package/$x "$root$docpkg" ;; |
|
|
|
|
esac |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# ./doc |
|
|
|
|
if [ -d doc ]; then |
|
|
|
|
cp -rLv ./doc/* $docdir |
|
|
|
|
cp -rLv ./doc/* "$root$docdir" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# ./man |
|
|
|
|