Require to configure/build/install in the chroot all packages.

This is to ensure that only stuff found in the chroot will be used,
and to avoid some stupid problems with libtool scripts. Therefore only
templates that have $base_chroot set can be built without the chroot.

As bonus now all messages are prepended with "[chroot]" when xbps.sh
is running inside of it.

--HG--
extra : convert_revision : 68195f4b240c01eea18777767b555604d892400f
This commit is contained in:
Juan RP 2008-10-27 07:42:40 +01:00
parent e9231b5999
commit 5a249b6c4f
25 changed files with 187 additions and 86 deletions

View file

@ -18,13 +18,14 @@ if [ "$(id -u)" -ne 0 ]; then
fi fi
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
echo "==> Preparing chroot on $XBPS_MASTERDIR... " echo -n "==> Preparing chroot on $XBPS_MASTERDIR... "
chown -R root:root $XBPS_MASTERDIR/* chown -R root:root $XBPS_MASTERDIR/*
chmod +s $XBPS_MASTERDIR/usr/libexec/pt_chown chmod +s $XBPS_MASTERDIR/usr/libexec/pt_chown
cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts $XBPS_MASTERDIR/etc cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts $XBPS_MASTERDIR/etc
touch $XBPS_MASTERDIR/.xbps_perms_done touch $XBPS_MASTERDIR/.xbps_perms_done
echo "done."
else else
echo "==> Entering into the chroot on $XBPS_MASTERDIR..." echo "==> Entering into the chroot on $XBPS_MASTERDIR."
fi fi
for f in bin sbin tmp var sys proc dev xbps xbps_builddir xbps_destdir; do for f in bin sbin tmp var sys proc dev xbps xbps_builddir xbps_destdir; do
@ -72,6 +73,30 @@ rebuild_ldso_cache()
echo " done." echo " done."
} }
configure_chroot_pkg()
{
local pkg="$1"
[ -z "$pkg" ] && return 1
rebuild_ldso_cache
env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh configure $pkg
echo "==> Exiting from the chroot on $XBPS_MASTERDIR."
umount_chroot_fs
}
build_chroot_pkg()
{
local pkg="$1"
[ -z "$pkg" ] && return 1
rebuild_ldso_cache
env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh build $pkg
echo "==> Exiting from the chroot on $XBPS_MASTERDIR."
umount_chroot_fs
}
install_chroot_pkg() install_chroot_pkg()
{ {
local pkg="$1" local pkg="$1"
@ -79,17 +104,17 @@ install_chroot_pkg()
[ -z "$pkg" ] && return 1 [ -z "$pkg" ] && return 1
rebuild_ldso_cache rebuild_ldso_cache
chroot $XBPS_MASTERDIR /xbps/xbps.sh install $pkg env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh install $pkg
echo "==> Exiting from the chroot on $XBPS_MASTERDIR."
umount_chroot_fs umount_chroot_fs
echo "==> Exiting from the chroot on $XBPS_MASTERDIR..."
} }
enter_chroot() enter_chroot()
{ {
rebuild_ldso_cache rebuild_ldso_cache
chroot $XBPS_MASTERDIR /bin/bash env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash
echo "==> Exiting from the chroot on $XBPS_MASTERDIR."
umount_chroot_fs umount_chroot_fs
echo "==> Exiting from the chroot on $XBPS_MASTERDIR..."
} }
umount_chroot_fs() umount_chroot_fs()

View file

@ -21,3 +21,5 @@ long_desc="
strings for outputing the printable characters in files, strip for strings for outputing the printable characters in files, strip for
stripping out symbols (like debugging information) from object files, stripping out symbols (like debugging information) from object files,
and other tools." and other tools."
base_chroot=yes

View file

@ -11,5 +11,6 @@ long_desc="
Bison is the GNU replacement for yacc(1). Some programs depend on Bison is the GNU replacement for yacc(1). Some programs depend on
extensions present in Bison." extensions present in Bison."
base_chroot=yes
build_depends="m4-1.4.12" build_depends="m4-1.4.12"
run_depends="m4-1.4.12 glibc-2.8" run_depends="m4-1.4.12 glibc-2.8"

View file

@ -9,3 +9,5 @@ short_desc="The bzip2 compression library"
maintainer="Juan RP <xtraeme@gmail.com>" maintainer="Juan RP <xtraeme@gmail.com>"
checksum=f7bf5368309d76e5daf3a89d4d1bea688dac7780742e7a0ae1af19be9316fe22 checksum=f7bf5368309d76e5daf3a89d4d1bea688dac7780742e7a0ae1af19be9316fe22
long_desc= long_desc=
base_chroot=yes

View file

@ -12,4 +12,5 @@ long_desc="
utilities of the GNU operating system. These are the core utilities utilities of the GNU operating system. These are the core utilities
which are expected to exist on every operating system." which are expected to exist on every operating system."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -11,5 +11,6 @@ long_desc="
features are a superset of the Unix features and they are significantly features are a superset of the Unix features and they are significantly
faster. Cmp has been moved into this package from the GNU textutils package. faster. Cmp has been moved into this package from the GNU textutils package.
These programs are usually used for creating patch files." These programs are usually used for creating patch files."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -11,5 +11,6 @@ long_desc="
File attempts to classify files depending on their contents and prints File attempts to classify files depending on their contents and prints
a description if a match is found." a description if a match is found."
base_chroot=yes
build_depends="zlib-1.2.3" build_depends="zlib-1.2.3"
run_depends="glibc-2.8 zlib-1.2.3" run_depends="glibc-2.8 zlib-1.2.3"

View file

@ -12,4 +12,5 @@ long_desc="
other programs to provide modular and powerful directory search and file other programs to provide modular and powerful directory search and file
locating capabilities to other commands." locating capabilities to other commands."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -8,5 +8,6 @@ maintainer="Juan RP <xtraeme@gmail.com>"
checksum=06dd872da7145088ae08475f7b11e5b9e810b8ead7d78d039003e671bb76ec65 checksum=06dd872da7145088ae08475f7b11e5b9e810b8ead7d78d039003e671bb76ec65
long_desc=" long_desc="
The GNU AWK utility, a pattern scanning and processing tool." The GNU AWK utility, a pattern scanning and processing tool."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -17,7 +17,9 @@ checksum=bfbf487731ad5dca37efe480a837417de071bd67e685d5c1df6a290707575165
long_desc=" long_desc="
The GNU C Compiler suite, with support for C, C++, Fortran, ObjC." The GNU C Compiler suite, with support for C, C++, Fortran, ObjC."
base_chroot=yes
build_depends="mpfr-2.3.2 binutils-2.18" build_depends="mpfr-2.3.2 binutils-2.18"
run_depends="glibc-2.8"
# As specified in the LFS book, disable installing libiberty. # As specified in the LFS book, disable installing libiberty.
pre_configure() pre_configure()

View file

@ -21,4 +21,5 @@ long_desc="
The advantage for GNU MP increases with the operand sizes for certain The advantage for GNU MP increases with the operand sizes for certain
operations, since GNU MP in many cases has asymptotically faster algorithms." operations, since GNU MP in many cases has asymptotically faster algorithms."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -15,5 +15,6 @@ long_desc="
full regexp matcher without necessarily having to look at every character. full regexp matcher without necessarily having to look at every character.
The result is typically many times faster than Unix grep or egrep." The result is typically many times faster than Unix grep or egrep."
base_chroot=yes
build_depends="texinfo-4.13a" build_depends="texinfo-4.13a"
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -12,4 +12,5 @@ long_desc="
and freedom from patented algorithms. The GNU Project uses it as the and freedom from patented algorithms. The GNU Project uses it as the
standard compression program for its system." standard compression program for its system."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -12,3 +12,5 @@ maintainer="Juan RP <xtraeme@gmail.com>"
checksum=52d9526ea8df33c9fab3df4564b0147b1866c76b0fd31474b92592567384a02c checksum=52d9526ea8df33c9fab3df4564b0147b1866c76b0fd31474b92592567384a02c
long_desc=" long_desc="
This package provides the linux kernel headers for use in userspace." This package provides the linux kernel headers for use in userspace."
base_chroot=yes

View file

@ -15,4 +15,5 @@ long_desc="
shell commands, doing arithmetic, etc. Autoconf needs GNU m4 for shell commands, doing arithmetic, etc. Autoconf needs GNU m4 for
generating configure scripts, but not for running them." generating configure scripts, but not for running them."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -11,4 +11,5 @@ long_desc="
program need to be recompiled and issues the commands to program need to be recompiled and issues the commands to
recompile them, when necessary." recompile them, when necessary."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -14,5 +14,6 @@ long_desc="
see more on the credit page. MPFR is based on the GMP multiple-precision see more on the credit page. MPFR is based on the GMP multiple-precision
library." library."
base_chroot=yes
build_depends="gmp-4.2.4" build_depends="gmp-4.2.4"
run_depends="glibc-2.8 gmp-4.2.4" run_depends="glibc-2.8 gmp-4.2.4"

View file

@ -17,4 +17,5 @@ long_desc="
ecompiler infocmp, clear, tput, tset, and a termcap conversion tool captoinfo. ecompiler infocmp, clear, tput, tset, and a termcap conversion tool captoinfo.
Full manual pages are provided for the library and tools." Full manual pages are provided for the library and tools."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -12,5 +12,6 @@ long_desc="
more original files, producing patched versions. more original files, producing patched versions.
This is the GPL version from the Free Software Foundation." This is the GPL version from the Free Software Foundation."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -21,3 +21,6 @@ long_desc="
This proplib version is the same version than is available on NetBSD, but This proplib version is the same version than is available on NetBSD, but
with the exception that NetBSD specific code has been removed and it has with the exception that NetBSD specific code has been removed and it has
been converted to be built through the GNU autotools." been converted to be built through the GNU autotools."
base_chroot=yes
run_depends="glibc-2.8"

View file

@ -10,5 +10,6 @@ checksum=be955bef7a81d69222e929689e0de0ecf64c13dc5b15b2ee5696d5ef66fdeec0
long_desc=" long_desc="
Sed, the GNU Stream Editor, copies the named files (standard input default) Sed, the GNU Stream Editor, copies the named files (standard input default)
to the standard output, edited according to a script of commands." to the standard output, edited according to a script of commands."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -12,5 +12,6 @@ long_desc="
invented by Richard Stallman and Bob Chassell many years ago, loosely based invented by Richard Stallman and Bob Chassell many years ago, loosely based
on Brian Reid's Scribe and other formatting languages of the time. It is on Brian Reid's Scribe and other formatting languages of the time. It is
used by many non-GNU projects as well." used by many non-GNU projects as well."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -13,4 +13,5 @@ long_desc="
is thread safe. The data format used by the library is described is thread safe. The data format used by the library is described
by RFCs (Request for Comments) 1950 to 1952." by RFCs (Request for Comments) 1950 to 1952."
base_chroot=yes
run_depends="glibc-2.8" run_depends="glibc-2.8"

View file

@ -53,7 +53,8 @@ main(int argc, char **argv)
prop_object_iterator_t dbditer; prop_object_iterator_t dbditer;
prop_object_t obj, obj2; prop_object_t obj, obj2;
prop_string_t pkg; prop_string_t pkg;
char dbfile[PATH_MAX], *dbfileenv, *tmppath; char dbfile[PATH_MAX], *dbfileenv, *tmppath, *in_chroot_env;
bool in_chroot = false;
if (argc < 2) if (argc < 2)
usage(); usage();
@ -73,6 +74,10 @@ main(int argc, char **argv)
/* nul terminate string */ /* nul terminate string */
dbfile[sizeof(dbfile) - 1] = '\0'; dbfile[sizeof(dbfile) - 1] = '\0';
in_chroot_env = getenv("in_chroot");
if (in_chroot_env != NULL)
in_chroot = true;
if (strcmp(argv[1], "installed") == 0) { if (strcmp(argv[1], "installed") == 0) {
/* Returns 0 if pkg is installed, 1 otherwise */ /* Returns 0 if pkg is installed, 1 otherwise */
if (argc != 3) if (argc != 3)
@ -121,7 +126,9 @@ main(int argc, char **argv)
exit(1); exit(1);
} }
} }
printf("==> %s-%s registered successfully.\n", argv[2], argv[3]);
printf("%s==> %s-%s registered successfully.\n",
in_chroot ? "[chroot] " : "", argv[2], argv[3]);
} else if (strcmp(argv[1], "unregister") == 0) { } else if (strcmp(argv[1], "unregister") == 0) {
/* Unregisters a package from the database */ /* Unregisters a package from the database */
@ -145,7 +152,8 @@ main(int argc, char **argv)
exit(1); exit(1);
} }
printf("==> %s-%s unregistered successfully.\n", argv[2], argv[3]); printf("%s==> %s-%s unregistered successfully.\n",
in_chroot ? "[chroot] " : "", argv[2], argv[3]);
} else if (strcmp(argv[1], "list") == 0) { } else if (strcmp(argv[1], "list") == 0) {
/* Lists packages currently registered in database */ /* Lists packages currently registered in database */

184
xbps.sh
View file

@ -128,10 +128,43 @@ run_func()
[ -z "$func" ] && return 1 [ -z "$func" ] && return 1
type $func | grep -q 'shell function' type -t $func | grep -q 'shell function'
[ $? -eq 0 ] && $func [ $? -eq 0 ] && $func
} }
msg_error()
{
[ -z "$1" ] && return 1
if [ -n "$in_chroot" ]; then
echo "[chroot] *** ERROR: $1 ***"
else
echo "*** ERROR: $1 ***"
fi
}
msg_warn()
{
[ -z "$1" ] && return 1
if [ -n "$in_chroot" ]; then
echo "[chroot] *** WARNING: $1 ***"
else
echo "*** WARNING: $1 ***"
fi
}
msg_normal()
{
[ -z "$1" ] && return 1
if [ -n "$in_chroot" ]; then
echo "[chroot] ==> $1"
else
echo "==> $1"
fi
}
# #
# Shows info about a template. # Shows info about a template.
# #
@ -176,8 +209,7 @@ check_config_vars()
cffound=yes && break cffound=yes && break
done done
if [ -z "$cffound" ]; then if [ -z "$cffound" ]; then
echo -n "*** ERROR: config file not specified " msg_error "cannot find a config file"
echo "and not in default location or current dir ***"
exit 1 exit 1
fi fi
fi fi
@ -186,8 +218,7 @@ check_config_vars()
XBPS_CONFIG_FILE=$path_fixed XBPS_CONFIG_FILE=$path_fixed
if [ ! -f "$XBPS_CONFIG_FILE" ]; then if [ ! -f "$XBPS_CONFIG_FILE" ]; then
echo -n "*** ERROR: cannot find configuration file: " msg_error "cannot find configuration file: $XBPS_CONFIG_FILE"
echo "'$XBPS_CONFIG_FILE' ***"
exit 1 exit 1
fi fi
@ -197,16 +228,14 @@ check_config_vars()
for f in ${XBPS_VARS}; do for f in ${XBPS_VARS}; do
eval val="\$$f" eval val="\$$f"
if [ -z "$val" ]; then if [ -z "$val" ]; then
echo -n "**** ERROR: '$f' not set in configuration " msg_error "'$f' not set in configuration file"
echo "file, aborting ***"
exit 1 exit 1
fi fi
if [ ! -d "$val" ]; then if [ ! -d "$val" ]; then
mkdir "$val" mkdir "$val"
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo -n "*** ERROR: couldn't create '$f'" msg_error "couldn't create '$f' directory"
echo " directory, aborting ***"
exit 1 exit 1
fi fi
fi fi
@ -251,7 +280,7 @@ setup_tmpl()
fi fi
prepare_tmpl prepare_tmpl
else else
echo "*** ERROR: cannot find $pkg template file ***" msg_error "cannot find $pkg template file"
exit 1 exit 1
fi fi
} }
@ -274,8 +303,7 @@ prepare_tmpl()
for i in ${REQ_VARS}; do for i in ${REQ_VARS}; do
eval val="\$$i" eval val="\$$i"
if [ -z "$val" -o -z "$i" ]; then if [ -z "$val" -o -z "$i" ]; then
echo -n "*** ERROR: \"$i\" not set on $pkgname " msg_error "\"$i\" not set on $pkgname template"
echo "template ***"
exit 1 exit 1
fi fi
done done
@ -292,8 +320,10 @@ prepare_tmpl()
XBPS_BUILD_DONE="$wrksrc/.xbps_build_done" XBPS_BUILD_DONE="$wrksrc/.xbps_build_done"
XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done" XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done"
export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin" if [ -z "$in_chroot" ]; then
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin" export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin"
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin"
fi
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
} }
@ -327,14 +357,13 @@ extract_distfiles()
if [ $count -gt 1 ]; then if [ $count -gt 1 ]; then
if [ -z "$wrksrc" ]; then if [ -z "$wrksrc" ]; then
echo -n "*** ERROR: \$wrksrc must be defined with " msg_error "\$wrksrc must be defined with multiple distfiles"
echo "multiple distfiles ***"
exit 1 exit 1
fi fi
mkdir $wrksrc mkdir $wrksrc
fi fi
echo "==> Extracting '$pkgname-$version' distfiles." msg_normal "Extracting '$pkgname-$version' distfile(s)."
if [ -n "$tar_override_cmd" ]; then if [ -n "$tar_override_cmd" ]; then
ltar_cmd="$tar_override_cmd" ltar_cmd="$tar_override_cmd"
@ -357,24 +386,21 @@ extract_distfiles()
.tar.bz2|.tbz) .tar.bz2|.tbz)
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -n "*** ERROR extracting $curfile into " msg_error "extracting $curfile into $lwrksrc"
echo "$lwrksrc ***"
exit 1 exit 1
fi fi
;; ;;
.tar.gz|.tgz) .tar.gz|.tgz)
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -n "*** ERROR extracting $curfile into " msg_error "extracting $curfile into $lwrksrc"
echo "$lwrksrc ***"
exit 1 exit 1
fi fi
;; ;;
.tar) .tar)
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -n "*** ERROR extracting $curfile into " msg_error "extracting $curfile into $lwrksrc"
echo "$lwrksrc ***"
exit 1 exit 1
fi fi
;; ;;
@ -391,20 +417,18 @@ extract_distfiles()
lwrksrc=$tmpwrksrc lwrksrc=$tmpwrksrc
unset tmpf tmpsufx tmpwrksrc unset tmpf tmpsufx tmpwrksrc
else else
echo "*** ERROR: cannot find unzip helper ***" msg_error "cannot find unzip helper"
exit 1 exit 1
fi fi
extract_unzip $XBPS_SRCDISTDIR/$curfile $lwrksrc extract_unzip $XBPS_SRCDISTDIR/$curfile $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -n "*** ERROR extracting $curfile into " msg_error "extracting $curfile into $lwrksrc"
echo "$lwrksrc ***"
exit 1 exit 1
fi fi
;; ;;
*) *)
echo -n "*** ERROR: cannot guess $curfile extract " msg_error "cannot guess $curfile extract suffix"
echo "suffix ***"
exit 1 exit 1
;; ;;
esac esac
@ -426,11 +450,11 @@ verify_sha256_cksum()
filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file) filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file)
if [ "$origsum" != "$filesum" ]; then if [ "$origsum" != "$filesum" ]; then
echo "*** ERROR: SHA256 checksum doesn't match for $file ***" msg_error "SHA256 checksum doesn't match for $file"
exit 1 exit 1
fi fi
echo "=> SHA256 checksum OK for $file." msg_normal "SHA256 checksum OK for $file."
} }
# #
@ -468,8 +492,7 @@ fetch_distfiles()
done done
if [ -z $found ]; then if [ -z $found ]; then
echo -n "*** ERROR: cannot find checksum for " msg_error "cannot find checksum for $curfile"
echo "$curfile ***"
exit 1 exit 1
fi fi
@ -482,7 +505,7 @@ fetch_distfiles()
fi fi
fi fi
echo "==> Fetching distfile: \`$curfile'." msg_normal "Fetching distfile: \`$curfile'."
if [ -n "$distfiles" ]; then if [ -n "$distfiles" ]; then
localurl="$f" localurl="$f"
@ -495,11 +518,9 @@ fetch_distfiles()
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
unset localurl unset localurl
if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then
echo -n "*** ERROR: couldn't fetch '$curfile', " msg_error "couldn't fetch '$curfile'"
echo "aborting ***"
else else
echo -n "*** ERROR: there was an error " msg_error "there was an error fetching '$curfile'"
echo "fetching '$curfile', aborting ***"
fi fi
exit 1 exit 1
else else
@ -518,8 +539,7 @@ fetch_distfiles()
done done
if [ -z $found ]; then if [ -z $found ]; then
echo -n "*** ERROR: cannot find checksum for " msg_error "cannot find checksum for $curfile"
echo "$curfile ***"
exit 1 exit 1
fi fi
@ -542,7 +562,7 @@ libtool_fixup_file()
[ -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.
[ "$XBPS_MASTERDIR" = "/" ] && return 0 [ -n "$in_chroot" ] && return 0
sed -i -e \ sed -i -e \
's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec="-Wl,-rpath /usr/lib"|g' \ 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec="-Wl,-rpath /usr/lib"|g' \
@ -559,7 +579,7 @@ libtool_fixup_la_files()
[ "$pkgname" = "libtool" ] && return 0 [ "$pkgname" = "libtool" ] && 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.
[ "$XBPS_MASTERDIR" = "/" ] && return 0 [ -n "$in_chroot" ] && return 0
[ ! -f "$wrksrc/libtool" -o ! -f "$wrksrc/ltmain.sh" ] && return 0 [ ! -f "$wrksrc/libtool" -o ! -f "$wrksrc/ltmain.sh" ] && return 0
@ -574,7 +594,7 @@ libtool_fixup_la_files()
for f in $(find $where -type f -name \*.la*); do for f in $(find $where -type f -name \*.la*); do
if [ -f $f ]; then if [ -f $f ]; then
echo "=> 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|$XBPS_DESTDIR/$pkgname-$version||g" $f
@ -586,7 +606,7 @@ libtool_fixup_la_files()
set_build_vars() set_build_vars()
{ {
[ "$XBPS_MASTERDIR" = "/" ] && return 0 [ -n "$in_chroot" ] && return 0
LDFLAGS="-L$XBPS_MASTERDIR/usr/lib" LDFLAGS="-L$XBPS_MASTERDIR/usr/lib"
SAVE_LDLIBPATH=$LD_LIBRARY_PATH SAVE_LDLIBPATH=$LD_LIBRARY_PATH
@ -606,7 +626,7 @@ set_build_vars()
unset_build_vars() unset_build_vars()
{ {
[ "$XBPS_MASTERDIR" = "/" ] && return 0 [ -n "$in_chroot" ] && return 0
unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG LD_LIBRARY_PATH unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SAVE_LDLIBPATH export LD_LIBRARY_PATH=$SAVE_LDLIBPATH
@ -636,7 +656,7 @@ apply_tmpl_patches()
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
echo "*** WARNING: unexistent patch: $i ***" msg_warn "unexistent patch: $i"
continue continue
fi fi
@ -652,15 +672,15 @@ apply_tmpl_patches()
elif $(echo $patch|$grep_cmd -q .diff); then elif $(echo $patch|$grep_cmd -q .diff); then
patch=$i patch=$i
else else
echo "*** WARNING: unknown patch type: $i ***" msg_warn "unknown patch type: $i"
continue continue
fi fi
cd $wrksrc && patch -p0 < $patch 2>/dev/null cd $wrksrc && patch -p0 < $patch 2>/dev/null
if [ "$?" -eq 0 ]; then if [ "$?" -eq 0 ]; then
echo "=> Patch applied: $i." msg_normal "Patch applied: $i."
else else
echo "*** ERROR: couldn't apply patch: $i." msg_error "couldn't apply patch: $i."
exit 1 exit 1
fi fi
done done
@ -688,7 +708,7 @@ configure_src_phase()
"$build_style" = "only-install" ] && return 0 "$build_style" = "only-install" ] && return 0
if [ ! -d $wrksrc ]; then if [ ! -d $wrksrc ]; then
echo "*** ERROR: unexistent build directory $wrksrc ***" msg_error "unexistent build directory $wrksrc"
exit 1 exit 1
fi fi
@ -703,7 +723,7 @@ configure_src_phase()
export "$f" export "$f"
done done
echo "=> Running configure phase for $pkgname-$version." msg_normal "Running configure phase for $pkgname-$version."
set_build_vars set_build_vars
@ -755,12 +775,12 @@ configure_src_phase()
# Unknown build_style type won't work :-) # Unknown build_style type won't work :-)
# #
else else
echo "*** ERROR unknown build_style: $build_style ***" msg_error "unknown build_style: $build_style"
exit 1 exit 1
fi fi
if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then
echo "*** ERROR building (configure state) $pkg ***" msg_error "building (configure state) $pkg"
exit 1 exit 1
fi fi
@ -794,7 +814,7 @@ build_src_phase()
"$build_style" = "only-install" ] && return 0 "$build_style" = "only-install" ] && return 0
if [ ! -d $wrksrc ]; then if [ ! -d $wrksrc ]; then
echo "*** ERROR: unexistent build directory: $wrksrc ***" msg_error "unexistent build directory: $wrksrc"
exit 1 exit 1
fi fi
@ -823,14 +843,14 @@ build_src_phase()
libtool_fixup_file libtool_fixup_file
set_build_vars set_build_vars
echo "=> Running build phase for $pkg." msg_normal "Running build phase for $pkg."
# #
# Build package via make. # Build package via make.
# #
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} ${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "*** ERROR building (make stage) $pkg ***" msg_error "building (make stage) $pkg"
exit 1 exit 1
fi fi
@ -875,13 +895,13 @@ install_src_phase()
[ "$build_style" = "meta-template" ] && return 0 [ "$build_style" = "meta-template" ] && return 0
if [ ! -d $wrksrc ]; then if [ ! -d $wrksrc ]; then
echo "*** ERROR: unexistent build directory: $wrksrc ***" msg_error "unexistent build directory: $wrksrc"
exit 1 exit 1
fi fi
cd $wrksrc || exit 1 cd $wrksrc || exit 1
echo "=> Running install phase for: $pkgname-$version." msg_normal "Running install phase for: $pkgname-$version."
set_build_vars set_build_vars
# #
@ -889,7 +909,7 @@ install_src_phase()
# #
${make_cmd} ${make_install_target} ${make_install_args} ${make_cmd} ${make_install_target} ${make_install_args}
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "*** ERROR installing $pkgname-$version ***" msg_error "installing $pkgname-$version"
exit 1 exit 1
fi fi
@ -910,7 +930,7 @@ install_src_phase()
# Unset build vars. # Unset build vars.
unset_build_vars unset_build_vars
echo "==> Installed $pkgname-$version into $XBPS_DESTDIR." msg_normal "Installed $pkgname-$version into $XBPS_DESTDIR."
touch -f $XBPS_INSTALL_DONE touch -f $XBPS_INSTALL_DONE
@ -920,7 +940,7 @@ install_src_phase()
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
rm -rf $wrksrc rm -rf $wrksrc
[ "$?" -eq 0 ] && \ [ "$?" -eq 0 ] && \
echo "=> Removed $pkgname-$version build directory." msg_normal "Removed $pkgname-$version build directory."
fi fi
cd $XBPS_BUILDDIR cd $XBPS_BUILDDIR
@ -1183,7 +1203,7 @@ install_pkg()
local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn.tmpl" local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn.tmpl"
if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then
echo "*** ERROR: cannot find $cur_tmpl template file ***" msg_error "cannot find $cur_tmpl template file"
exit 1 exit 1
fi fi
@ -1250,7 +1270,7 @@ install_pkg()
if [ "$build_style" = "meta-template" ]; then if [ "$build_style" = "meta-template" ]; then
register_pkg_handler register $pkgname $version register_pkg_handler register $pkgname $version
[ $? -eq 0 ] && \ [ $? -eq 0 ] && \
echo "==> Installed meta-template: $pkg." && \ msg_normal "Installed meta-template: $pkg." && \
return 0 return 0
return 1 return 1
fi fi
@ -1476,9 +1496,19 @@ build)
fi fi
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
configure_src_phase $2 if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
run_file $XBPS_TMPLHELPDIR/chroot.sh
configure_chroot_pkg $2
else
configure_src_phase $2
fi
fi
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
run_file $XBPS_TMPLHELPDIR/chroot.sh
build_chroot_pkg $2
else
build_src_phase $2
fi fi
build_src_phase $2
;; ;;
chroot) chroot)
run_file $XBPS_TMPLHELPDIR/chroot.sh run_file $XBPS_TMPLHELPDIR/chroot.sh
@ -1490,7 +1520,12 @@ configure)
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
extract_distfiles $2 extract_distfiles $2
fi fi
configure_src_phase $2 if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
run_file $XBPS_TMPLHELPDIR/chroot.sh
configure_chroot_pkg $2
else
configure_src_phase $2
fi
;; ;;
extract) extract)
setup_tmpl $2 setup_tmpl $2
@ -1505,17 +1540,22 @@ info)
setup_tmpl $2 setup_tmpl $2
info_tmpl $2 info_tmpl $2
;; ;;
install-chroot)
setup_tmpl $2
run_file $XBPS_TMPLHELPDIR/chroot.sh
install_chroot_pkg $2
;;
install-destdir) install-destdir)
install_destdir_target=yes install_destdir_target=yes
install_pkg $2 if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
run_file $XBPS_TMPLHELPDIR/chroot.sh
install_chroot_pkg $2
else
install_pkg $2
fi
;; ;;
install) install)
install_pkg $2 if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
run_file $XBPS_TMPLHELPDIR/chroot.sh
install_chroot_pkg $2
else
install_pkg $2
fi
;; ;;
list) list)
list_pkgs list_pkgs