Multiple changes to xbps-src and shutils:

* Added XBPS_FETCH_CMD to xbps-src.conf, this will be used to fetch
  distfiles. Please note that it will be copied to the chroot, so
  it should be statically linked or with only libc required.

* Removed libtool_func.sh and associated vars, it's unneeded currently.

* Added keep_empty_dirs, keep_libtool_archives and nostrip. By default
  all empty dirs and libtool archives are removed, and executables and
  libraries stripped, respectively. One can use set the var in a build
  template to change the behaviour.

* Explain in README what are the requirements to build XBPS.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091017005836-uifiof32ndy0wmd8
This commit is contained in:
Juan RP 2009-10-17 02:58:36 +02:00
parent f7689695d1
commit 4ef0fbcada
10 changed files with 77 additions and 125 deletions

View File

@ -29,7 +29,6 @@ trap "echo && exit 1" INT QUIT
: ${progname:=$(basename $0)} : ${progname:=$(basename $0)}
: ${fakeroot_cmd:=fakeroot} : ${fakeroot_cmd:=fakeroot}
: ${fetch_cmd:=wget}
: ${xbps_machine:=$(uname -m)} : ${xbps_machine:=$(uname -m)}
usage() usage()
@ -118,8 +117,7 @@ set_defvars()
# #
check_config_vars() check_config_vars()
{ {
local cffound= local cffound f
local f=
if [ -z "$config_file_specified" ]; then if [ -z "$config_file_specified" ]; then
config_file_paths="$XBPS_CONFIG_FILE ./etc/xbps-src.conf" config_file_paths="$XBPS_CONFIG_FILE ./etc/xbps-src.conf"

View File

@ -26,6 +26,15 @@ http://code.google.com/p/portableproplib/
I'm also the human maintaining the portable proplib package. I'd suggest you I'm also the human maintaining the portable proplib package. I'd suggest you
to install it into /usr/local to avoid issues with your distribution packages. to install it into /usr/local to avoid issues with your distribution packages.
To build the xbps utils, you'll need:
* acl (devel pkg with static lib)
* zlib (devel pkg with static lib)
* bzip2 (devel pkg with static lib)
* xz (devel pkg with static lib)
* libarchive (devel pkg with static lib, all features built in)
* proplib (deve pkg with static lib, see above)
Additionally the following software is required in the host system to build Additionally the following software is required in the host system to build
and install xbps binary packages: and install xbps binary packages:
@ -33,12 +42,7 @@ and install xbps binary packages:
* GNU Make * GNU Make
* GNU Bison * GNU Bison
* fakeroot * fakeroot
* wget OR curl OR fetch * wget OR curl OR fetch (statically linked or no additional deps)
* libarchive (devel package with static library.
acl, lzma, bzip2 support)
* libacl (devel package with static library)
* lzma/xz (devel package with static library)
* bzip2 (devel package with static library)
* perl * perl
* sudo * sudo

View File

@ -52,6 +52,11 @@ XBPS_CXXFLAGS="$XBPS_CFLAGS"
# #
#XBPS_MAKEJOBS=4 #XBPS_MAKEJOBS=4
#
# Fetch command to download files.
#
XBPS_FETCH_CMD=wget
# #
# Cross compilation stuff. # Cross compilation stuff.
# #

View File

@ -1,5 +1,5 @@
#- #-
# Copyright (c) 2008 Juan Romero Pardines. # Copyright (c) 2008-2009 Juan Romero Pardines.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -63,11 +63,6 @@ build_src_phase()
[ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \ [ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \
makejobs="-j$XBPS_MAKEJOBS" makejobs="-j$XBPS_MAKEJOBS"
if [ -z "$in_chroot" ]; then
. $XBPS_SHUTILSDIR/libtool_funcs.sh
libtool_fixup_file
fi
. $XBPS_SHUTILSDIR/buildvars_funcs.sh . $XBPS_SHUTILSDIR/buildvars_funcs.sh
set_build_vars set_build_vars
@ -84,13 +79,6 @@ build_src_phase()
unset makejobs unset makejobs
if [ -z "$in_chroot" ]; then
if [ -z "$libtool_fixup_la_stage" \
-o "$libtool_fixup_la_stage" = "postbuild" ]; then
libtool_fixup_la_files
fi
fi
# unset cross compiler vars. # unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars [ -n "$cross_compiler" ] && cross_compile_unsetvars
unset_build_vars unset_build_vars

View File

@ -1,5 +1,5 @@
#- #-
# Copyright (c) 2008 Juan Romero Pardines. # Copyright (c) 2008-2009 Juan Romero Pardines.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -106,7 +106,7 @@ rebuild_ldso_cache()
install_xbps_utils() install_xbps_utils()
{ {
local needed= local needed fetch_cmd
local xbps_prefix=$XBPS_MASTERDIR/usr/local local xbps_prefix=$XBPS_MASTERDIR/usr/local
for f in bin cmpver digest pkgdb; do for f in bin cmpver digest pkgdb; do
@ -117,13 +117,20 @@ install_xbps_utils()
if [ -n "$needed" ]; then if [ -n "$needed" ]; then
cd ${XBPS_MASTERDIR}/bin && ln -s dash sh cd ${XBPS_MASTERDIR}/bin && ln -s dash sh
echo "=> Building and installing xbps utils." echo "=> Installing the required XBPS utils."
chroot $XBPS_MASTERDIR sh -c \ chroot $XBPS_MASTERDIR sh -c \
"echo /usr/local/lib > /etc/ld.so.conf" "echo /usr/local/lib > /etc/ld.so.conf"
for f in bin src cmpver digest pkgdb repo; do fetch_cmd="$(which $XBPS_FETCH_CMD 2>/dev/null)"
cp -f $XBPS_INSTALLDIR/sbin/xbps-$f $xbps_prefix/sbin if [ -z "$fetch_cmd" ]; then
echo "Unexistent XBPS_FETCH_CMD specified!"
exit 1
fi
cp -f $fetch_cmd $xbps_prefix/sbin
for f in bin cmpver digest pkgdb repo; do
cp -f $XBPS_INSTALLDIR/sbin/xbps-$f.static \
$xbps_prefix/sbin/xbps-$f
done done
cp -a $XBPS_INSTALLDIR/lib/libxbps.so* $xbps_prefix/lib cp -f $XBPS_INSTALLDIR/sbin/xbps-src $xbps_prefix/sbin
if [ -z $XBPS_INSTALLDIR ]; then if [ -z $XBPS_INSTALLDIR ]; then
installdir=/usr/share/xbps installdir=/usr/share/xbps
else else
@ -192,7 +199,7 @@ mount_chroot_fs()
;; ;;
*) blah=/$f;; *) blah=/$f;;
esac esac
[ ! -d $blah ] && continue [ ! -d $blah ] && echo "failed." && continue
mount --bind $blah $XBPS_MASTERDIR/$f mount --bind $blah $XBPS_MASTERDIR/$f
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo 1 > $XBPS_MASTERDIR/.${f}_mount_bind_done echo 1 > $XBPS_MASTERDIR/.${f}_mount_bind_done
@ -281,6 +288,7 @@ echo "XBPS_BUILDDIR=/xbps_builddir" >> $XBPSSRC_CF
echo "XBPS_SRCDISTDIR=/xbps_srcdistdir" >> $XBPSSRC_CF echo "XBPS_SRCDISTDIR=/xbps_srcdistdir" >> $XBPSSRC_CF
echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPSSRC_CF echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPSSRC_CF
echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPSSRC_CF echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPSSRC_CF
echo "XBPS_FETCH_CMD=$XBPS_FETCH_CMD" >> $XBPSSRC_CF
if [ -n "$XBPS_MAKEJOBS" ]; then if [ -n "$XBPS_MAKEJOBS" ]; then
echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPSSRC_CF echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPSSRC_CF
fi fi

View File

@ -120,7 +120,7 @@ fetch_distfiles()
localurl="$url/$curfile" localurl="$url/$curfile"
fi fi
$fetch_cmd $localurl $XBPS_FETCH_CMD $localurl
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
unset localurl unset localurl
if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then

View File

@ -27,6 +27,27 @@
# Runs the "install" phase for a pkg. This consists in installing package # Runs the "install" phase for a pkg. This consists in installing package
# into the destination directory. # into the destination directory.
# #
strip_files()
{
if [ ! -x /usr/bin/strip ]; then
return 0
fi
[ -n "$nostrip" ] && return 0
msg_normal "Finding binaries/libraries to strip..."
for f in $(find ${DESTDIR} -type f); do
case "$(file -biz $f)" in
application/x-executable*)
/usr/bin/strip $f && \
echo "===> Stripped executable: $(basename $f)";;
application/x-sharedlib*|application/x-archive*)
/usr/bin/strip -S $f && \
echo "===> Stripped library: $(basename $f)";;
esac
done
}
install_src_phase() install_src_phase()
{ {
local pkg="$1" local pkg="$1"
@ -71,8 +92,8 @@ install_src_phase()
# Run post_install func. # Run post_install func.
run_func post_install || msg_error "post_install stage failed!" run_func post_install || msg_error "post_install stage failed!"
# Remove libtool archives. # Remove libtool archives by default.
if [ -z "$libtool_no_delete_archives" ]; then if [ -z "$keep_libtool_archives" ]; then
find ${DESTDIR} -type f -name \*.la -delete find ${DESTDIR} -type f -name \*.la -delete
fi fi
# Always remove perllocal.pod and .packlist files. # Always remove perllocal.pod and .packlist files.
@ -80,6 +101,12 @@ install_src_phase()
find ${DESTDIR} -type f -name perllocal.pod -delete find ${DESTDIR} -type f -name perllocal.pod -delete
find ${DESTDIR} -type f -name .packlist -delete find ${DESTDIR} -type f -name .packlist -delete
fi fi
# Remove empty directories by default.
if [ -z "$keep_empty_dirs" ]; then
find ${DESTDIR} -depth -type d -empty -delete
fi
# Strip bins/libs.
strip_files
# unset cross compiler vars. # unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars [ -n "$cross_compiler" ] && cross_compile_unsetvars
@ -152,14 +179,6 @@ make_install()
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args} run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args}
[ $? -ne 0 ] && msg_error "installing $pkgname-$lver." [ $? -ne 0 ] && msg_error "installing $pkgname-$lver."
# Replace libtool archives if requested.
if [ -z "$in_chroot" ]; then
if [ "$libtool_fixup_la_stage" = "postinstall" ]; then
. $XBPS_SHUTILSDIR/libtool_funcs.sh
libtool_fixup_la_files postinstall
fi
fi
# Unset build vars. # Unset build vars.
unset_build_vars unset_build_vars
} }

