Bump to gettext 0.18
[minipack.git] / tools / mpk-source
blobae46aec35db5734468c998f6d0ef593280db962e
1 # mpk-source - downloads source code.
2 # Copyright (C) 2008 Cesar Strauss
4 # This file is part of Minipack - an automated build tool.
6 # Minipack 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 3 of the License, or
9 # (at your option) any later version.
11 # Minipack is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Minipack. If not, see <http://www.gnu.org/licenses/>.
19 get_source()
21   src_get_source
24 src_get_source()
26   do_get_source
29 do_get_source()
31   : ${source_package_type:=tar.gz}
32   : ${source:=$name-$version.$source_package_type}
33   : ${gnu_mirror:=http://ftp.gnu.org/pub/gnu}
35   if [ -z "$force" -a -e $sourcedir/$source ]; then
36     exit 0
37   fi
39   if [ -n "$origin" ]; then
40     case $origin in
41       gnu) pkg_download="$gnu_mirror/$name/$source";;
42       sf) pkg_download="http://downloads.sourceforge.net/sourceforge/$name/$source";;
43       *) echo >&2 "$name: Unknown origin."; exit 1;;
44     esac
45   fi
46   
47   if [ -n "$download" ]; then
48     pkg_download=$download/$source
49   fi
51   if [ -z "$pkg_download" ]; then
52     echo >&2 "$name: download location not found."
53     exit 1
54   fi
56   mkdir -p $sourcedir/partial
57   cd $sourcedir/partial
58   echo Downloading $name from $pkg_download ...
59   wget -c $pkg_download
61   if [ $? != 0 ]; then
62     echo >&2 "$(basename $0) source: Failed to download $name"
63     exit 1
64   fi
65   
66   mv $sourcedir/partial/$source $sourcedir
69 case $1 in
70   -f|--force) force=yes; shift;;
71   -*) echo "$(basename $0) source: unrecognized option"; exit 1;;
72 esac
74 pkg=$1
76 if [ -z "$pkg" ]; then
77   echo "Usage: $(basename $0) source package-name ..."
78   exit 1
81 recipe=$(get_recipe_name $pkg) || exit 1
83 . $recipe
85 get_source