Reorganize the tree for easier and better handling.

- Template helpers have been moved to templates/helpers.
- Documentation to docs/.
- Common scripts have been moved to utils/sh.
- Fixed install-destdir when executed via chroot.
- Added a build-pkg target that builds a binary package.
  The package must be installed into destdir before using.
- Misc tweaks and fixes.

--HG--
extra : convert_revision : 0896e8f24bb7592116aaf77ae9c776033818a3d8
This commit is contained in:
Juan RP
2008-12-13 03:01:24 +01:00
parent 8373117030
commit 23fa45a18b
20 changed files with 65 additions and 79 deletions

View File

@@ -1,18 +0,0 @@
#
# This helper runs the GNU autoconf tools and friends for a template.
# Optionally $automake_dir may be specified for a specific directory.
#
run_automake()
{
$XBPS_MASTERDIR/bin/aclocal
$XBPS_MASTERDIR/bin/libtoolize --automake
$XBPS_MASTERDIR/bin/automake -a --foreign -i
$XBPS_MASTERDIR/bin/autoconf
}
if [ -z "$automake_dir" ]; then
cd $wrksrc && run_automake
else
cd $wrksrc/$automake_dir && run_automake
fi

View File

@@ -1,158 +0,0 @@
#
# Helper to install packages into a sandbox in masterdir.
# Actually this needs the xbps-base-chroot package installed.
#
# Umount stuff if SIGINT or SIGQUIT was caught
trap umount_chroot_fs INT QUIT
[ -n "$base_chroot" ] && return 0
check_installed_pkg xbps-base-chroot 0.1
[ $? -ne 0 ] && msg_error "xbps-base-chroot pkg not installed."
if [ "$(id -u)" -ne 0 ]; then
if [ -n "$origin_tmpl" ]; then
reset_tmpl_vars
run_file $XBPS_TEMPLATESDIR/$origin_tmpl.tmpl
fi
if [ -z "$base_chroot" ]; then
msg_error "this package must be built inside of the chroot."
else
msg_error "you must be root to use this target."
fi
fi
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
echo -n "==> Preparing chroot on $XBPS_MASTERDIR... "
cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts \
/etc/resolv.conf $XBPS_MASTERDIR/etc
touch $XBPS_MASTERDIR/.xbps_perms_done
echo "done."
else
msg_normal "Entering into the chroot on $XBPS_MASTERDIR."
fi
EXTDIRS="xbps xbps_builddir xbps_destdir xbps_srcdistdir xbps_crossdir"
REQDIRS="bin sbin tmp var sys proc dev ${EXTDIRS}"
for f in ${REQDIRS}; do
[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
done
unset f REQDIRS
echo "XBPS_DISTRIBUTIONDIR=/xbps" > $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_MASTERDIR=/" >> $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_DESTDIR=/xbps_destdir" >> $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_BUILDDIR=/xbps_builddir" >> $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_SRCDISTDIR=/xbps_srcdistdir" >> $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPS_MASTERDIR/etc/xbps.conf
if [ -n "$XBPS_MAKEJOBS" ]; then
echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPS_MASTERDIR/etc/xbps.conf
fi
if [ -n "$XBPS_CROSS_TARGET" -a -d "$XBPS_CROSS_DIR" ]; then
echo "XBPS_CROSS_TARGET=$XBPS_CROSS_TARGET" >> \
$XBPS_MASTERDIR/etc/xbps.conf
echo "XBPS_CROSS_DIR=/xbps_crossdir" >> $XBPS_MASTERDIR/etc/xbps.conf
fi
rebuild_ldso_cache()
{
echo -n "==> Rebuilding chroot's dynamic linker cache..."
chroot $XBPS_MASTERDIR /sbin/ldconfig -c /etc/ld.so.conf
chroot $XBPS_MASTERDIR /sbin/ldconfig -C /etc/ld.so.cache
echo " done."
}
chroot_pkg_handler()
{
local action="$1"
local pkg="$2"
[ -z "$action" -o -z "$pkg" ] && return 1
[ "$action" != "configure" -a "$action" != "build" -a \
"$action" != "install" -a "$action" != "chroot" ] && return 1
rebuild_ldso_cache
mount_chroot_fs
if [ "$action" = "chroot" ]; then
env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash
else
env in_chroot=yes chroot $XBPS_MASTERDIR \
/xbps/xbps.sh $action $pkg
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
umount_chroot_fs
}
mount_chroot_fs()
{
local cnt=
REQFS="sys proc dev xbps xbps_builddir xbps_destdir xbps_srcdistdir"
if [ -d "$XBPS_CROSS_DIR" ]; then
local cross=yes
REQFS="$REQFS xbps_crossdir"
fi
for f in ${REQFS}; do
if [ ! -f $XBPS_MASTERDIR/.${f}_mount_bind_done ]; then
echo -n "=> Mounting $f in chroot... "
local blah=
case $f in
xbps) blah=$XBPS_DISTRIBUTIONDIR;;
xbps_builddir) blah=$XBPS_BUILDDIR;;
xbps_destdir) blah=$XBPS_DESTDIR;;
xbps_srcdistdir) blah=$XBPS_SRCDISTDIR;;
xbps_crossdir)
[ -n $cross ] && blah=$XBPS_CROSS_DIR
;;
*) blah=/$f;;
esac
mount --bind $blah $XBPS_MASTERDIR/$f
if [ $? -eq 0 ]; then
echo 1 > $XBPS_MASTERDIR/.${f}_mount_bind_done
echo "done."
else
echo "failed."
fi
else
cnt=$(cat $XBPS_MASTERDIR/.${f}_mount_bind_done)
cnt=$(($cnt + 1))
echo $cnt > $XBPS_MASTERDIR/.${f}_mount_bind_done
fi
done
unset f
}
umount_chroot_fs()
{
local fs=
local dir=
local cnt=
for fs in ${REQFS}; do
[ ! -f $XBPS_MASTERDIR/.${fs}_mount_bind_done ] && continue
cnt=$(cat $XBPS_MASTERDIR/.${fs}_mount_bind_done)
if [ $cnt -gt 1 ]; then
cnt=$(($cnt - 1))
echo $cnt > $XBPS_MASTERDIR/.${fs}_mount_bind_done
else
echo -n "=> Unmounting $fs from chroot... "
umount -f $XBPS_MASTERDIR/$fs
if [ $? -eq 0 ]; then
rm -f $XBPS_MASTERDIR/.${fs}_mount_bind_done
echo "done."
else
echo "failed."
fi
fi
unset fs
done
for dir in ${EXTDIRS}; do
[ -f $XBPS_MASTERDIR/.${dir}_mount_bind_done ] && continue
[ -d $XBPS_MASTERDIR/$dir ] && rmdir $XBPS_MASTERDIR/$dir
done
}

