xbps-src-doextract.sh (1697B)
1#!/bin/bash 2# 3# vim: set ts=4 sw=4 et: 4# 5# Passed arguments: 6# $1 - pkgname [REQUIRED] 7# $2 - cross target [OPTIONAL] 8 9if [ $# -lt 1 -o $# -gt 2 ]; then 10 echo "${0##*/}: invalid number of arguments: pkgname [cross-target]" 11 exit 1 12fi 13 14PKGNAME="$1" 15XBPS_CROSS_BUILD="$2" 16 17for f in $XBPS_SHUTILSDIR/*.sh; do 18 . $f 19done 20 21setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD 22 23for f in $XBPS_COMMONDIR/environment/extract/*.sh; do 24 source_file "$f" 25done 26 27XBPS_EXTRACT_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_extract_done" 28 29if [ -f $XBPS_EXTRACT_DONE ]; then 30 exit 0 31fi 32 33# Run pre-extract hooks 34run_pkg_hooks pre-extract 35 36# If template defines pre_extract(), use it. 37if declare -f pre_extract >/dev/null; then 38 run_func pre_extract 39fi 40 41# If template defines do_extract() use it rather than the hooks. 42if declare -f do_extract >/dev/null; then 43 [ ! -d "$wrksrc" ] && mkdir -p "$wrksrc" 44 cd "$wrksrc" 45 run_func do_extract 46else 47 if [ -n "$build_style" ]; then 48 if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then 49 msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n" 50 fi 51 . $XBPS_BUILDSTYLEDIR/${build_style}.sh 52 fi 53 # If the build_style script declares do_extract(), use it rather than hooks. 54 if declare -f do_extract >/dev/null; then 55 run_func do_extract 56 else 57 # Run do-extract hooks 58 run_pkg_hooks "do-extract" 59 fi 60fi 61 62 63[ -d "$wrksrc" ] && cd "$wrksrc" 64 65# If template defines post_extract(), use it. 66if declare -f post_extract >/dev/null; then 67 run_func post_extract 68fi 69 70# Run post-extract hooks 71run_pkg_hooks post-extract 72 73touch -f $XBPS_EXTRACT_DONE 74 75exit 0