View File

@ -1,71 +0,0 @@
#-
# Copyright (c) 2008 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
#
# Functions to fixup libtool archives while building packages
# required by xbps-base-chroot, not within the chroot.
#
libtool_fixup_file()
{
local hldirf="hardcode_libdir_flag_spec"
[ "$pkgname" = "libtool" -o ! -f $wrksrc/libtool ] && return 0
[ -n "$no_libtool_fixup" ] && return 0
sed -i -e "s|^$hldirf=.*|$hldirf=\"-Wl,-rpath /usr/lib\"|g" \
$wrksrc/libtool
}
libtool_fixup_la_files()
{
local f=
local postinstall="$1"
local where=
# Ignore libtool itself
[ "$pkgname" = "libtool" ] && return 0
[ ! -f "$wrksrc/libtool" -o ! -f "$wrksrc/ltmain.sh" ] && return 0
#
# Replace hardcoded or incorrect paths with correct ones.
#
if [ -z "$postinstall" ]; then
where="$wrksrc"
else
where="$XBPS_DESTDIR/$pkgname-$version"
fi
for f in $(find $where -type f -name \*.la*); do
if [ -f $f ]; then
msg_normal "Fixing up libtool archive: ${f##$where/}."
sed -i -e "s|\/..\/lib||g;s|\/\/lib|/usr/lib|g" \
-e "s|$XBPS_MASTERDIR||g;s|$wrksrc||g" \
-e "s|$where||g" $f
awk '{ if (/^ dependency_libs/) {gsub("/usr[^]*lib","lib");}print}' \
$f > $f.in && mv $f.in $f
fi
done
}