View File

@@ -1,45 +0,0 @@
#
# This helper sets some required vars to be able to cross build
# packages on xbps. The target is specified in the configuration file
# and will be read any time the cross compilation flag is used.
#
[ -z "$XBPS_CROSS_TARGET" -o ! -d $XBPS_CROSS_DIR/bin ] && return 1
# Check if all required bins are there.
for bin in gcc g++ cpp ar as ranlib ld strip; do
if [ ! -x $XBPS_CROSS_DIR/bin/$XBPS_CROSS_TARGET-${bin} ]; then
msg_error "cross-compilation: cannot find ${bin}, aborting."
fi
done
SAVE_PATH="$PATH"
if [ "$xbps_machine" = "x86_64" ]; then
XBPS_CROSS_HOST="x86_64-unknown-linux-gnu"
else
XBPS_CROSS_HOST="$xbps_machine-pc-linux-gnu"
fi
cross_compile_setvars()
{
export GCC=$XBPS_CROSS_TARGET-gcc
export CC=$XBPS_CROSS_TARGET-gcc
export CXX=$XBPS_CROSS_TARGET-g++
export CPP=$XBPS_CROSS_TARGET-cpp
export AR=$XBPS_CROSS_TARGET-ar
export AS=$XBPS_CROSS_TARGET-as
export RANLIB=$XBPS_CROSS_TARGET-ranlib
export LD=$XBPS_CROSS_TARGET-ld
export STRIP=$XBPS_CROSS_TARGET-strip
export PATH="$XBPS_CROSS_DIR/bin:$PATH"
}
cross_compile_unsetvars()
{
unset GCC CC CXX CPP AR AS RANLIB LD STRIP PATH
export PATH="$SAVE_PATH"
}
if [ "$build_style" = "gnu_configure" ]; then
configure_args="--build=$XBPS_CROSS_HOST --host=$XBPS_CROSS_TARGET"
configure_args="$configure_args --target=$XBPS_CROSS_TARGET"
fi

View File

