clojure-lsp: update to 2024.08.05.
[void-pkg.git] / common / xbps-src / libexec / xbps-src-doextract.sh
blob8b1633ae77ea6c31040c858c67a847f1c25ccb1d
1 #!/bin/bash
3 # vim: set ts=4 sw=4 et:
5 # Passed arguments:
6 # $1 - pkgname [REQUIRED]
7 # $2 - cross target [OPTIONAL]
9 if [ $# -lt 1 -o $# -gt 2 ]; then
10 echo "${0##*/}: invalid number of arguments: pkgname [cross-target]"
11 exit 1
14 PKGNAME="$1"
15 XBPS_CROSS_BUILD="$2"
17 for f in $XBPS_SHUTILSDIR/*.sh; do
18 . $f
19 done
21 setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
23 for f in $XBPS_COMMONDIR/environment/extract/*.sh; do
24 source_file "$f"
25 done
27 XBPS_EXTRACT_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_extract_done"
29 if [ -f $XBPS_EXTRACT_DONE ]; then
30 exit 0
33 # Run pre-extract hooks
34 run_pkg_hooks pre-extract
36 # If template defines pre_extract(), use it.
37 if declare -f pre_extract >/dev/null; then
38 run_func pre_extract
41 # If template defines do_extract() use it rather than the hooks.
42 if declare -f do_extract >/dev/null; then
43 [ ! -d "$wrksrc" ] && mkdir -p "$wrksrc"
44 cd "$wrksrc"
45 run_func do_extract
46 else
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"
51 . $XBPS_BUILDSTYLEDIR/${build_style}.sh
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"
63 [ -d "$wrksrc" ] && cd "$wrksrc"
65 # If template defines post_extract(), use it.
66 if declare -f post_extract >/dev/null; then
67 run_func post_extract
70 # Run post-extract hooks
71 run_pkg_hooks post-extract
73 touch -f $XBPS_EXTRACT_DONE
75 exit 0