2008-10-29 17:33:55 +00:00
|
|
|
#!/bin/sh
|
2008-09-26 19:59:07 +00:00
|
|
|
#
|
2008-10-13 05:32:05 +00:00
|
|
|
# xbps - A simple, minimal, fast and uncomplete build package system.
|
2008-09-26 21:23:41 +00:00
|
|
|
#-
|
|
|
|
# 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.
|
|
|
|
#-
|
2008-10-30 05:40:11 +00:00
|
|
|
trap "echo && exit 1" INT QUIT
|
2008-10-29 02:20:14 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
: ${XBPS_CONFIG_FILE:=/etc/xbps.conf}
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-09-27 01:17:12 +00:00
|
|
|
: ${progname:=$(basename $0)}
|
2008-10-23 15:14:00 +00:00
|
|
|
: ${fetch_cmd:=wget}
|
2008-10-24 01:34:50 +00:00
|
|
|
: ${xbps_machine:=$(uname -m)}
|
2008-11-03 06:12:53 +00:00
|
|
|
: ${XBPS_CROSS_HOST:=$xbps_machine-pc-linux-gnu}
|
2008-09-30 20:48:52 +00:00
|
|
|
|
2008-09-27 01:17:12 +00:00
|
|
|
usage()
|
|
|
|
{
|
2008-09-26 19:59:07 +00:00
|
|
|
cat << _EOF
|
2008-10-29 17:33:55 +00:00
|
|
|
$progname: [-C] [-c <config_file>] <target> [package_name]
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-12 23:11:24 +00:00
|
|
|
Targets:
|
2008-10-12 18:05:52 +00:00
|
|
|
build Builds a package, only build phase is done.
|
2008-10-24 07:44:51 +00:00
|
|
|
chroot Enters to the chroot in masterdir.
|
2008-10-12 18:05:52 +00:00
|
|
|
configure Configure a package, only configure phase is done.
|
|
|
|
extract Extract distribution file(s) into build directory.
|
|
|
|
fetch Download distribution file(s).
|
|
|
|
info Show information about <package_name>.
|
2008-10-12 23:11:24 +00:00
|
|
|
install-destdir build + configure + install into destdir.
|
2008-10-23 15:14:00 +00:00
|
|
|
install install-destdir + stow.
|
|
|
|
list Lists all currently installed packages.
|
2008-10-13 03:50:40 +00:00
|
|
|
listfiles Lists files installed from <package_name>.
|
2008-10-23 15:14:00 +00:00
|
|
|
remove Remove package completely (destdir + masterdir).
|
|
|
|
stow Copy files from destdir/<pkgname> into masterdir.
|
|
|
|
unstow Remove <pkgname> files from masterdir.
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-12 23:11:24 +00:00
|
|
|
Options:
|
2008-10-12 18:05:52 +00:00
|
|
|
-C Do not remove build directory after successful installation.
|
|
|
|
-c Path to global configuration file:
|
2008-10-24 07:44:51 +00:00
|
|
|
if not specified /etc/xbps.conf is used.
|
2008-09-26 19:59:07 +00:00
|
|
|
_EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
set_defvars()
|
|
|
|
{
|
|
|
|
local i=
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
2008-10-30 22:34:05 +00:00
|
|
|
: ${XBPS_HELPERSDIR:=$XBPS_DISTRIBUTIONDIR/helpers}
|
2008-10-23 15:14:00 +00:00
|
|
|
: ${XBPS_PKGDB_FPATH:=$XBPS_DESTDIR/.xbps-pkgdb.plist}
|
|
|
|
: ${XBPS_UTILSDIR:=$XBPS_DISTRIBUTIONDIR/utils}
|
|
|
|
: ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest}
|
|
|
|
: ${XBPS_PKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb}
|
2008-10-29 18:59:06 +00:00
|
|
|
: ${XBPS_CMPVER_CMD:=$XBPS_UTILSDIR/xbps-cmpver}
|
2008-10-23 15:14:00 +00:00
|
|
|
|
2008-10-30 22:34:05 +00:00
|
|
|
local DDIRS="XBPS_TEMPLATESDIR XBPS_HELPERSDIR XBPS_UTILSDIR"
|
2008-10-23 15:14:00 +00:00
|
|
|
for i in ${DDIRS}; do
|
|
|
|
eval val="\$$i"
|
2008-10-29 22:34:05 +00:00
|
|
|
[ ! -d "$val" ] && msg_error "cannot find $i, aborting."
|
2008-10-23 15:14:00 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
XBPS_PKGDB_CMD="env XBPS_PKGDB_FPATH=$XBPS_PKGDB_FPATH $XBPS_PKGDB_CMD"
|
|
|
|
}
|
|
|
|
|
2008-09-26 19:59:07 +00:00
|
|
|
check_path()
|
|
|
|
{
|
2008-09-27 01:17:12 +00:00
|
|
|
eval local orig="$1"
|
2008-09-26 19:59:07 +00:00
|
|
|
|
|
|
|
case "$orig" in
|
|
|
|
/)
|
|
|
|
;;
|
|
|
|
/*)
|
|
|
|
orig="${orig%/}"
|
|
|
|
;;
|
|
|
|
*)
|
2008-10-23 15:14:00 +00:00
|
|
|
orig="$(pwd)/${orig%/}"
|
2008-09-26 19:59:07 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2008-09-27 01:17:12 +00:00
|
|
|
path_fixed="$orig"
|
2008-09-26 19:59:07 +00:00
|
|
|
}
|
|
|
|
|
2008-09-28 05:12:07 +00:00
|
|
|
run_file()
|
|
|
|
{
|
|
|
|
local file="$1"
|
|
|
|
|
|
|
|
check_path "$file"
|
|
|
|
. $path_fixed
|
|
|
|
}
|
|
|
|
|
2008-10-27 05:12:30 +00:00
|
|
|
run_func()
|
|
|
|
{
|
|
|
|
func="$1"
|
|
|
|
|
|
|
|
[ -z "$func" ] && return 1
|
|
|
|
|
2008-10-27 07:35:40 +00:00
|
|
|
type -t $func | grep -q 'function'
|
2008-10-27 05:12:30 +00:00
|
|
|
[ $? -eq 0 ] && $func
|
|
|
|
}
|
|
|
|
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_error()
|
|
|
|
{
|
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
|
|
|
|
if [ -n "$in_chroot" ]; then
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "[chroot] => ERROR: $1"
|
2008-10-27 06:42:40 +00:00
|
|
|
else
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "=> ERROR: $1"
|
2008-10-27 06:42:40 +00:00
|
|
|
fi
|
2008-10-29 22:34:05 +00:00
|
|
|
|
|
|
|
exit 1
|
2008-10-27 06:42:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
msg_warn()
|
|
|
|
{
|
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
|
|
|
|
if [ -n "$in_chroot" ]; then
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "[chroot] => WARNING: $1"
|
2008-10-27 06:42:40 +00:00
|
|
|
else
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "=> WARNING: $1"
|
2008-10-27 06:42:40 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
msg_normal()
|
|
|
|
{
|
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
if [ -n "$in_chroot" ]; then
|
|
|
|
echo "[chroot] => $1"
|
|
|
|
else
|
|
|
|
echo "=> $1"
|
|
|
|
fi
|
2008-10-27 06:42:40 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Shows info about a template.
|
|
|
|
#
|
2008-09-27 01:17:12 +00:00
|
|
|
info_tmpl()
|
2008-09-26 19:59:07 +00:00
|
|
|
{
|
2008-10-23 15:14:00 +00:00
|
|
|
local i=
|
|
|
|
|
2008-10-04 12:02:39 +00:00
|
|
|
echo "pkgname: $pkgname"
|
|
|
|
echo "version: $version"
|
2008-09-26 19:59:07 +00:00
|
|
|
for i in "${distfiles}"; do
|
2008-10-28 23:06:32 +00:00
|
|
|
[ -n "$i" ] && echo "distfile: $i"
|
2008-09-26 19:59:07 +00:00
|
|
|
done
|
2008-10-28 05:19:06 +00:00
|
|
|
[ -n "$checksum" ] && echo "checksum: $checksum"
|
2008-10-20 14:34:27 +00:00
|
|
|
echo "maintainer: $maintainer"
|
2008-10-04 12:02:39 +00:00
|
|
|
echo "build_style: $build_style"
|
|
|
|
echo "short_desc: $short_desc"
|
2008-09-26 19:59:07 +00:00
|
|
|
echo "$long_desc"
|
2008-09-30 02:28:05 +00:00
|
|
|
echo
|
2008-10-12 18:05:52 +00:00
|
|
|
check_build_depends_pkg $pkgname-$version
|
|
|
|
if [ $? -eq 0 ]; then
|
2008-10-04 12:02:39 +00:00
|
|
|
echo "This package requires the following dependencies to be built:"
|
2008-10-20 14:34:27 +00:00
|
|
|
for i in ${build_depends}; do
|
2008-10-04 12:02:39 +00:00
|
|
|
echo " $i"
|
2008-09-30 02:28:05 +00:00
|
|
|
done
|
|
|
|
fi
|
2008-09-27 01:17:12 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Checks that all required variables specified in the configuration
|
|
|
|
# file are properly working.
|
|
|
|
#
|
2008-09-29 15:01:12 +00:00
|
|
|
check_config_vars()
|
2008-09-27 01:17:12 +00:00
|
|
|
{
|
2008-10-03 16:53:58 +00:00
|
|
|
local cffound=
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-03 16:53:58 +00:00
|
|
|
|
|
|
|
if [ -z "$config_file_specified" ]; then
|
2008-10-13 05:32:05 +00:00
|
|
|
config_file_paths="$XBPS_CONFIG_FILE ./xbps.conf"
|
2008-10-03 16:53:58 +00:00
|
|
|
for f in $config_file_paths; do
|
2008-10-13 05:32:05 +00:00
|
|
|
[ -f $f ] && XBPS_CONFIG_FILE=$f && \
|
2008-10-08 04:42:42 +00:00
|
|
|
cffound=yes && break
|
2008-10-03 16:53:58 +00:00
|
|
|
done
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$cffound" ] && msg_error "cannot find a config file"
|
2008-10-03 16:53:58 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
run_file ${XBPS_CONFIG_FILE}
|
|
|
|
XBPS_CONFIG_FILE=$path_fixed
|
2008-09-28 05:12:07 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -f "$XBPS_CONFIG_FILE" ]; then
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_error "cannot find configuration file: $XBPS_CONFIG_FILE"
|
2008-09-27 01:17:12 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
local XBPS_VARS="XBPS_MASTERDIR XBPS_DESTDIR XBPS_BUILDDIR \
|
2008-10-23 15:14:00 +00:00
|
|
|
XBPS_SRCDISTDIR"
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
for f in ${XBPS_VARS}; do
|
2008-09-27 16:20:46 +00:00
|
|
|
eval val="\$$f"
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$val" ] && msg_error "'$f' not set in configuration file"
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-10 04:19:45 +00:00
|
|
|
if [ ! -d "$val" ]; then
|
2008-10-23 15:14:00 +00:00
|
|
|
mkdir "$val"
|
2008-10-29 22:34:05 +00:00
|
|
|
[ $? -ne 0 ] && msg_error "couldn't create '$f' directory"
|
2008-09-27 01:17:12 +00:00
|
|
|
fi
|
2008-09-27 16:20:46 +00:00
|
|
|
done
|
2008-09-26 19:59:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Resets all vars used by a template.
|
|
|
|
#
|
2008-09-28 05:12:07 +00:00
|
|
|
reset_tmpl_vars()
|
|
|
|
{
|
2008-10-23 15:14:00 +00:00
|
|
|
local v=
|
2008-10-14 05:52:29 +00:00
|
|
|
local TMPL_VARS="pkgname distfiles configure_args configure_env \
|
2008-09-28 09:41:26 +00:00
|
|
|
make_build_args make_install_args build_style \
|
|
|
|
short_desc maintainer long_desc checksum wrksrc \
|
2008-10-27 05:12:30 +00:00
|
|
|
patch_files make_cmd base_package base_chroot \
|
2008-10-14 05:52:29 +00:00
|
|
|
make_env make_build_target configure_script \
|
2008-10-27 05:12:30 +00:00
|
|
|
pre_configure pre_build pre_install post_install \
|
|
|
|
postinstall_helpers make_install_target version \
|
2008-10-28 15:28:46 +00:00
|
|
|
tar_override_cmd xml_entries sgml_entries \
|
2008-10-26 05:50:52 +00:00
|
|
|
build_depends libtool_fixup_la_stage no_fixup_libtool \
|
2008-11-03 06:12:53 +00:00
|
|
|
disable_parallel_build run_depends cross_compiler \
|
2008-11-03 07:38:38 +00:00
|
|
|
only_for_archs \
|
2008-10-13 05:32:05 +00:00
|
|
|
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
|
|
|
|
XBPS_BUILD_DONE XBPS_INSTALL_DONE"
|
2008-09-28 05:12:07 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
for v in ${TMPL_VARS}; do
|
|
|
|
eval unset "$v"
|
2008-09-28 05:12:07 +00:00
|
|
|
done
|
2008-10-11 10:35:04 +00:00
|
|
|
|
|
|
|
unset_build_vars
|
2008-09-28 05:12:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
# Reads a template file and setups required variables for operations.
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
setup_tmpl()
|
2008-09-26 19:59:07 +00:00
|
|
|
{
|
2008-09-28 07:57:30 +00:00
|
|
|
local pkg="$1"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$pkg" ] && msg_error "missing package name after target." && usage
|
2008-10-29 02:20:14 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then
|
2008-10-13 08:28:51 +00:00
|
|
|
if [ "$pkgname" != "$pkg" ]; then
|
|
|
|
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
|
|
|
fi
|
2008-10-12 18:05:52 +00:00
|
|
|
prepare_tmpl
|
|
|
|
else
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "cannot find '$pkg' template build file."
|
2008-10-12 18:05:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Checks some vars used in templates and sets some of them required.
|
|
|
|
#
|
|
|
|
prepare_tmpl()
|
|
|
|
{
|
2008-10-23 15:14:00 +00:00
|
|
|
local i=
|
2008-11-03 07:38:38 +00:00
|
|
|
local found=
|
2008-10-23 15:14:00 +00:00
|
|
|
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
|
|
|
# There's nothing of interest if we are a meta template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
2008-09-28 07:57:30 +00:00
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
REQ_VARS="pkgname distfiles version build_style"
|
2008-09-26 19:59:07 +00:00
|
|
|
|
|
|
|
# Check if required vars weren't set.
|
2008-09-27 01:17:12 +00:00
|
|
|
for i in ${REQ_VARS}; do
|
|
|
|
eval val="\$$i"
|
|
|
|
if [ -z "$val" -o -z "$i" ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "\"$i\" not set on $pkgname template."
|
2008-09-26 19:59:07 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-11-03 07:38:38 +00:00
|
|
|
for i in ${only_for_archs}; do
|
|
|
|
[ "$i" = "$xbps_machine" ] && found=si && break
|
|
|
|
done
|
2008-11-03 08:02:21 +00:00
|
|
|
if [ -n "${only_for_archs}" -a -z "$found" ]; then
|
2008-11-03 07:38:38 +00:00
|
|
|
msg_error "this package is only for: ${only_for_archs}."
|
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
unset XBPS_EXTRACT_DONE XBPS_APPLYPATCHES_DONE
|
|
|
|
unset XBPS_CONFIGURE_DONE XBPS_BUILD_DONE XBPS_INSTALL_DONE
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
[ -z "$wrksrc" ] && wrksrc="$pkgname-$version"
|
|
|
|
wrksrc="$XBPS_BUILDDIR/$wrksrc"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
XBPS_EXTRACT_DONE="$wrksrc/.xbps_extract_done"
|
|
|
|
XBPS_APPLYPATCHES_DONE="$wrksrc/.xbps_applypatches_done"
|
|
|
|
XBPS_CONFIGURE_DONE="$wrksrc/.xbps_configure_done"
|
|
|
|
XBPS_BUILD_DONE="$wrksrc/.xbps_build_done"
|
|
|
|
XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-27 06:42:40 +00:00
|
|
|
if [ -z "$in_chroot" ]; then
|
|
|
|
export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin"
|
|
|
|
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin"
|
|
|
|
fi
|
2008-10-24 01:34:50 +00:00
|
|
|
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
|
2008-10-12 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Extracts contents of distfiles specified in a template into
|
2008-10-14 05:52:29 +00:00
|
|
|
# the $wrksrc directory.
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
|
|
|
extract_distfiles()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-14 05:52:29 +00:00
|
|
|
local count=
|
|
|
|
local curfile=
|
|
|
|
local cursufx=
|
|
|
|
local lwrksrc=
|
2008-10-14 07:27:25 +00:00
|
|
|
local ltar_cmd=
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-27 07:35:40 +00:00
|
|
|
[ -f $XBPS_EXTRACT_DONE ] && return 0
|
|
|
|
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
|
|
|
# If we are being called via the target, just extract and return.
|
|
|
|
#
|
|
|
|
[ -n "$pkg" -a -z "$pkgname" ] && return 1
|
|
|
|
|
|
|
|
#
|
|
|
|
# There's nothing of interest if we are a meta template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
for f in ${distfiles}; do
|
|
|
|
count=$(($count + 1))
|
|
|
|
done
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
if [ $count -gt 1 ]; then
|
|
|
|
if [ -z "$wrksrc" ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "\$wrksrc must be defined with multiple distfiles."
|
2008-10-29 17:33:55 +00:00
|
|
|
exit 1
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
2008-10-23 15:14:00 +00:00
|
|
|
mkdir $wrksrc
|
2008-10-12 18:05:52 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_normal "Extracting $pkgname-$version distfile(s)."
|
2008-10-14 05:52:29 +00:00
|
|
|
|
2008-10-14 07:27:25 +00:00
|
|
|
if [ -n "$tar_override_cmd" ]; then
|
|
|
|
ltar_cmd="$tar_override_cmd"
|
|
|
|
else
|
2008-10-23 15:14:00 +00:00
|
|
|
ltar_cmd="tar"
|
2008-10-14 07:27:25 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
for f in ${distfiles}; do
|
2008-10-29 17:33:55 +00:00
|
|
|
if $(echo $f|grep -q '.tar.bz2'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".tar.bz2"
|
2008-10-29 17:33:55 +00:00
|
|
|
elif $(echo $f|grep -q '.tbz'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".tbz"
|
2008-10-29 17:33:55 +00:00
|
|
|
elif $(echo $f|grep -q '.tar.gz'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".tar.gz"
|
2008-10-29 17:33:55 +00:00
|
|
|
elif $(echo $f|grep -q '.tgz'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".tgz"
|
2008-10-29 17:37:04 +00:00
|
|
|
elif $(echo $f|grep -q '.tar'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".tar"
|
2008-10-29 17:37:04 +00:00
|
|
|
elif $(echo $f|grep -q '.zip'); then
|
2008-10-28 22:57:52 +00:00
|
|
|
cursufx=".zip"
|
|
|
|
else
|
2008-10-29 22:34:05 +00:00
|
|
|
msg_error "unknown distfile suffix for $f."
|
2008-10-28 22:57:52 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
curfile=$(basename $f)
|
|
|
|
|
|
|
|
if [ $count -gt 1 ]; then
|
|
|
|
lwrksrc="$wrksrc/${curfile%$cursufx}"
|
|
|
|
else
|
|
|
|
lwrksrc="$XBPS_BUILDDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case ${cursufx} in
|
2008-10-20 14:34:27 +00:00
|
|
|
.tar.bz2|.tbz)
|
|
|
|
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
2008-10-14 05:52:29 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "extracting $curfile into $lwrksrc."
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
|
|
|
;;
|
2008-10-20 14:34:27 +00:00
|
|
|
.tar.gz|.tgz)
|
|
|
|
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
|
|
|
if [ $? -ne 0 ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "extracting $curfile into $lwrksrc."
|
2008-10-20 14:34:27 +00:00
|
|
|
fi
|
|
|
|
;;
|
2008-10-14 05:52:29 +00:00
|
|
|
.tar)
|
2008-10-14 07:27:25 +00:00
|
|
|
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
2008-10-14 05:52:29 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "extracting $curfile into $lwrksrc."
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
.zip)
|
2008-10-30 22:28:59 +00:00
|
|
|
if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then
|
|
|
|
$XBPS_MASTERDIR/usr/bin/unzip \
|
|
|
|
-q -x $XBPS_SRCDISTDIR/$curfile -d $lwrksrc
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
msg_error "extracting $curfile into $lwrksrc."
|
|
|
|
fi
|
2008-10-14 05:52:29 +00:00
|
|
|
else
|
2008-10-30 22:28:59 +00:00
|
|
|
msg_error "cannot find unzip bin for extraction"
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2008-10-28 11:45:30 +00:00
|
|
|
msg_error "cannot guess $curfile extract suffix. ($cursufx)"
|
2008-10-14 05:52:29 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
touch -f $XBPS_EXTRACT_DONE
|
2008-09-26 19:59:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-14 05:52:29 +00:00
|
|
|
# Verifies that file's checksum downloaded matches what it's specified
|
|
|
|
# in template file.
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-20 14:34:27 +00:00
|
|
|
verify_sha256_cksum()
|
2008-09-26 19:59:07 +00:00
|
|
|
{
|
2008-09-28 07:57:30 +00:00
|
|
|
local file="$1"
|
2008-10-14 05:52:29 +00:00
|
|
|
local origsum="$2"
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
[ -z "$file" -o -z "$cksum" ] && return 1
|
2008-09-29 20:51:08 +00:00
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file)
|
2008-09-26 19:59:07 +00:00
|
|
|
if [ "$origsum" != "$filesum" ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "SHA256 checksum doesn't match for $file."
|
2008-09-26 19:59:07 +00:00
|
|
|
fi
|
2008-10-10 04:19:45 +00:00
|
|
|
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "SHA256 checksum OK for $file."
|
2008-09-26 19:59:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-14 05:52:29 +00:00
|
|
|
# Downloads the distfiles and verifies checksum for all them.
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
fetch_distfiles()
|
2008-09-26 19:59:07 +00:00
|
|
|
{
|
2008-10-12 18:05:52 +00:00
|
|
|
local pkg="$1"
|
2008-10-14 05:52:29 +00:00
|
|
|
local dfiles=
|
|
|
|
local localurl=
|
|
|
|
local dfcount=0
|
|
|
|
local ckcount=0
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
[ -z $pkgname ] && exit 1
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
|
|
|
# There's nothing of interest if we are a meta template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-29 03:04:32 +00:00
|
|
|
for f in ${distfiles}; do
|
2008-10-14 05:52:29 +00:00
|
|
|
curfile=$(basename $f)
|
|
|
|
if [ -f "$XBPS_SRCDISTDIR/$curfile" ]; then
|
|
|
|
for i in ${checksum}; do
|
|
|
|
if [ $dfcount -eq $ckcount -a -n $i ]; then
|
|
|
|
cksum=$i
|
|
|
|
found=yes
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
ckcount=$(($ckcount + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z $found ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "cannot find checksum for $curfile."
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
verify_sha256_cksum $curfile $cksum
|
2008-10-14 05:52:29 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
unset cksum found
|
|
|
|
ckcount=0
|
|
|
|
dfcount=$(($dfcount + 1))
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_normal "Fetching distfile: $curfile."
|
2008-10-14 05:52:29 +00:00
|
|
|
|
|
|
|
if [ -n "$distfiles" ]; then
|
|
|
|
localurl="$f"
|
|
|
|
else
|
|
|
|
localurl="$url/$curfile"
|
2008-09-26 19:59:07 +00:00
|
|
|
fi
|
2008-09-27 01:17:12 +00:00
|
|
|
|
|
|
|
|
2008-10-14 05:52:29 +00:00
|
|
|
cd $XBPS_SRCDISTDIR && $fetch_cmd $localurl
|
2008-10-12 18:05:52 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2008-10-14 05:52:29 +00:00
|
|
|
unset localurl
|
|
|
|
if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "couldn't fetch $curfile."
|
2008-09-27 01:17:12 +00:00
|
|
|
else
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "there was an error fetching $curfile."
|
2008-09-27 01:17:12 +00:00
|
|
|
fi
|
2008-09-26 19:59:07 +00:00
|
|
|
else
|
2008-10-14 05:52:29 +00:00
|
|
|
unset localurl
|
|
|
|
#
|
|
|
|
# XXX duplicate code.
|
|
|
|
#
|
|
|
|
for i in ${checksum}; do
|
|
|
|
if [ $dfcount -eq $ckcount -a -n $i ]; then
|
|
|
|
cksum=$i
|
|
|
|
found=yes
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
ckcount=$(($ckcount + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z $found ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "cannot find checksum for $curfile."
|
2008-10-14 05:52:29 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
verify_sha256_cksum $curfile $cksum
|
2008-10-14 05:52:29 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
unset cksum found
|
|
|
|
ckcount=0
|
|
|
|
fi
|
2008-09-26 19:59:07 +00:00
|
|
|
fi
|
2008-10-14 05:52:29 +00:00
|
|
|
|
|
|
|
dfcount=$(($dfcount + 1))
|
2008-09-26 19:59:07 +00:00
|
|
|
done
|
2008-10-14 05:52:29 +00:00
|
|
|
|
|
|
|
unset cksum found
|
2008-09-26 19:59:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-26 05:50:52 +00:00
|
|
|
libtool_fixup_file()
|
2008-10-23 15:14:00 +00:00
|
|
|
{
|
|
|
|
[ "$pkgname" = "libtool" -o ! -f $wrksrc/libtool ] && return 0
|
2008-10-23 21:27:10 +00:00
|
|
|
[ -n "$no_libtool_fixup" ] && return 0
|
2008-10-23 15:14:00 +00:00
|
|
|
|
2008-10-24 03:20:12 +00:00
|
|
|
# If we are being invoked by a chroot, don't transform stuff.
|
2008-10-27 06:42:40 +00:00
|
|
|
[ -n "$in_chroot" ] && return 0
|
2008-10-24 03:20:12 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
sed -i -e \
|
|
|
|
's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec="-Wl,-rpath /usr/lib"|g' \
|
|
|
|
$wrksrc/libtool
|
|
|
|
}
|
|
|
|
|
2008-10-26 05:50:52 +00:00
|
|
|
libtool_fixup_la_files()
|
2008-09-28 05:12:07 +00:00
|
|
|
{
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-26 05:50:52 +00:00
|
|
|
local postinstall="$1"
|
|
|
|
local where=
|
2008-10-23 15:14:00 +00:00
|
|
|
|
2008-10-16 01:29:19 +00:00
|
|
|
# Ignore libtool itself
|
|
|
|
[ "$pkgname" = "libtool" ] && return 0
|
|
|
|
|
2008-10-24 03:20:12 +00:00
|
|
|
# If we are being invoked by a chroot, don't transform stuff.
|
2008-10-27 06:42:40 +00:00
|
|
|
[ -n "$in_chroot" ] && return 0
|
2008-10-24 03:20:12 +00:00
|
|
|
|
2008-10-25 02:57:53 +00:00
|
|
|
[ ! -f "$wrksrc/libtool" -o ! -f "$wrksrc/ltmain.sh" ] && return 0
|
|
|
|
|
2008-09-28 05:12:07 +00:00
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
# Replace hardcoded or incorrect paths with correct ones.
|
2008-09-28 05:12:07 +00:00
|
|
|
#
|
2008-10-26 05:50:52 +00:00
|
|
|
if [ -z "$postinstall" ]; then
|
|
|
|
where="$wrksrc"
|
|
|
|
else
|
|
|
|
where="$XBPS_DESTDIR/$pkgname-$version"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for f in $(find $where -type f -name \*.la*); do
|
2008-10-14 22:21:35 +00:00
|
|
|
if [ -f $f ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_normal "Fixing up libtool archive: ${f##$where/}."
|
2008-10-23 22:55:51 +00:00
|
|
|
sed -i -e "s|\/..\/lib||g;s|\/\/lib|/usr/lib|g" \
|
2008-10-26 05:50:52 +00:00
|
|
|
-e "s|$XBPS_MASTERDIR||g;s|$wrksrc||g" \
|
2008-10-23 15:14:00 +00:00
|
|
|
-e "s|$XBPS_DESTDIR/$pkgname-$version||g" $f
|
|
|
|
awk '{ if (/^ dependency_libs/) {gsub("/usr[^]*lib","lib");}print}' \
|
|
|
|
$f > $f.in && mv $f.in $f
|
2008-10-14 22:21:35 +00:00
|
|
|
fi
|
|
|
|
done
|
2008-09-28 05:12:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-10 02:41:15 +00:00
|
|
|
set_build_vars()
|
|
|
|
{
|
2008-10-27 06:42:40 +00:00
|
|
|
[ -n "$in_chroot" ] && return 0
|
2008-10-25 22:44:31 +00:00
|
|
|
|
2008-10-23 16:32:11 +00:00
|
|
|
LDFLAGS="-L$XBPS_MASTERDIR/usr/lib"
|
2008-10-21 23:54:48 +00:00
|
|
|
SAVE_LDLIBPATH=$LD_LIBRARY_PATH
|
|
|
|
LD_LIBRARY_PATH="$XBPS_MASTERDIR/usr/lib"
|
2008-10-13 05:32:05 +00:00
|
|
|
CFLAGS="$CFLAGS $XBPS_CFLAGS"
|
|
|
|
CXXFLAGS="$CXXFLAGS $XBPS_CXXFLAGS"
|
2008-10-21 23:54:48 +00:00
|
|
|
CPPFLAGS="-I$XBPS_MASTERDIR/usr/include $CPPFLAGS"
|
|
|
|
PKG_CONFIG="$XBPS_MASTERDIR/usr/bin/pkg-config"
|
2008-10-23 15:14:00 +00:00
|
|
|
PKG_CONFIG_LIBDIR="$XBPS_MASTERDIR/usr/lib/pkgconfig"
|
2008-10-10 02:41:15 +00:00
|
|
|
|
2008-10-21 23:54:48 +00:00
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
|
2008-10-23 15:14:00 +00:00
|
|
|
export CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"
|
2008-10-10 02:41:15 +00:00
|
|
|
export CPPFLAGS="$CPPFLAGS" PKG_CONFIG="$PKG_CONFIG"
|
2008-10-23 15:14:00 +00:00
|
|
|
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR"
|
2008-10-23 16:32:11 +00:00
|
|
|
export LDFLAGS="$LDFLAGS"
|
2008-10-10 02:41:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unset_build_vars()
|
|
|
|
{
|
2008-10-27 06:42:40 +00:00
|
|
|
[ -n "$in_chroot" ] && return 0
|
2008-10-25 22:44:31 +00:00
|
|
|
|
2008-10-23 16:32:11 +00:00
|
|
|
unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG LD_LIBRARY_PATH
|
2008-10-21 23:54:48 +00:00
|
|
|
export LD_LIBRARY_PATH=$SAVE_LDLIBPATH
|
2008-10-10 02:41:15 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
# Applies to the build directory the patches specified by a template.
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
apply_tmpl_patches()
|
2008-09-27 01:17:12 +00:00
|
|
|
{
|
2008-10-12 18:05:52 +00:00
|
|
|
local patch=
|
2008-10-23 15:14:00 +00:00
|
|
|
local i=
|
2008-10-04 04:29:49 +00:00
|
|
|
|
2008-10-27 03:08:55 +00:00
|
|
|
# Apply some build/install patches automatically.
|
|
|
|
if [ -f $XBPS_TEMPLATESDIR/$pkgname-fix-build.diff ]; then
|
|
|
|
patch_files="$pkgname-fix-build.diff $patch_files"
|
|
|
|
fi
|
|
|
|
if [ -f $XBPS_TEMPLATESDIR/$pkgname-fix-install.diff ]; then
|
|
|
|
patch_files="$pkgname-fix-install.diff $patch_files"
|
|
|
|
fi
|
|
|
|
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
# If package needs some patches applied before building,
|
|
|
|
# apply them now.
|
|
|
|
#
|
|
|
|
if [ -n "$patch_files" ]; then
|
|
|
|
for i in ${patch_files}; do
|
2008-10-13 05:32:05 +00:00
|
|
|
patch="$XBPS_TEMPLATESDIR/$i"
|
2008-10-12 18:05:52 +00:00
|
|
|
if [ ! -f "$patch" ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_warn "unexistent patch: $i."
|
2008-10-12 18:05:52 +00:00
|
|
|
continue
|
|
|
|
fi
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
cp -f $patch $wrksrc
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
# Try to guess if its a compressed patch.
|
2008-10-29 17:33:55 +00:00
|
|
|
if $(echo $patch|grep -q '.diff.gz'); then
|
2008-10-23 15:14:00 +00:00
|
|
|
gunzip $wrksrc/$i
|
2008-10-12 18:05:52 +00:00
|
|
|
patch=${i%%.gz}
|
2008-10-29 17:33:55 +00:00
|
|
|
elif $(echo $patch|grep -q '.diff.bz2'); then
|
2008-10-23 15:14:00 +00:00
|
|
|
bunzip2 $wrksrc/$i
|
2008-10-12 18:05:52 +00:00
|
|
|
patch=${i%%.bz2}
|
2008-10-29 17:33:55 +00:00
|
|
|
elif $(echo $patch|grep -q '.diff'); then
|
2008-10-12 18:05:52 +00:00
|
|
|
patch=$i
|
|
|
|
else
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_warn "unknown patch type: $i."
|
2008-10-12 18:05:52 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2008-10-29 02:20:14 +00:00
|
|
|
cd $wrksrc && patch -s -p0 < $patch 2>/dev/null
|
2008-10-12 18:05:52 +00:00
|
|
|
if [ "$?" -eq 0 ]; then
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "Patch applied: $i."
|
2008-10-12 18:05:52 +00:00
|
|
|
else
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_error "couldn't apply patch: $i."
|
2008-10-12 18:05:52 +00:00
|
|
|
fi
|
|
|
|
done
|
2008-09-26 19:59:07 +00:00
|
|
|
fi
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
touch -f $XBPS_APPLYPATCHES_DONE
|
2008-10-12 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Runs the "configure" phase for a pkg. This setups the Makefiles or any
|
|
|
|
# other stuff required to be able to build binaries or such.
|
|
|
|
#
|
|
|
|
configure_src_phase()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
[ -z $pkg ] && [ -z $pkgname ] && return 1
|
|
|
|
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
# There's nothing we can do if we are a meta template or an
|
2008-10-28 04:01:40 +00:00
|
|
|
# {custom,only}_install template.
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
2008-10-28 04:01:40 +00:00
|
|
|
[ "$build_style" = "meta-template" -o \
|
|
|
|
"$build_style" = "only-install" -o \
|
|
|
|
"$build_style" = "custom-install" ] && return 0
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]."
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-09-28 05:12:07 +00:00
|
|
|
# Apply patches if requested by template file
|
2008-10-13 05:32:05 +00:00
|
|
|
[ ! -f $XBPS_APPLYPATCHES_DONE ] && apply_tmpl_patches
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-11-03 06:12:53 +00:00
|
|
|
# cross compilation vars.
|
|
|
|
if [ -n "$cross_compiler" ]; then
|
|
|
|
. $XBPS_HELPERSDIR/cross-compilation.sh
|
|
|
|
cross_compile_setvars
|
|
|
|
else
|
|
|
|
if [ "$build_style" = "gnu_configure" ]; then
|
2008-11-03 06:50:58 +00:00
|
|
|
configure_args="$configure_args --host=$XBPS_CROSS_HOST"
|
|
|
|
configure_args="$configure_args --build=$XBPS_CROSS_HOST"
|
2008-11-03 06:12:53 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-10-27 02:56:42 +00:00
|
|
|
# Run pre_configure helpers.
|
2008-10-27 05:12:30 +00:00
|
|
|
run_func pre_configure
|
2008-10-01 23:38:12 +00:00
|
|
|
|
2008-10-10 02:41:15 +00:00
|
|
|
# Export configure_env vars.
|
|
|
|
for f in ${configure_env}; do
|
|
|
|
export "$f"
|
|
|
|
done
|
|
|
|
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "Running configure phase for $pkgname-$version."
|
2008-10-27 05:12:30 +00:00
|
|
|
|
2008-10-15 22:57:53 +00:00
|
|
|
[ -z "$configure_script" ] && configure_script="./configure"
|
|
|
|
|
2008-10-21 23:54:48 +00:00
|
|
|
local _prefix=
|
|
|
|
if [ -z "$base_package" ]; then
|
|
|
|
_prefix=/usr
|
|
|
|
else
|
2008-10-25 23:43:48 +00:00
|
|
|
_prefix=
|
2008-10-21 23:54:48 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
cd $wrksrc || exit 1
|
2008-10-29 04:34:57 +00:00
|
|
|
set_build_vars
|
2008-10-28 05:02:52 +00:00
|
|
|
|
2008-09-26 19:59:07 +00:00
|
|
|
#
|
|
|
|
# Packages using GNU autoconf
|
|
|
|
#
|
|
|
|
if [ "$build_style" = "gnu_configure" ]; then
|
2008-10-21 23:54:48 +00:00
|
|
|
${configure_script} \
|
2008-10-23 15:14:00 +00:00
|
|
|
--prefix=${_prefix} --sysconfdir=/etc \
|
|
|
|
--infodir=$XBPS_DESTDIR/$pkgname-$version/usr/share/info \
|
|
|
|
--mandir=$XBPS_DESTDIR/$pkgname-$version/usr/share/man \
|
2008-10-10 02:41:15 +00:00
|
|
|
${configure_args}
|
2008-09-28 08:36:43 +00:00
|
|
|
#
|
|
|
|
# Packages using propietary configure scripts.
|
|
|
|
#
|
2008-09-28 05:12:07 +00:00
|
|
|
elif [ "$build_style" = "configure" ]; then
|
2008-10-15 22:57:53 +00:00
|
|
|
${configure_script} ${configure_args}
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
|
|
|
# Packages that are perl modules and use Makefile.PL files.
|
|
|
|
# They are all handled by the helper perl-module.sh.
|
|
|
|
#
|
|
|
|
elif [ "$build_style" = "perl_module" ]; then
|
2008-10-30 22:34:05 +00:00
|
|
|
. $XBPS_HELPERSDIR/perl-module.sh
|
2008-10-01 23:38:12 +00:00
|
|
|
perl_module_build $pkgname
|
2008-10-02 22:44:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Packages with BSD or GNU Makefiles are easy, just skip
|
|
|
|
# the configure stage and proceed.
|
|
|
|
#
|
|
|
|
elif [ "$build_style" = "bsd_makefile" -o \
|
|
|
|
"$build_style" = "gnu_makefile" ]; then
|
2008-10-28 05:02:52 +00:00
|
|
|
:
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
|
|
|
# Unknown build_style type won't work :-)
|
|
|
|
#
|
|
|
|
else
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "unknown build_style [$build_style]"
|
2008-10-29 17:33:55 +00:00
|
|
|
exit 1
|
2008-09-28 05:12:07 +00:00
|
|
|
fi
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-01 23:38:12 +00:00
|
|
|
if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "building $pkg (configure phase)."
|
2008-09-28 05:12:07 +00:00
|
|
|
fi
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-10 02:41:15 +00:00
|
|
|
# unset configure_env vars.
|
|
|
|
for f in ${configure_env}; do
|
|
|
|
unset eval ${f%=*}
|
|
|
|
done
|
|
|
|
|
2008-11-03 06:12:53 +00:00
|
|
|
# unset cross compiler vars.
|
|
|
|
[ -n "$cross_compiler" ] && cross_compile_unsetvars
|
|
|
|
|
2008-10-22 02:08:46 +00:00
|
|
|
unset_build_vars
|
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
touch -f $XBPS_CONFIGURE_DONE
|
2008-10-12 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Runs the "build" phase for a pkg. This builds the binaries and other
|
|
|
|
# related stuff.
|
|
|
|
#
|
|
|
|
build_src_phase()
|
|
|
|
{
|
|
|
|
local pkgparam="$1"
|
|
|
|
local pkg="$pkgname-$version"
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
|
|
|
|
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
# There's nothing of interest if we are a meta template or an
|
2008-10-28 04:01:40 +00:00
|
|
|
# {custom,only}-install template.
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
2008-10-28 04:01:40 +00:00
|
|
|
[ "$build_style" = "meta-template" -o \
|
|
|
|
"$build_style" = "only-install" -o \
|
|
|
|
"$build_style" = "custom-install" ] && return 0
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
cd $wrksrc || exit 1
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-11-03 06:12:53 +00:00
|
|
|
# cross compilation vars.
|
|
|
|
if [ -n "$cross_compiler" ]; then
|
|
|
|
. $XBPS_HELPERSDIR/cross-compilation.sh
|
|
|
|
cross_compile_setvars
|
|
|
|
fi
|
|
|
|
|
2008-10-29 21:53:26 +00:00
|
|
|
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
2008-10-27 02:56:42 +00:00
|
|
|
# Run pre_build helpers.
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
2008-10-27 05:12:30 +00:00
|
|
|
run_func pre_build
|
2008-10-01 23:38:12 +00:00
|
|
|
|
2008-10-02 16:39:26 +00:00
|
|
|
[ -z "$make_build_target" ] && make_build_target=
|
2008-10-27 09:45:07 +00:00
|
|
|
[ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \
|
|
|
|
makejobs="-j$XBPS_MAKEJOBS"
|
2008-10-10 02:41:15 +00:00
|
|
|
|
|
|
|
# Export make_env vars.
|
|
|
|
for f in ${make_env}; do
|
|
|
|
export "$f"
|
|
|
|
done
|
|
|
|
|
2008-10-26 05:50:52 +00:00
|
|
|
libtool_fixup_file
|
2008-10-22 02:08:46 +00:00
|
|
|
set_build_vars
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "Running build phase for $pkg."
|
2008-10-27 05:12:30 +00:00
|
|
|
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
|
|
|
# Build package via make.
|
|
|
|
#
|
2008-10-13 08:28:51 +00:00
|
|
|
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
2008-10-29 22:34:05 +00:00
|
|
|
[ $? -ne 0 ] && msg_error "building $pkg (build phase)."
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-10-13 08:28:51 +00:00
|
|
|
unset makejobs
|
|
|
|
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
2008-10-27 02:56:42 +00:00
|
|
|
# Run pre_install helpers.
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
2008-10-27 05:12:30 +00:00
|
|
|
run_func pre_install
|
2008-10-01 23:38:12 +00:00
|
|
|
|
2008-10-26 21:09:16 +00:00
|
|
|
if [ -z "$libtool_fixup_la_stage" \
|
2008-10-26 05:50:52 +00:00
|
|
|
-o "$libtool_fixup_la_stage" = "postbuild" ]; then
|
|
|
|
libtool_fixup_la_files
|
|
|
|
fi
|
2008-11-03 06:12:53 +00:00
|
|
|
|
|
|
|
# unset cross compiler vars.
|
|
|
|
[ -n "$cross_compiler" ] && cross_compile_unsetvars
|
|
|
|
|
2008-10-22 02:08:46 +00:00
|
|
|
unset_build_vars
|
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
touch -f $XBPS_BUILD_DONE
|
2008-10-12 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Runs the "install" phase for a pkg. This consists in installing package
|
|
|
|
# into the destination directory.
|
|
|
|
#
|
|
|
|
install_src_phase()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
|
|
|
local i=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
[ -z $pkg ] && [ -z $pkgname ] && return 1
|
|
|
|
#
|
|
|
|
# There's nothing we can do if we are a meta template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
cd $wrksrc || exit 1
|
2008-10-13 03:30:59 +00:00
|
|
|
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "Running install phase for: $pkgname-$version."
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-11-03 06:12:53 +00:00
|
|
|
# cross compilation vars.
|
|
|
|
if [ -n "$cross_compiler" ]; then
|
|
|
|
. $XBPS_HELPERSDIR/cross-compilation.sh
|
|
|
|
cross_compile_setvars
|
|
|
|
fi
|
|
|
|
|
2008-10-28 04:01:40 +00:00
|
|
|
if [ "$build_style" = "custom-install" ]; then
|
|
|
|
run_func do_install
|
|
|
|
else
|
|
|
|
make_install
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run post_install helpers.
|
|
|
|
#
|
|
|
|
run_func post_install
|
|
|
|
|
2008-11-03 06:12:53 +00:00
|
|
|
# unset cross compiler vars.
|
|
|
|
[ -n "$cross_compiler" ] && cross_compile_unsetvars
|
|
|
|
|
2008-10-28 04:01:40 +00:00
|
|
|
msg_normal "Installed $pkgname-$version into $XBPS_DESTDIR."
|
|
|
|
|
|
|
|
touch -f $XBPS_INSTALL_DONE
|
|
|
|
|
|
|
|
#
|
|
|
|
# Remove $wrksrc if -C not specified.
|
|
|
|
#
|
|
|
|
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
|
|
|
|
rm -rf $wrksrc
|
|
|
|
[ $? -eq 0 ] && \
|
|
|
|
msg_normal "Removed $pkgname-$version build directory."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Installs a package via 'make install ...'.
|
|
|
|
#
|
|
|
|
make_install()
|
|
|
|
{
|
|
|
|
if [ -z "$make_install_target" ]; then
|
|
|
|
make_install_target="install prefix=$XBPS_DESTDIR/$pkgname-$version/usr"
|
|
|
|
make_install_target="$make_install_target sysconfdir=$XBPS_DESTDIR/$pkgname-$version/etc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make
|
|
|
|
|
2008-10-22 02:08:46 +00:00
|
|
|
set_build_vars
|
2008-10-01 23:38:12 +00:00
|
|
|
#
|
|
|
|
# Install package via make.
|
|
|
|
#
|
2008-10-21 23:54:48 +00:00
|
|
|
${make_cmd} ${make_install_target} ${make_install_args}
|
2008-09-28 05:12:07 +00:00
|
|
|
if [ "$?" -ne 0 ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "installing $pkgname-$version."
|
2008-10-29 17:33:55 +00:00
|
|
|
exit 1
|
2008-09-28 05:12:07 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-26 05:50:52 +00:00
|
|
|
# Replace libtool archives if requested.
|
|
|
|
[ "$libtool_fixup_la_stage" = "postinstall" ] && \
|
|
|
|
libtool_fixup_la_files "postinstall"
|
|
|
|
|
2008-10-10 02:41:15 +00:00
|
|
|
# Unset make_env vars.
|
|
|
|
for f in ${make_env}; do
|
|
|
|
unset eval ${f%=*}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Unset build vars.
|
|
|
|
unset_build_vars
|
2008-09-28 05:12:07 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Recursive function that founds dependencies in all required
|
|
|
|
# packages.
|
|
|
|
#
|
2008-09-29 15:01:12 +00:00
|
|
|
add_dependency_tolist()
|
2008-09-26 19:59:07 +00:00
|
|
|
{
|
2008-10-04 04:29:49 +00:00
|
|
|
local curpkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local j=
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
[ -z "$curpkg" ] && return 1
|
|
|
|
[ -n "$prev_pkg" ] && curpkg=$prev_pkg
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
if [ "$pkgname" != "${curpkg%-[0-9]*.*}" ]; then
|
|
|
|
reset_tmpl_vars
|
|
|
|
run_file $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
|
|
|
fi
|
|
|
|
|
|
|
|
for j in ${build_depends}; do
|
2008-10-03 12:32:26 +00:00
|
|
|
#
|
2008-09-29 15:01:12 +00:00
|
|
|
# Check if dep already installed.
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
check_installed_pkg $j ${j##[aA-zZ]*-}
|
2008-10-20 14:34:27 +00:00
|
|
|
#
|
|
|
|
# If dep is already installed, check one more time
|
|
|
|
# if all its deps are there and continue.
|
|
|
|
#
|
|
|
|
if [ $? -eq 0 ]; then
|
2008-10-23 15:14:00 +00:00
|
|
|
install_builddeps_required_pkg $j
|
|
|
|
installed_deps_list="$j $installed_deps_list"
|
2008-10-20 14:34:27 +00:00
|
|
|
continue
|
|
|
|
fi
|
2008-10-03 12:32:26 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
deps_list="$j $deps_list"
|
2008-10-20 14:34:27 +00:00
|
|
|
[ -n "$prev_pkg" ] && unset prev_pkg
|
|
|
|
#
|
|
|
|
# Check if dependency needs more deps.
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
check_build_depends_pkg ${j%-[0-9]*.*}
|
2008-10-20 14:34:27 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2008-10-23 15:14:00 +00:00
|
|
|
add_dependency_tolist $j
|
|
|
|
prev_pkg="$j"
|
2008-09-29 15:01:12 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2008-10-04 18:44:56 +00:00
|
|
|
#
|
|
|
|
# Removes duplicate deps in the installed or not installed list.
|
|
|
|
#
|
|
|
|
find_dupdeps_inlist()
|
|
|
|
{
|
|
|
|
local action="$1"
|
|
|
|
local tmp_list=
|
|
|
|
local dup=
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-04 18:44:56 +00:00
|
|
|
|
|
|
|
[ -z "$action" ] && return 1
|
|
|
|
|
|
|
|
case "$action" in
|
|
|
|
installed)
|
|
|
|
list=$installed_deps_list
|
|
|
|
;;
|
|
|
|
notinstalled)
|
|
|
|
list=$deps_list
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
for f in $list; do
|
|
|
|
if [ -z "$tmp_list" ]; then
|
|
|
|
tmp_list="$f"
|
|
|
|
else
|
|
|
|
for i in $tmp_list; do
|
|
|
|
[ "$f" = "$i" ] && dup=yes
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "$dup" ] && tmp_list="$tmp_list $f"
|
|
|
|
unset dup
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
case "$action" in
|
|
|
|
installed)
|
|
|
|
installed_deps_list="$tmp_list"
|
|
|
|
;;
|
|
|
|
notinstalled)
|
|
|
|
deps_list="$tmp_list"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Installs all dependencies required by a package.
|
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
install_dependencies_pkg()
|
2008-09-29 15:01:12 +00:00
|
|
|
{
|
2008-10-04 04:29:49 +00:00
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local i=
|
2008-09-29 15:01:12 +00:00
|
|
|
deps_list=
|
2008-10-04 18:44:56 +00:00
|
|
|
installed_deps_list=
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
[ -z "$pkg" ] && return 1
|
2008-09-29 15:01:12 +00:00
|
|
|
|
|
|
|
doing_deps=true
|
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
echo -n "=> Calculating dependency list for $pkgname-$version... "
|
2008-10-04 18:44:56 +00:00
|
|
|
add_dependency_tolist $pkg
|
|
|
|
find_dupdeps_inlist installed
|
|
|
|
find_dupdeps_inlist notinstalled
|
2008-10-14 05:52:29 +00:00
|
|
|
echo "done."
|
2008-10-04 18:44:56 +00:00
|
|
|
|
2008-10-12 18:05:52 +00:00
|
|
|
[ -z "$deps_list" -a -z "$installed_deps_list" ] && return 0
|
|
|
|
|
2008-10-27 08:15:34 +00:00
|
|
|
msg_normal "Required dependencies for $(basename $pkg):"
|
2008-10-04 18:44:56 +00:00
|
|
|
for i in ${installed_deps_list}; do
|
2008-10-30 05:40:11 +00:00
|
|
|
fpkg="$($XBPS_PKGDB_CMD list|awk '{print $1}'|grep -w ${i%-[0-9]*.*})"
|
2008-10-29 18:59:06 +00:00
|
|
|
echo " $i: found $fpkg."
|
2008-10-04 18:44:56 +00:00
|
|
|
done
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-04 18:44:56 +00:00
|
|
|
for i in ${deps_list}; do
|
2008-10-29 17:33:55 +00:00
|
|
|
echo " $i: not found."
|
2008-10-04 18:44:56 +00:00
|
|
|
done
|
2008-09-29 15:01:12 +00:00
|
|
|
|
|
|
|
for i in ${deps_list}; do
|
2008-09-29 20:32:08 +00:00
|
|
|
# skip dup deps
|
2008-10-12 18:05:52 +00:00
|
|
|
check_installed_pkg $i ${i##[aA-zZ]*-}
|
|
|
|
[ $? -eq 0 ] && continue
|
|
|
|
# continue installing deps
|
2008-10-27 08:15:34 +00:00
|
|
|
msg_normal "Installing $pkg dependency: $i."
|
2008-10-12 18:05:52 +00:00
|
|
|
install_pkg ${i%-[0-9]*.*}
|
2008-09-29 15:01:12 +00:00
|
|
|
done
|
2008-09-29 20:32:08 +00:00
|
|
|
|
2008-10-04 18:44:56 +00:00
|
|
|
unset installed_deps_list
|
2008-10-03 12:32:26 +00:00
|
|
|
unset deps_list
|
2008-09-29 15:01:12 +00:00
|
|
|
}
|
|
|
|
|
2008-10-12 18:05:52 +00:00
|
|
|
install_builddeps_required_pkg()
|
2008-09-29 15:01:12 +00:00
|
|
|
{
|
2008-10-12 18:05:52 +00:00
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local dep=
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-12 18:05:52 +00:00
|
|
|
[ -z "$pkg" ] && return 1
|
2008-10-11 13:48:01 +00:00
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
|
|
|
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
|
|
|
fi
|
|
|
|
|
|
|
|
for dep in ${build_depends}; do
|
2008-10-12 18:05:52 +00:00
|
|
|
check_installed_pkg $dep ${dep##[aA-zZ]*-}
|
|
|
|
if [ $? -ne 0 ]; then
|
2008-10-27 08:15:34 +00:00
|
|
|
msg_normal "Installing $pkg dependency: $dep."
|
2008-10-12 18:05:52 +00:00
|
|
|
install_pkg ${dep%-[0-9]*.*}
|
2008-09-29 15:01:12 +00:00
|
|
|
fi
|
2008-10-12 18:05:52 +00:00
|
|
|
done
|
2008-09-29 15:01:12 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-05 19:23:39 +00:00
|
|
|
# Checks the registered pkgs db file and returns 0 if a pkg that satisfies
|
2008-10-11 13:48:01 +00:00
|
|
|
# the minimal required version is there, or 1 otherwise.
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
check_installed_pkg()
|
2008-09-29 15:01:12 +00:00
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-05 19:23:39 +00:00
|
|
|
local reqver="$2"
|
|
|
|
local iver=
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
[ -z "$pkg" -o -z "$reqver" -o ! -r $XBPS_PKGDB_FPATH ] && return 1
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-13 08:28:51 +00:00
|
|
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
2008-10-23 15:14:00 +00:00
|
|
|
reset_tmpl_vars
|
2008-10-13 08:28:51 +00:00
|
|
|
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
|
|
|
fi
|
2008-10-05 19:23:39 +00:00
|
|
|
|
2008-10-29 21:05:29 +00:00
|
|
|
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
|
|
|
if [ -n "$iver" ]; then
|
|
|
|
$XBPS_CMPVER_CMD $pkgname-$iver $pkgname-$reqver
|
|
|
|
[ $? -eq 0 ] && return 0
|
2008-10-05 19:23:39 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 1
|
2008-09-29 15:01:12 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Checks the build depends db file and returns 0 if pkg has dependencies,
|
|
|
|
# otherwise returns 1.
|
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
check_build_depends_pkg()
|
2008-10-04 04:29:49 +00:00
|
|
|
{
|
|
|
|
local pkg="$1"
|
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
[ -z $pkg ] && return 1
|
2008-10-04 04:29:49 +00:00
|
|
|
|
2008-10-20 14:34:27 +00:00
|
|
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
|
|
|
reset_tmpl_vars
|
|
|
|
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$build_depends" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 1
|
2008-10-04 04:29:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Installs a pkg by reading its build template file.
|
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
install_pkg()
|
2008-09-29 15:01:12 +00:00
|
|
|
{
|
2008-10-04 04:29:49 +00:00
|
|
|
local pkg=
|
2008-10-12 18:05:52 +00:00
|
|
|
local curpkgn="$1"
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn.tmpl"
|
2008-10-12 18:05:52 +00:00
|
|
|
if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then
|
2008-10-28 07:00:03 +00:00
|
|
|
msg_error "cannot find $cur_tmpl template build file."
|
2008-09-28 05:12:07 +00:00
|
|
|
fi
|
2008-09-26 22:19:02 +00:00
|
|
|
|
2008-10-24 08:09:42 +00:00
|
|
|
#
|
2008-10-28 05:02:52 +00:00
|
|
|
# If we are being invoked through the chroot, re-read config file
|
2008-10-24 08:09:42 +00:00
|
|
|
# to get correct stuff.
|
|
|
|
#
|
2008-10-27 09:29:21 +00:00
|
|
|
if [ -n "$in_chroot" ]; then
|
2008-10-24 08:09:42 +00:00
|
|
|
check_config_vars
|
|
|
|
set_defvars
|
|
|
|
fi
|
|
|
|
|
2008-09-29 15:01:12 +00:00
|
|
|
reset_tmpl_vars
|
2008-10-04 04:29:49 +00:00
|
|
|
run_file $cur_tmpl
|
2008-10-12 18:05:52 +00:00
|
|
|
pkg="$curpkgn-$version"
|
2008-09-28 07:57:30 +00:00
|
|
|
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
|
|
|
# If we are the originator package save the path this template in
|
|
|
|
# other var for future use.
|
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
[ -z "$origin_tmpl" ] && origin_tmpl=$pkgname
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
2008-10-30 22:34:05 +00:00
|
|
|
run_file $XBPS_HELPERSDIR/chroot.sh
|
2008-10-29 22:34:05 +00:00
|
|
|
chroot_pkg_handler install $curpkgn
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
# We are going to install a new package.
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
prepare_tmpl
|
2008-09-27 01:17:12 +00:00
|
|
|
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-04 04:29:49 +00:00
|
|
|
# Install dependencies required by this package.
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
if [ -z "$doing_deps" ]; then
|
|
|
|
install_dependencies_pkg $pkg
|
2008-09-29 15:23:23 +00:00
|
|
|
#
|
|
|
|
# At this point all required deps are installed, and
|
|
|
|
# only remaining is the origin template; install it.
|
|
|
|
#
|
2008-10-03 13:41:26 +00:00
|
|
|
unset doing_deps
|
2008-09-29 15:01:12 +00:00
|
|
|
reset_tmpl_vars
|
2008-10-12 18:05:52 +00:00
|
|
|
setup_tmpl $curpkgn
|
2008-09-27 01:17:12 +00:00
|
|
|
fi
|
|
|
|
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
# Fetch, extract, build and install into the destination directory.
|
2008-09-29 15:01:12 +00:00
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
fetch_distfiles
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
2008-10-12 18:05:52 +00:00
|
|
|
extract_distfiles
|
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
2008-10-12 18:05:52 +00:00
|
|
|
configure_src_phase
|
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -f "$XBPS_BUILD_DONE" ]; then
|
2008-10-12 18:05:52 +00:00
|
|
|
build_src_phase
|
|
|
|
fi
|
|
|
|
|
|
|
|
install_src_phase
|
2008-10-02 01:52:21 +00:00
|
|
|
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
2008-10-12 23:11:24 +00:00
|
|
|
# Just register meta-template and exit.
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
|
|
|
if [ "$build_style" = "meta-template" ]; then
|
2008-10-30 06:14:32 +00:00
|
|
|
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
2008-10-23 15:14:00 +00:00
|
|
|
[ $? -eq 0 ] && \
|
2008-10-27 06:42:40 +00:00
|
|
|
msg_normal "Installed meta-template: $pkg." && \
|
2008-10-23 15:14:00 +00:00
|
|
|
return 0
|
|
|
|
return 1
|
2008-10-07 00:55:37 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-12 23:11:24 +00:00
|
|
|
#
|
|
|
|
# Do not stow package if it wasn't requested.
|
|
|
|
#
|
|
|
|
[ -z "$install_destdir_target" ] && stow_pkg $pkg
|
2008-10-12 18:05:52 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 03:50:40 +00:00
|
|
|
#
|
|
|
|
# Lists files installed by a package.
|
|
|
|
#
|
|
|
|
list_pkg_files()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-28 05:02:52 +00:00
|
|
|
local f="$XBPS_DESTDIR/$pkg/.xbps-filelist"
|
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z $pkg ] && msg_error "unexistent package, aborting."
|
2008-10-13 03:50:40 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -d "$XBPS_DESTDIR/$pkg" ]; then
|
2008-10-29 02:20:14 +00:00
|
|
|
msg_error "cannot find $pkg in $XBPS_DESTDIR."
|
2008-10-13 03:50:40 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-28 05:02:52 +00:00
|
|
|
cat $f|sort -u
|
2008-10-13 03:50:40 +00:00
|
|
|
}
|
|
|
|
|
2008-10-04 04:29:49 +00:00
|
|
|
#
|
|
|
|
# Removes a currently installed package (unstow + removed from destdir).
|
|
|
|
#
|
2008-10-12 18:05:52 +00:00
|
|
|
remove_pkg()
|
2008-09-28 09:41:26 +00:00
|
|
|
{
|
|
|
|
local pkg="$1"
|
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z $pkg ] && msg_error "unexistent package, aborting."
|
2008-09-28 09:41:26 +00:00
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then
|
2008-10-29 02:20:14 +00:00
|
|
|
msg_error "cannot find template build file."
|
2008-10-04 04:29:49 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
2008-10-04 04:29:49 +00:00
|
|
|
|
2008-10-07 00:55:37 +00:00
|
|
|
#
|
|
|
|
# If it's a meta-template, just unregister it from the db.
|
|
|
|
#
|
|
|
|
if [ "$build_style" = "meta-template" ]; then
|
2008-10-30 08:44:02 +00:00
|
|
|
$XBPS_PKGDB_CMD unregister $pkgname $version
|
2008-10-29 17:33:55 +00:00
|
|
|
[ $? -eq 0 ] && \
|
|
|
|
echo "=> Removed meta-template: $pkg."
|
2008-10-07 00:55:37 +00:00
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
|
2008-10-13 05:32:05 +00:00
|
|
|
if [ ! -d "$XBPS_DESTDIR/$pkg-$version" ]; then
|
2008-10-29 02:20:14 +00:00
|
|
|
msg_error "cannot find package on $XBPS_DESTDIR."
|
2008-09-28 09:41:26 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-12 18:05:52 +00:00
|
|
|
unstow_pkg $pkg
|
2008-10-23 15:14:00 +00:00
|
|
|
rm -rf $XBPS_DESTDIR/$pkg-$version
|
2008-10-12 18:05:52 +00:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
# Stows a package, i.e copy files from destdir into masterdir.
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
|
|
|
stow_pkg()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local i=
|
2008-10-28 05:02:52 +00:00
|
|
|
local flist="$XBPS_BUILDDIR/.xbps-filelist-$pkgname-$version"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
[ -z "$pkg" ] && return 2
|
|
|
|
|
|
|
|
if [ -n "$stow_flag" ]; then
|
2008-10-13 05:32:05 +00:00
|
|
|
pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl
|
2008-10-13 08:28:51 +00:00
|
|
|
if [ "$pkgname" != "$pkg" ]; then
|
|
|
|
run_file $pkg
|
|
|
|
fi
|
2008-10-12 18:05:52 +00:00
|
|
|
pkg=$pkgname-$version
|
|
|
|
#
|
|
|
|
# You cannot stow a meta-template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
|
|
|
fi
|
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
|
2008-10-28 05:02:52 +00:00
|
|
|
find . > $flist
|
2008-10-29 02:20:14 +00:00
|
|
|
sed -i -e "s|^.$||g;s|^./||g;s|.xbps-filelist||g;/^$/d" $flist
|
2008-10-24 06:49:49 +00:00
|
|
|
cp -ar . $XBPS_MASTERDIR
|
2008-10-28 05:02:52 +00:00
|
|
|
mv -f $flist $XBPS_DESTDIR/$pkgname-$version/.xbps-filelist
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-30 05:40:11 +00:00
|
|
|
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
2008-10-29 21:53:26 +00:00
|
|
|
[ $? -ne 0 ] && exit 1
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Run template postinstall helpers if requested.
|
|
|
|
#
|
|
|
|
if [ "$pkgname" != "${pkg%%-$version}" ]; then
|
2008-10-13 05:32:05 +00:00
|
|
|
run_file $XBPS_TEMPLATESDIR/${pkg%%-$version}.tmpl
|
2008-10-12 18:05:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
for i in ${postinstall_helpers}; do
|
2008-10-30 22:34:05 +00:00
|
|
|
local pihf="$XBPS_HELPERSDIR/$i"
|
2008-10-12 18:05:52 +00:00
|
|
|
[ -f "$pihf" ] && . $pihf
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
2008-10-23 15:14:00 +00:00
|
|
|
# Unstow a package, i.e removes its files from masterdir.
|
2008-10-12 18:05:52 +00:00
|
|
|
#
|
|
|
|
unstow_pkg()
|
|
|
|
{
|
|
|
|
local pkg="$1"
|
2008-10-23 15:14:00 +00:00
|
|
|
local f=
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z $pkg ] && msg_error "template wasn't specified?"
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-13 08:28:51 +00:00
|
|
|
if [ "$pkgname" != "$pkg" ]; then
|
|
|
|
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
|
|
|
fi
|
2008-10-12 18:05:52 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# You cannot unstow a meta-template.
|
|
|
|
#
|
|
|
|
[ "$build_style" = "meta-template" ] && return 0
|
|
|
|
|
2008-10-29 17:33:55 +00:00
|
|
|
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
|
|
|
|
[ ! -f .xbps-filelist ] && exit 1
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
for f in $(cat .xbps-filelist|sort -ur); do
|
2008-10-27 07:44:41 +00:00
|
|
|
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
|
|
|
rm $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
2008-10-29 02:20:14 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "Removing file: $f"
|
2008-10-29 02:20:14 +00:00
|
|
|
fi
|
2008-10-27 07:44:41 +00:00
|
|
|
fi
|
2008-10-23 15:14:00 +00:00
|
|
|
done
|
2008-10-21 23:54:48 +00:00
|
|
|
|
2008-10-23 15:14:00 +00:00
|
|
|
for f in $(cat .xbps-filelist|sort -ur); do
|
2008-10-27 07:44:41 +00:00
|
|
|
if [ -d $XBPS_MASTERDIR/$f ]; then
|
|
|
|
rmdir $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
2008-10-29 02:20:14 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2008-10-29 17:33:55 +00:00
|
|
|
echo "Removing directory: $f"
|
2008-10-29 02:20:14 +00:00
|
|
|
fi
|
2008-10-27 07:44:41 +00:00
|
|
|
fi
|
2008-10-23 15:14:00 +00:00
|
|
|
done
|
2008-10-12 18:05:52 +00:00
|
|
|
|
2008-10-29 21:53:26 +00:00
|
|
|
$XBPS_PKGDB_CMD unregister $pkgname $version
|
|
|
|
return $?
|
2008-09-28 09:41:26 +00:00
|
|
|
}
|
|
|
|
|
2008-09-26 21:23:41 +00:00
|
|
|
#
|
|
|
|
# main()
|
|
|
|
#
|
2008-10-29 17:33:55 +00:00
|
|
|
while getopts "Cc:" opt; do
|
2008-10-23 15:14:00 +00:00
|
|
|
case $opt in
|
2008-11-03 07:38:38 +00:00
|
|
|
C) dontrm_builddir=yes;;
|
|
|
|
c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";;
|
|
|
|
--) shift; break;;
|
2008-09-26 19:59:07 +00:00
|
|
|
esac
|
|
|
|
done
|
2008-10-23 15:14:00 +00:00
|
|
|
shift $(($OPTIND - 1))
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-11-03 10:01:42 +00:00
|
|
|
[ $# -eq 0 -o $# -gt 2 ] && usage
|
2008-09-26 19:59:07 +00:00
|
|
|
|
2008-09-27 01:17:12 +00:00
|
|
|
target="$1"
|
|
|
|
if [ -z "$target" ]; then
|
2008-10-29 22:34:05 +00:00
|
|
|
echo "=> ERROR: missing target."
|
2008-09-26 19:59:07 +00:00
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2008-09-30 20:48:52 +00:00
|
|
|
#
|
|
|
|
# Check configuration vars before anyting else, and set defaults vars.
|
|
|
|
#
|
2008-09-29 15:01:12 +00:00
|
|
|
check_config_vars
|
2008-09-30 20:48:52 +00:00
|
|
|
set_defvars
|
2008-09-29 15:01:12 +00:00
|
|
|
|
2008-09-26 19:59:07 +00:00
|
|
|
# Main switch
|
2008-09-27 01:17:12 +00:00
|
|
|
case "$target" in
|
2008-10-12 18:05:52 +00:00
|
|
|
build)
|
|
|
|
setup_tmpl $2
|
2008-10-27 06:42:40 +00:00
|
|
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
2008-10-30 22:34:05 +00:00
|
|
|
run_file $XBPS_HELPERSDIR/chroot.sh
|
2008-10-28 06:17:35 +00:00
|
|
|
chroot_pkg_handler build $2
|
2008-10-27 06:42:40 +00:00
|
|
|
else
|
2008-10-27 10:19:37 +00:00
|
|
|
fetch_distfiles $2
|
|
|
|
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
|
|
|
extract_distfiles $2
|
|
|
|
fi
|
|
|
|
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
|
|
|
configure_src_phase $2
|
|
|
|
fi
|
2008-10-27 06:42:40 +00:00
|
|
|
build_src_phase $2
|
2008-10-12 18:05:52 +00:00
|
|
|
fi
|
|
|
|
;;
|
2008-10-24 07:44:51 +00:00
|
|
|
chroot)
|
2008-10-30 22:34:05 +00:00
|
|
|
run_file $XBPS_HELPERSDIR/chroot.sh
|
2008-10-28 06:17:35 +00:00
|
|
|
chroot_pkg_handler chroot dummy
|
2008-10-24 07:44:51 +00:00
|
|
|
;;
|
2008-10-12 18:05:52 +00:00
|
|
|
configure)
|
|
|
|
setup_tmpl $2
|
2008-10-27 06:42:40 +00:00
|
|
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
2008-10-30 22:34:05 +00:00
|
|
|
run_file $XBPS_HELPERSDIR/chroot.sh
|
2008-10-28 06:17:35 +00:00
|
|
|
chroot_pkg_handler configure $2
|
2008-10-27 06:42:40 +00:00
|
|
|
else
|
2008-10-27 10:19:37 +00:00
|
|
|
fetch_distfiles $2
|
|
|
|
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
|
|
|
extract_distfiles $2
|
|
|
|
fi
|
2008-10-27 06:42:40 +00:00
|
|
|
configure_src_phase $2
|
|
|
|
fi
|
2008-10-12 18:05:52 +00:00
|
|
|
;;
|
|
|
|
extract)
|
|
|
|
setup_tmpl $2
|
|
|
|
fetch_distfiles $2
|
|
|
|
extract_distfiles $2
|
|
|
|
;;
|
|
|
|
fetch)
|
|
|
|
setup_tmpl $2
|
|
|
|
fetch_distfiles $2
|
|
|
|
;;
|
2008-09-26 19:59:07 +00:00
|
|
|
info)
|
2008-10-12 18:05:52 +00:00
|
|
|
setup_tmpl $2
|
|
|
|
info_tmpl $2
|
2008-09-28 05:12:07 +00:00
|
|
|
;;
|
2008-10-12 23:11:24 +00:00
|
|
|
install-destdir)
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$2" ] && msg_error "missing package name after target."
|
2008-10-12 23:11:24 +00:00
|
|
|
install_destdir_target=yes
|
2008-10-27 09:29:21 +00:00
|
|
|
install_pkg $2
|
2008-10-12 23:11:24 +00:00
|
|
|
;;
|
2008-09-28 09:41:26 +00:00
|
|
|
install)
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$2" ] && msg_error "missing package name after target."
|
2008-10-27 09:29:21 +00:00
|
|
|
install_pkg $2
|
2008-09-28 09:41:26 +00:00
|
|
|
;;
|
2008-09-29 22:45:25 +00:00
|
|
|
list)
|
2008-10-30 06:18:21 +00:00
|
|
|
$XBPS_PKGDB_CMD list
|
2008-09-29 22:45:25 +00:00
|
|
|
;;
|
2008-10-13 03:50:40 +00:00
|
|
|
listfiles)
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$2" ] && msg_error "missing package after target."
|
2008-10-13 03:50:40 +00:00
|
|
|
list_pkg_files $2
|
|
|
|
;;
|
2008-09-28 09:41:26 +00:00
|
|
|
remove)
|
2008-10-29 22:34:05 +00:00
|
|
|
[ -z "$2" ] && msg_error "missing package name after target."
|
2008-10-12 18:05:52 +00:00
|
|
|
remove_pkg $2
|
2008-09-28 09:41:26 +00:00
|
|
|
;;
|
2008-09-28 05:12:07 +00:00
|
|
|
stow)
|
2008-10-04 04:29:49 +00:00
|
|
|
stow_flag=yes
|
2008-10-12 18:05:52 +00:00
|
|
|
setup_tmpl $2
|
|
|
|
stow_pkg $2
|
2008-09-28 05:12:07 +00:00
|
|
|
;;
|
|
|
|
unstow)
|
2008-10-12 18:05:52 +00:00
|
|
|
setup_tmpl $2
|
|
|
|
unstow_pkg $2
|
2008-09-26 19:59:07 +00:00
|
|
|
;;
|
|
|
|
*)
|
2008-10-29 22:34:05 +00:00
|
|
|
echo "=> ERROR: invalid target: $target."
|
2008-09-26 19:59:07 +00:00
|
|
|
usage
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Agur
|
2008-10-29 17:33:55 +00:00
|
|
|
exit 0
|