@@ -1,9 +0,0 @@
#
# This helpers runs fc-cache after fontconfig has been installed,
# and update its list of fonts.
#
if [ -x $XBPS_MASTERDIR/bin/fc-cache ]; then
$XBPS_MASTERDIR/bin/fc-cache -f
[ "$?" -eq 0 ] && echo "=> Updated fontconfig fonts cache."
fi

View File

@@ -1,17 +0,0 @@
#
# This helper updates GTK's gdk-pixbug.loaders modules file every time
# a template requests this process.
#
gtk_version="2.0"
gdk_pixbuf_query_cmd=$XBPS_MASTERDIR/bin/gdk-pixbuf-query-loaders
gdk_pixbuf_db=$XBPS_SYSCONFDIR/gtk-$gtk_version/gdk-pixbuf.loaders
if [ -x $gdk_pixbuf_query_cmd -a -w $gdk_pixbuf_db ]; then
$gdk_pixbuf_query_cmd > $gdk_pixbuf_db
[ "$?" -eq 0 ] && \
echo "=> Updated GTK+ $(basename $gdk_pixbuf_db) modules file."
fi
unset gtk_version
unset gdk_pixbuf_query_cmd
unset gdk_pixbuf_dbfile

View File

@@ -1,14 +0,0 @@
#
# This helper updates the GTK's theme icon cache as requested by
# any template.
#
gtkupdate_iconcache_cmd=$XBPS_MASTERDIR/bin/gtk-update-icon-cache
iconcache_theme_dir=$XBPS_MASTERDIR/share/icons/hicolor
if [ -x $gtkupdate_iconcache_cmd -a -d $iconcache_theme_dir ]; then
$gtkupdate_iconcache_cmd -f -t $iconcache_theme_dir && \
echo "=> Updated GTK's hicolor icon cache theme."
fi
unset gtkupdate_iconcache_cmd iconcache_theme_dir

View File

@@ -1,17 +0,0 @@
#
# This helper updates GTK's gtk.immodules modules file every time
# a template requests this process.
#
gtk_version="2.0"
gtk_query_immodules_cmd=$XBPS_MASTERDIR/bin/gtk-query-immodules-$gtk_version
gtk_immodules_db=$XBPS_SYSCONFDIR/gtk-$gtk_version/gtk.immodules
if [ -x $gtk_query_immodules_cmd -a -w $gtk_immodules_db ]; then
$gtk_query_immodules_cmd > $gtk_immodules_db
[ "$?" -eq 0 ] && \
echo "=> Updated GTK+ $(basename $gtk_immodules_db) modules file."
fi
unset gtk_version
unset gtk_query_immodules_cmd
unset gtk_immodules_db

View File

@@ -1,25 +0,0 @@
#
# This helper rebuilds the fonts.dir and fonts.scale files in a
# directory specified by a template.
#
[ -z "$fonts_dir" ] && return 1
[ ! -d "$fonts_dir" ] && $mkdir_cmd -p $fonts_dir
mkfontdir_cmd=$XBPS_MASTERDIR/bin/mkfontdir
mkfontscale_cmd=$XBPS_MASTERDIR/bin/mkfontscale
if [ -x $mkfontdir_cmd -a -x $mkfontscale_cmd ]; then
save_path=$(pwd -P 2>/dev/null)
cd $fonts_dir && $mkfontdir_cmd && $mkfontscale_cmd
if [ "$?" -eq 0 ]; then
echo "=> Updated $fonts_dir/fonts.dir."
echo "=> Updated $fonts_dir/fonts.scale."
fi
cd $save_path
unset save_path
fi
unset fonts_dir
unset mkfontdir_cmd
unset mkfontscale_cmd

View File