View File

@ -54,11 +54,11 @@ xbps_write_metadata_pkg()
check_installed_pkg ${spkgrev} check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue [ $? -eq 0 ] && continue
if [ ! -f $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template ]; then if [ ! -f $XBPS_TEMPLATESDIR/$sourcepkg/$subpkg.template ]; then
msg_error "Cannot find subpackage template!" msg_error "Cannot find subpackage template!"
fi fi
unset run_depends conf_files noarch triggers \ unset run_depends conf_files noarch triggers \
revision openrc_services essential revision openrc_services essential keep_empty_dirs
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template . $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg} pkgname=${sourcepkg}-${subpkg}
set_tmpl_common_vars set_tmpl_common_vars
@ -70,11 +70,11 @@ xbps_write_metadata_pkg()
[ -n "${subpackages}" ] && [ "$pkg" != "${sourcepkg}" ] && return $? [ -n "${subpackages}" ] && [ "$pkg" != "${sourcepkg}" ] && return $?
if [ "$build_style" = "meta-template" -a -z "${run_depends}" ]; then if [ "$build_style" = "meta-template" -a -z "${run_depends}" ]; then
for subpkg in ${subpackages}; do for spkg in ${subpackages}; do
if [ -n "${revision}" ]; then if [ -n "${revision}" ]; then
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}" spkgrev="$sourcepkg-$spkg-${version}_$revision"
else else
spkgrev="${sourcepkg}-${subpkg}-${version}" spkgrev="${sourcepkg}-${spkg}-${version}"
fi fi
run_depends="${run_depends} ${spkgrev}" run_depends="${run_depends} ${spkgrev}"
done done
@ -148,7 +148,7 @@ xbps_write_metadata_pkg_real()
ln -s ${lnkat}.gz ${newlnk}.gz ln -s ${lnkat}.gz ${newlnk}.gz
continue continue
fi fi
echo "=> Compressing info file: $j..." echo "===> Compressing info file: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/$j
done done
fi fi
@ -173,7 +173,7 @@ xbps_write_metadata_pkg_real()
ln -s ${lnkat}.gz ${newlnk}.gz ln -s ${lnkat}.gz ${newlnk}.gz
continue continue
fi fi
echo "=> Compressing manpage: $j..." echo "===> Compressing manpage: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/$j
done done
fi fi

