1 # mpk-unpack - unpacks source code
2 # This file is part of Minipack - an automated build tool.
4 # Copyright (C) 2008 Cesar Strauss
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 : ${source_package_type:=tar.gz}
23 : ${source:=$name-$version.$source_package_type}
24 : ${top_srcdir:=$name-$version}
26 buildroot=$builddir/$name-$version-$release
28 if [ -d $buildroot/$top_srcdir ]; then
32 sourcename=$sourcedir/$source
33 if [ ! -e $sourcename ]; then
35 if [ ! -e $sourcename ]; then
36 echo >&2 "$(basename $0) unpack: Could not find source for $pkg"
44 case $source_package_type in
46 tar -xf $sourcename ;;
52 echo >&2 "$(basename $0) unpack: Failed to unpack $sourcename"
58 pkg_patchdir=$patchdir/$name
60 if [ -d $pkg_patchdir ]; then
61 patches=`find $pkg_patchdir -name '*.patch' | sort`
65 echo >&2 "$(basename $0) unpack: Failed apply patches for $sourcename"
71 export ACLOCAL="aclocal -I $resultdir/share/aclocal"
76 echo >&2 "$(basename $0) unpack: Failed to prepare build directory for $sourcename"
94 if [ -z "$pkg" ]; then
95 echo "Usage: $(basename $0) unpack package-name ..."
99 recipe=$(get_recipe_name $pkg) || exit 1