@@ -1,414 +0,0 @@
#!/bin/sh
#
# Script to be able to build a full cross toolchain for Linux/x86.
# This has been made thanks to various sources recollected from wikipedia
# and other cross compiling related pages.
# Setup some defaults
: ${GNU_URL_BASE:=http://ftp.gnu.org/gnu}
: ${KERNEL_URL_BASE:=http://www.kernel.org/pub/linux/kernel/v2.6}
: ${GCC_VER:=4.3.2}
: ${BINUTILS_VER:=2.19}
: ${GLIBC_VER:=2.7}
: ${KERNEL_VER:=2.6.27.3}
: ${CROSSDIR:=$HOME/mktoolchain}
: ${BUILDDIR:=$CROSSDIR/build}
: ${SOURCEDISTDIR:=$BUILDDIR/sources}
: ${FETCH_CMD:=wget}
usage()
{
echo "usage: $0 [-b dir] [-c dir] [-s dir] <target triplet>"
echo
echo "Optional flags:"
echo " -b Directory to be used for temporary building."
echo " -c Directory to be used for final cross tools."
echo " -s Directory where the sources are available."
exit 1
}
check_path()
{
local orig="$1"
case "$orig" in
/) ;;
/*) orig="${orig%/}" ;;
*) orig="$PWD/${orig%/}" ;;
esac
SANITIZED_DESTDIR=$orig
}
fetch_sources()
{
local pkg=
cd $SOURCEDISTDIR || exit 1
pkg=linux
if [ ! -f $pkg-$KERNEL_VER.tar.bz2 ]; then
echo "Fetching $pkg kernel-$KERNEL_VER sources..."
$FETCH_CMD $KERNEL_URL_BASE/$pkg-$KERNEL_VER.tar.bz2 || exit 1
fi
pkg=gcc
if [ ! -f $pkg-$GCC_VER.tar.bz2 ]; then
echo "Fetching $pkg-$GCC_VER..."
$FETCH_CMD $GNU_URL_BASE/$pkg/$pkg-$GCC_VER/$pkg-$GCC_VER.tar.bz2 || exit 1
fi
pkg=binutils
if [ ! -f $pkg-$BINUTILS_VER.tar.bz2 ]; then
echo "Fetching $pkg-$BINUTILS_VER..."
$FETCH_CMD $GNU_URL_BASE/$pkg/$pkg-$BINUTILS_VER.tar.bz2 \
|| exit 1
fi
pkg=glibc
if [ ! -f $pkg-$GLIBC_VER.tar.bz2 ]; then
echo "Fetching $pkg-$GLIBC_VER..."
$FETCH_CMD $GNU_URL_BASE/$pkg/$pkg-$GLIBC_VER.tar.bz2 || exit 1
fi
}
kernel_headers()
{
local pkg="linux-$KERNEL_VER"
cd $BUILDDIR || exit 1
tar xfj $SOURCEDISTDIR/$pkg.tar.bz2 -C $BUILDDIR || exit 1
cd $pkg || exit 1
make ARCH=$KERNEL_ARCH headers_check || exit 1
make ARCH=$KERNEL_ARCH headers_install \
INSTALL_HDR_PATH=$SYSROOT/usr || exit 1
cd $SYSROOT/usr/include && ln -s asm asm-$KERNEL_ARCH
cd $BUILDDIR && rm -rf $pkg || exit 1
touch -f $BUILDDIR/.kernel_headers_done
}
binutils()
{
local pkg="binutils-$BINUTILS_VER"
cd $BUILDDIR || exit 1
if [ ! -d $pkg ]; then
tar xfj $SOURCEDISTDIR/$pkg.tar.bz2 -C $BUILDDIR || exit 1
fi
cd $pkg || exit 1
[ ! -d build ] && mkdir build || exit 1
cd build || exit 1
../configure --prefix=$CROSSDIR \
--target=$CROSS_TARGET \
--with-sysroot=$SYSROOT \
--with-build-sysroot=$SYSROOT \
--disable-nls --enable-shared \
--disable-multilib || exit 1
make configure-host && make && make install || exit 1
# Remove unneeded stuff
for f in info man share; do
[ -d $CROSSDIR/$f ] && rm -rf $CROSSDIR/$f
done
cd $BUILDDIR && rm -rf $pkg || exit 1
touch -f $BUILDDIR/.binutils_done
}
glibc_patches()
{
# Apply some required patches for i[56]86-pc-linux-gnu and
# common targets.
$FETCH_CMD http://www.freesa.org/toolchain/patches/glibc-2.7-fixup_for_gcc43-1.patch
$FETCH_CMD http://www.freesa.org/toolchain/patches/glibc-2.7-i586_chk-1.patch
$FETCH_CMD http://www.freesa.org/toolchain/patches/glibc-2.7-libgcc_eh-1.patch
$FETCH_CMD http://svn.exactcode.de/t2/trunk/package/base/glibc/x86-fnstsw.patch
patch -Np1 -i glibc-2.7-fixup_for_gcc43-1.patch || exit 1
patch -Np1 -i glibc-2.7-i586_chk-1.patch || exit 1
patch -Np1 -i glibc-2.7-libgcc_eh-1.patch || exit 1
patch -Np1 -i x86-fnstsw.patch || exit 1
touch -f $BUILDDIR/glibc-$GLIBC_VER/.patches_done
}
gcc()
{
local stage="$1"
local pkg="gcc-$GCC_VER"
local configure_args=
local make_args=
local make_install_args=
local touch_f=
cd $BUILDDIR || exit 1
if [ ! -d $pkg ]; then
tar xfj $SOURCEDISTDIR/$pkg.tar.bz2 -C $BUILDDIR || exit 1
fi
[ ! -d $pkg/build ] && mkdir $pkg/build
cd $pkg/build || exit 1
case $stage in
full)
# gcc with support for C and C++.
touch_f=".gcc_full_done"
make_args="AS_FOR_TARGET=$CROSS_TARGET-as"
make_args="$make_args LD_FOR_TARGET=$CROSS_TARGET-ld"
make_install_args="install"
configure_args="--enable-shared --enable-threads=posix"
configure_args="$configure_args --enable-languages=c,c++"
configure_args="$configure_args --enable-__cxa_atexit"
configure_args="$configure_args --enable-tls"
;;
libgcc)
# Enough to be able to build full glibc.
make all-target-libgcc && make install-target-libgcc || exit 1
rm -rf $SYSROOT/lib/crt* || exit 1
touch -f $BUILDDIR/.gcc_libgcc_done
cd $BUILDDIR/$pkg && rm -rf build
return 0
;;
bootstrap)
# gcc bootstrap
touch_f=".gcc_bootstrap_done"
make_args="all-gcc"
make_install_args="install-gcc"
configure_args="--disable-shared --disable-libmudflap"
configure_args="$configure_args --disable-threads"
configure_args="$configure_args --disable-libssp"
configure_args="$configure_args --enable-languages=c"
;;
*) ;;
esac
../configure --prefix=$CROSSDIR \
--build=$CROSS_HOST --host=$CROSS_HOST \
--target=$CROSS_TARGET \
--with-sysroot=$SYSROOT \
--with-build-sysroot=$SYSROOT \
--disable-multilib \
${configure_args} || exit 1
env LDFLAGS_FOR_TARGET="--sysroot=$SYSROOT" \
CPPFLAGS_FOR_TARGET="--sysroot=$SYSROOT" \
make ${make_args} && make ${make_install_args} || exit 1
# Remove unneeded stuff
for f in info share man; do
[ -d $CROSSDIR/$f ] && rm -rf $CROSSDIR/$f
done
# Do not remove builddir if bootstrap, we want all objs for
# the libgcc pass.
if [ "$stage" != "bootstrap" ]; then
cd $BUILDDIR/$pkg && rm -rf build || exit 1
fi
touch -f $BUILDDIR/$touch_f
}
glibc()
{
local stage="$1"
local pkg="glibc-$GLIBC_VER"
local touch_f=
local cross_binutils="$CROSSDIR/$CROSS_TARGET/bin"
local configure_args=
local CC=
local BUILD_CC=
local RANLIB=
local AR=
cd $BUILDDIR || exit 1
if [ ! -d $pkg ]; then
tar xfj $SOURCEDISTDIR/$pkg.tar.bz2 -C $BUILDDIR || exit 1
fi
cd $pkg || exit 1
[ ! -f .patches_done ] && glibc_patches
[ ! -d build ] && mkdir build
cd build || exit 1
# NPTL support.
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
if [ "$KERNEL_ARCH" = "i386" ]; then
echo "CFLAGS+=-march=${CROSS_TARGET%%-*} -mtune=generic" \
> configparms
fi
case $stage in
startup|full)
BUILD_CC=$CROSS_TARGET-gcc
CC=$CROSS_TARGET-gcc
AR=$CROSS_TARGET-ar
RANLIB=$CROSS_TARGET-ranlib
configure_args="${configure_args} --with-binutils=$CROSSDIR/bin"
configure_args="${configure_args} --cache-file=config.cache"
;;
headers)
CC=gcc
configure_args="${configure_args} --with-binutils=$cross_binutils"
configure_args="${configure_args} --disable-sanity-checks"
;;
*) ;;
esac
CC=${CC} BUILD_CC=${BUILD_CC} AR=${AR} RANLIB=${RANLIB} \
../configure --prefix=/usr \
--host=$CROSS_TARGET --build=$CROSS_HOST \
--enable-kernel=2.6.25 --with-tls \
--with-__thread --without-selinux \
--without-gd --without-cvs --disable-profile \
--enable-add-ons \
--with-headers=$SYSROOT/usr/include \
${configure_args} || exit 1
case $stage in
startup)
touch_f=".glibc_startup_done"
make -r -C ../csu objdir=$PWD $PWD/csu/crt1.o || exit 1
make -r -C ../csu objdir=$PWD $PWD/csu/crti.o || exit 1
make -r -C ../csu objdir=$PWD $PWD/csu/crtn.o || exit 1
mkdir -p $SYSROOT/lib || exit 1
cp -f csu/crt1.o csu/crti.o csu/crtn.o $SYSROOT/lib || exit 1
;;
headers)
touch_f=".glibc_headers_done"
make cross-compiling=yes \
install_root=$SYSROOT install-headers || exit 1
cp -v bits/stdio_lim.h $SYSROOT/usr/include/bits || exit 1
touch $SYSROOT/usr/include/gnu/stubs.h || exit 1
cp -v ../nptl/sysdeps/pthread/pthread.h \
$SYSROOT/usr/include || exit 1
if [ "$KERNEL_ARCH" = "i386" ]; then
local bitsdir="nptl/sysdeps/unix/sysv/linux/i386/bits"
cp -v ../$bitsdir/pthreadtypes.h \
$SYSROOT/usr/include/bits || exit 1
fi
;;
full)
touch_f=".glibc_full_done"
make && make install_root=$SYSROOT install || exit 1
;;
esac
if [ "$stage" != "headers" ]; then
cd $BUILDDIR/$pkg && rm -rf build || exit 1
fi
touch -f $BUILDDIR/$touch_f
}
while getopts "b:c:s:" opt; do
case $opt in
b) BUILDDIR=$OPTARG
check_path $BUILDDIR
BUILDDIR=$SANITIZED_DESTDIR
;;
c) CROSSDIR=$OPTARG
check_path $CROSSDIR
CROSSDIR=$SANITIZED_DESTDIR
;;
s) SOURCEDISTDIR=$OPTARG
check_path $SOURCEDISTDIR
SOURCEDISTDIR=$SANITIZED_DESTDIR
;;
--) shift; break;;
esac
done
shift $(($OPTIND - 1))
[ $# -ne 1 ] && usage
if [ -z "$1" ]; then
echo "ERROR: missing target triplet."
exit 1
else
CROSS_TARGET=$1
case $CROSS_TARGET in
i686-pc-linux-gnu)
KERNEL_ARCH=i386
CROSS_HOST="$(uname -m)-unknown-linux-gnu"
;;
x86-64-unknown-linux-gnu)
KERNEL_ARCH=x86_64
CROSS_HOST="$(uname -m)-pc-linux-gnu"
;;
*)
echo "ERROR: unknown target triplet $CROSS_TARGET."
exit 1
;;
esac
fi
CROSSDIR=$CROSSDIR/$CROSS_TARGET
SYSROOT=$CROSSDIR/sysroot
[ ! -d $SYSROOT/usr ] && mkdir -p $SYSROOT/usr
[ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR
[ ! -d $SOURCEDISTDIR ] && mkdir -p $SOURCEDISTDIR
unset CFLAGS CXXFLAGS CC CXX AR AS RANLIB LD_STRIP
unset LD_LIBRARY_PATH LD_RUN_PATH
export PATH="$CROSSDIR/bin:/bin:/usr/bin"
fetch_sources
if [ ! -f $BUILDDIR/.kernel_headers_done ]; then
echo "Installing kernel headers..."
kernel_headers
fi
if [ ! -f $BUILDDIR/.binutils_done ]; then
echo "Installing binutils..."
binutils
fi
if [ ! -f $BUILDDIR/.glibc_headers_done ]; then
echo "Installing glibc headers..."
glibc headers
fi
if [ ! -f $BUILDDIR/.gcc_bootstrap_done ]; then
echo "Installing gcc (bootstrap)..."
gcc bootstrap
fi
if [ ! -f $BUILDDIR/.glibc_startup_done ]; then
echo "Installing glibc (startup)..."
glibc startup
fi
if [ ! -f $BUILDDIR/.gcc_libgcc_done ]; then
echo "Installing gcc (libgcc)..."
gcc libgcc
fi
if [ ! -f $BUILDDIR/.glibc_full_done ]; then
echo "Installing glibc (full)..."
glibc full
fi
if [ ! -f $BUILDDIR/.gcc_full_done ]; then
echo "Installing gcc (full)..."
gcc full
fi
[ -d $BUILDDIR ] && rm -rf $BUILDDIR
echo "Finished. Toolchain for $CROSS_TARGET at $CROSSDIR."
exit 0

View File

@@ -1,16 +0,0 @@
#
# This helper updates the pango modules file when the pango package
# has been properly installed and stowned.
#
pango_query_modules_cmd=$XBPS_MASTERDIR/bin/pango-querymodules
pango_query_modules_db=$XBPS_SYSCONFDIR/pango/pango.modules
if [ -x $pango_query_modules_cmd -a -w $pango_query_modules_db ]; then
$pango_query_modules_cmd > $pango_query_modules_db
[ "$?" -eq 0 ] && \
echo "=> Updated Pango's $pango_query_modules_db modules file."
fi
unset pango_query_modules_cmd
unset pango_query_modules_db

View File

@@ -1,93 +0,0 @@
#
# This helper does the required steps to be able to build and install
# perl modules into the correct location.
#
# Required vars to be set by a template:
#
# build_style=perl_module
#
# Optionally if the module needs more directories to be configured other
# than $XBPS_BUILDDIR/$wrksrc, one can use (relative to $wrksrc):
#
# perl_configure_dirs=blob/bob foo/blah
#
# Override the paths to get desired results.
: ${_arch:=$(uname -m)}
: ${perl_thrmulti:=${_arch}-netbsd-thread-multi}
: ${perl_cmd:=$XBPS_MASTERDIR/bin/perl}
: ${PERL_DESTDIR:=$XBPS_MASTERDIR}
: ${PERL_PREFIX:=$PERL_DESTDIR}
: ${PERL_DPREFIX:=$XBPS_DESTDIR/$pkgname-$version}
: ${PERL_VERSION:=5.10.0}
: ${PERL_LDDLFLAGS:=--whole-archive -shared -L$XBPS_MASTERDIR/lib}
: ${PERL_SITELIBEXP:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
: ${PERL_SITEARCHEXP:=$PERL_SITELIBEXP/$perl_thrmulti}
: ${PERL_SITEPREFIX:=$PERL_PREFIX}
: ${PERL_INSTALLPRIVLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION}
: ${PERL_INSTALLSITELIB:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
: ${PERL_INSTALLARCHLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
: ${PERL_INSTALLSITEARCH:=$PERL_SITELIBEXP}
: ${PERL_INSTALLBIN:=$PERL_DPREFIX/bin}
: ${PERL_INSTALLSITEBIN:=$PERL_INSTALLBIN}
: ${PERL_INSTALLSCRIPT:=$PERL_DPREFIX/bin}
: ${PERL_INSTALLSITESCRIPT:=$PERL_INSTALLSCRIPT}
: ${PERL_INSTALLMAN1DIR:=$PERL_DPREFIX/man/man1}
: ${PERL_INSTALLSITEMAN1DIR=$PERL_INSTALLMAN1DIR}
: ${PERL_INSTALLMAN3DIR:=$PERL_DPREFIX/man/man3}
: ${PERL_INSTALLSITEMAN3DIR:=$PERL_INSTALLMAN3DIR}
: ${PERL_PERLLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION}
: ${PERL_ARCHLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
: ${PERL_INC:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti/CORE}
: ${PERL_MAKE_VARS:=LDFLAGS=$LDFLAGS LDDLFLAGS=$PERL_LDDLFLAGS \
SITELIBEXP=$PERL_SITELIBEXP SITEARCHEXP=$PERL_SITEARCHEXP \
PERLPREFIX=$PERL_DESTDIR SITEPREFIX=$PERL_SITEPREFIX \
INSTALLPRIVLIB=$PERL_INSTALLPRIVLIB \
INSTALLSITELIB=$PERL_INSTALLSITELIB \
INSTALLARCHLIB=$PERL_INSTALLARCHLIB \
INSTALLSITEARCH=$PERL_INSTALLSITEARCH \
INSTALLBIN=$PERL_INSTALLBIN \
INSTALLSITEBIN=$PERL_INSTALLSITEBIN \
INSTALLSCRIPT=$PERL_INSTALLSCRIPT \
INSTALLSITESCRIPT=$PERL_INSTALLSITESCRIPT \
INSTALLMAN1DIR=$PERL_INSTALLMAN1DIR \
INSTALLSITEMAN1DIR=$PERL_INSTALLSITEMAN1DIR \
INSTALLMAN3DIR=$PERL_INSTALLMAN3DIR \
INSTALLSITEMAN3DIR=$PERL_INSTALLSITEMAN3DIR \
PERL_LIB=$PERL_PERLLIB PERL_ARCHLIB=$PERL_ARCHLIB}
perl_module_build()
{
local builddir="$wrksrc"
local perlmkf=
if [ -z "$perl_configure_dirs" ]; then
perlmkf="$builddir/Makefile.PL"
if [ ! -f $perlmkf ]; then
echo "*** ERROR couldn't find $perlmkf, aborting"
exit 1
fi
cd $builddir && \
$perl_cmd Makefile.PL ${PERL_MAKE_VARS} $make_build_args
if [ "$?" -ne 0 ]; then
echo "*** ERROR building perl module for $pkgname ***"
exit 1
fi
fi
for i in "$perl_configure_dirs"; do
perlmkf="$builddir/$i/Makefile.PL"
if [ -f $perlmkf ]; then
cd $builddir/$i && \
$perl_cmd Makefile.PL \
${PERL_MAKE_VARS} $make_build_args
[ "$?" -ne 0 ] && exit 1
else
echo -n "*** ERROR: couldn't find $perlmkf"
echo ", aborting ***"
exit 1
fi
done
}

View File

@@ -1,46 +0,0 @@
#
# This helper replaces shebang paths pointing to the correct ones
# as used by xbps. Multiple languages are supported:
#
# - GNU Bash
# - Perl
# - Python
#
bash_regexp=".*sh"
perl_regexp=".*perl[^[:space:]]*"
python_regexp=".*python[^[:space:]]*"
replace_interpreter()
{
local lang="$1"
local file="$2"
local trsb=
local orsb=
[ -z $lang -o -z $file ] && return 1
case $lang in
bash)
orsb=$bash_regexp
trpath="/bin/bash"
;;
perl)
orsb=$perl_regexp
trpath="/usr/bin/perl"
;;
python)
orsb=$python_regexp
trpath="/usr/bin/python"
;;
*)
;;
esac
if [ -f $file ]; then
sed -i -e "1s|^#![[:space:]]*${orsb}|#!${trpath}|" $file && \
msg_normal "Transformed $lang script: ${file##$wrksrc}."
else
msg_warn "Ignoring unexistent $lang script: ${file##$wrksrc}."
fi
}

View File

@@ -1,14 +0,0 @@
#
# This helper update's desktop-file-utils desktop database for any
# package that requests this operation.
#
update_desktopdb_cmd=$XBPS_MASTERDIR/bin/update-desktop-database
desktopdb_dir=$XBPS_MASTERDIR/share/applications
if [ -x $update_desktopdb_cmd -a -d $desktopdb_dir ]; then
$update_desktopdb_cmd $desktopdb_dir && \
echo "=> Updated desktop database directory."
fi
unset update_desktopdb_cmd desktopdb_dir

View File

@@ -1,13 +0,0 @@
#
# This helper updates shared-mime-info's database when a template
# requests this operation.
#
updatemimedb_cmd="$XBPS_MASTERDIR/bin/update-mime-database"
updatemimedb_dir="$XBPS_MASTERDIR/share/mime"
if [ -d "$XBPS_MASTERDIR/share/mime" ]; then
$updatemimedb_cmd $updatemimedb_dir >/dev/null && \
echo "=> Updated shared-mime-info database."
fi
unset updatemimedb_cmd updatemimedb_dir

View File

@@ -1,30 +0,0 @@
#
# This helper registers DTDs and XML/SGML catalogs through the
# xmlcatmgr application, as done in pkgsrc.
#
xmlcatmgr_cmd=$XBPS_MASTERDIR/bin/xmlcatmgr
sgml_catalog=$XBPS_MASTERDIR/share/sgml/catalog
xml_catalog=$XBPS_MASTERDIR/share/xml/catalog
if [ -x $xmlcatmgr_cmd -a -f $sgml_catalog -a -f $xml_catalog ]; then
if [ -n "$sgml_entries" ]; then
echo "=> Registering SGML catalogs for \`$pkgname-$version'."
set -- ${sgml_entries}
while [ $# -gt 0 ]; do
$xmlcatmgr_cmd -sc $sgml_catalog add "$1" "$2" "$3"
shift; shift; shift;
done
fi
if [ -n "$xml_entries" ]; then
echo "=> Registering XML catalogs for \`$pkgname-$version'."
set -- ${xml_entries}
while [ $# -gt 0 ]; do
$xmlcatmgr_cmd -c $xml_catalog add "$1" "$2" "$3"
shift; shift; shift;
done
fi
fi
unset xmlcatmgr_cmd sgml_catalog xml_catalog