gettext: Solve an incompatibility with newer MinGW runtimes.
[minipack.git] / mpk
blobf9bf77b31bcb303cbc641a621225c813b2b4b2cd
1 #! /bin/sh
3 # mpk - top level, user visible script.
4 # Copyright (C) 2008 Cesar Strauss
6 # This file is part of Minipack - an automated build tool.
8 # Minipack is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # Minipack is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Minipack. If not, see <http://www.gnu.org/licenses/>.
21 bindir=$(dirname $0)
22 prog=$(basename $0)
23 case $bindir in
24 /*) ;;
25 *) bindir=$PWD/$bindir;;
26 esac
27 mpk=$bindir/$prog
28 prefix=$(cd $bindir && pwd)
29 tooldir=$prefix/tools
30 recipedir=$prefix/recipes
31 patchdir=$prefix/patches
33 MPK_VERSION=1.1.0
35 export PATH=$tooldir:$PATH
37 test -f ~/minipack.conf && . ~/minipack.conf
39 cwd=$PWD
40 topdir=$cwd
41 until [ "$topdir" = "/" ]; do
42 if [ -f $topdir/minipack.conf ]; then
43 break;
45 cd ..
46 topdir=$PWD
47 done
48 cd $cwd
50 if [ "$topdir" = "/" ]; then
51 echo Warning: no minipack.conf found.
52 topdir=$cwd
55 builddir=$topdir/build
56 resultdir=$topdir/result
57 sourcedir=$topdir/sources
59 test -f $topdir/minipack.conf && . $topdir/minipack.conf
61 # Setup environment variables
62 export PATH=$resultdir/bin:$PATH
63 export ACLOCAL="aclocal -I $resultdir/share/aclocal"
64 export ACLOCAL_FLAGS="-I $resultdir/share/aclocal"
65 export PKG_CONFIG_LIBDIR=$resultdir/lib/pkgconfig
67 get_recipe_name()
69 name=$recipedir/$1.recipe
70 if [ ! -f $name ]; then
71 echo >&2 "Recipe for \"$1\" not found."
72 exit 1
74 echo $name
77 setup_configure_options()
79 pkg_configure_opt=$configure_opt
80 pkg_configure_opt="$pkg_configure_opt --prefix=$resultdir"
82 if [ -n "$host" ]; then
83 pkg_configure_opt="$pkg_configure_opt --host=$host"
85 if [ -n "$build" ]; then
86 pkg_configure_opt="$pkg_configure_opt --build=$build"
89 if [ -z "$configure_no_more_flags" ]; then
90 pkg_configure_opt="$pkg_configure_opt CPPFLAGS=-I$resultdir/include"
91 pkg_configure_opt="$pkg_configure_opt LDFLAGS=-L$resultdir/lib"
95 if [ -n "$1" ]; then
96 cmd=$1
97 shift
98 else
99 echo "$prog: missing argument."
100 cmd=help
103 case $cmd in
104 --version)
105 cmd=version ;;
106 --help)
107 cmd=help ;;
108 esac
109 tool=$tooldir/mpk-$cmd
110 if [ -f $tool ]; then
111 . $tool "$@"
112 else
113 echo $prog: Invalid command: $cmd