View File

@ -66,18 +66,16 @@ reset_tmpl_vars()
local TMPL_VARS="pkgname distfiles configure_args configure_env \ local TMPL_VARS="pkgname distfiles configure_args configure_env \
make_build_args make_install_args build_style \ make_build_args make_install_args build_style \
short_desc maintainer long_desc checksum wrksrc \ short_desc maintainer long_desc checksum wrksrc \
make_cmd base_chroot register_shell \ make_cmd base_chroot register_shell keep_empty_dirs \
make_build_target configure_script noextract nofetch \ make_build_target configure_script noextract nofetch \
pre_configure pre_build pre_install \ pre_configure pre_build pre_install build_depends \
post_configure post_build post_install \ post_configure post_build post_install nostrip \
make_install_target version revision essential \ make_install_target version revision essential \
sgml_catalogs xml_catalogs xml_entries sgml_entries \ sgml_catalogs xml_catalogs xml_entries sgml_entries \
build_depends libtool_fixup_la_stage no_fixup_libtool \
disable_parallel_build run_depends cross_compiler \ disable_parallel_build run_depends cross_compiler \
only_for_archs conf_files \ only_for_archs conf_files keep_libtool_archives \
noarch subpackages sourcepkg gtk_iconcache_dirs \ noarch subpackages sourcepkg gtk_iconcache_dirs \
abi_depends api_depends triggers openrc_services \ abi_depends api_depends triggers openrc_services \
libtool_no_delete_archives \
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \ XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \ XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
SRCPKGDESTDIR PATCHESDIR" SRCPKGDESTDIR PATCHESDIR"
@ -165,7 +163,10 @@ prepare_tmpl()
# #
# There's nothing of interest if we are a meta template. # There's nothing of interest if we are a meta template.
# #
[ "$build_style" = "meta-template" ] && return 0 if [ "$build_style" = "meta-template" ]; then
set_tmpl_common_vars
return 0
fi
REQ_VARS="pkgname version build_style short_desc long_desc" REQ_VARS="pkgname version build_style short_desc long_desc"