xbps: indent, use local vars in more places, misc.

--HG--
extra : convert_revision : 2e202b8f7b4a7ff87002dca7fd8ef286aece083a
This commit is contained in:
Juan RP 2008-11-04 02:22:21 +01:00
parent 2fde13b869
commit bc754a46dd

85
xbps.sh
View File

@ -89,14 +89,9 @@ check_path()
eval local orig="$1" eval local orig="$1"
case "$orig" in case "$orig" in
/) /) ;;
;; /*) orig="${orig%/}" ;;
/*) *) orig="$(pwd)/${orig%/}" ;;
orig="${orig%/}"
;;
*)
orig="$(pwd)/${orig%/}"
;;
esac esac
path_fixed="$orig" path_fixed="$orig"
@ -541,14 +536,15 @@ fetch_distfiles()
libtool_fixup_file() libtool_fixup_file()
{ {
local hldirf="hardcode_libdir_flag_spec"
[ "$pkgname" = "libtool" -o ! -f $wrksrc/libtool ] && return 0 [ "$pkgname" = "libtool" -o ! -f $wrksrc/libtool ] && return 0
[ -n "$no_libtool_fixup" ] && return 0 [ -n "$no_libtool_fixup" ] && return 0
# If we are being invoked by a chroot, don't transform stuff. # If we are being invoked by a chroot, don't transform stuff.
[ -n "$in_chroot" ] && return 0 [ -n "$in_chroot" ] && return 0
sed -i -e \ sed -i -e "s|^$hldirf=.*|$hldirf=\"-Wl,-rpath /usr/lib\"|g" \
's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec="-Wl,-rpath /usr/lib"|g' \
$wrksrc/libtool $wrksrc/libtool
} }
@ -580,7 +576,7 @@ libtool_fixup_la_files()
msg_normal "Fixing up libtool archive: ${f##$where/}." msg_normal "Fixing up libtool archive: ${f##$where/}."
sed -i -e "s|\/..\/lib||g;s|\/\/lib|/usr/lib|g" \ sed -i -e "s|\/..\/lib||g;s|\/\/lib|/usr/lib|g" \
-e "s|$XBPS_MASTERDIR||g;s|$wrksrc||g" \ -e "s|$XBPS_MASTERDIR||g;s|$wrksrc||g" \
-e "s|$XBPS_DESTDIR/$pkgname-$version||g" $f -e "s|$where||g" $f
awk '{ if (/^ dependency_libs/) {gsub("/usr[^]*lib","lib");}print}' \ awk '{ if (/^ dependency_libs/) {gsub("/usr[^]*lib","lib");}print}' \
$f > $f.in && mv $f.in $f $f > $f.in && mv $f.in $f
fi fi
@ -635,38 +631,36 @@ apply_tmpl_patches()
# If package needs some patches applied before building, # If package needs some patches applied before building,
# apply them now. # apply them now.
# #
if [ -n "$patch_files" ]; then for i in ${patch_files}; do
for i in ${patch_files}; do patch="$XBPS_TEMPLATESDIR/$i"
patch="$XBPS_TEMPLATESDIR/$i" if [ ! -f "$patch" ]; then
if [ ! -f "$patch" ]; then msg_warn "unexistent patch: $i."
msg_warn "unexistent patch: $i." continue
continue fi
fi
cp -f $patch $wrksrc cp -f $patch $wrksrc
# Try to guess if its a compressed patch. # Try to guess if its a compressed patch.
if $(echo $patch|grep -q '.diff.gz'); then if $(echo $patch|grep -q '.diff.gz'); then
gunzip $wrksrc/$i gunzip $wrksrc/$i
patch=${i%%.gz} patch=${i%%.gz}
elif $(echo $patch|grep -q '.diff.bz2'); then elif $(echo $patch|grep -q '.diff.bz2'); then
bunzip2 $wrksrc/$i bunzip2 $wrksrc/$i
patch=${i%%.bz2} patch=${i%%.bz2}
elif $(echo $patch|grep -q '.diff'); then elif $(echo $patch|grep -q '.diff'); then
patch=$i patch=$i
else else
msg_warn "unknown patch type: $i." msg_warn "unknown patch type: $i."
continue continue
fi fi
cd $wrksrc && patch -s -p0 < $patch 2>/dev/null cd $wrksrc && patch -s -p0 < $patch 2>/dev/null
if [ "$?" -eq 0 ]; then if [ "$?" -eq 0 ]; then
msg_normal "Patch applied: $i." msg_normal "Patch applied: $i."
else else
msg_error "couldn't apply patch: $i." msg_error "couldn't apply patch: $i."
fi fi
done done
fi
touch -f $XBPS_APPLYPATCHES_DONE touch -f $XBPS_APPLYPATCHES_DONE
} }
@ -679,6 +673,7 @@ configure_src_phase()
{ {
local pkg="$1" local pkg="$1"
local f= local f=
local destdir=$XBPS_DESTDIR/$pkgname-$version
[ -z $pkg ] && [ -z $pkgname ] && return 1 [ -z $pkg ] && [ -z $pkgname ] && return 1
@ -734,8 +729,8 @@ configure_src_phase()
if [ "$build_style" = "gnu_configure" ]; then if [ "$build_style" = "gnu_configure" ]; then
${configure_script} \ ${configure_script} \
--prefix=${_prefix} --sysconfdir=/etc \ --prefix=${_prefix} --sysconfdir=/etc \
--infodir=$XBPS_DESTDIR/$pkgname-$version/usr/share/info \ --infodir=$destdir/usr/share/info \
--mandir=$XBPS_DESTDIR/$pkgname-$version/usr/share/man \ --mandir=$destdir/usr/share/man \
${configure_args} ${configure_args}
# #
# Packages using propietary configure scripts. # Packages using propietary configure scripts.
@ -919,9 +914,11 @@ install_src_phase()
# #
make_install() make_install()
{ {
local destdir=$XBPS_DESTDIR/$pkgname-$version
if [ -z "$make_install_target" ]; then if [ -z "$make_install_target" ]; then
make_install_target="install prefix=$XBPS_DESTDIR/$pkgname-$version/usr" make_install_target="install prefix=$destdir/usr"
make_install_target="$make_install_target sysconfdir=$XBPS_DESTDIR/$pkgname-$version/etc" make_install_target="$make_install_target sysconfdir=$destdir/etc"
fi fi
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make [ -z "$make_cmd" ] && make_cmd=/usr/bin/make