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/>.
25 *) bindir
=$PWD/$bindir;;
28 prefix
=$
(cd $bindir && pwd)
30 recipedir
=$prefix/recipes
31 patchdir
=$prefix/patches
35 export PATH
=$tooldir:$PATH
37 test -f ~
/minipack.conf
&& . ~
/minipack.conf
41 until [ "$topdir" = "/" ]; do
42 if [ -f $topdir/minipack.conf
]; then
50 if [ "$topdir" = "/" ]; then
51 echo Warning
: no minipack.conf found.
55 builddir
=$topdir/build
56 resultdir
=$topdir/result
57 sourcedir
=$topdir/sources
58 local_tooldir
=$resultdir/lib
/mpk
/tools
60 # Export resultdir in case we need to call our newly built tools.
63 test -f $topdir/minipack.conf
&& .
$topdir/minipack.conf
65 # Setup environment variables
66 export PATH
=$local_tooldir:$PATH
67 export ACLOCAL
="aclocal -I $resultdir/share/aclocal"
68 export ACLOCAL_FLAGS
="-I $resultdir/share/aclocal"
69 export PKG_CONFIG_LIBDIR
=$resultdir/lib
/pkgconfig
73 name
=$recipedir/$1.recipe
74 if [ ! -f $name ]; then
75 echo >&2 "Recipe for \"$1\" not found."
81 setup_configure_options
()
83 pkg_configure_opt
="$def_configure_opt $configure_opt"
84 pkg_configure_opt
="$pkg_configure_opt --prefix=$resultdir"
86 if [ -n "$host" ]; then
87 pkg_configure_opt
="$pkg_configure_opt --host=$host"
89 if [ -n "$build" ]; then
90 pkg_configure_opt
="$pkg_configure_opt --build=$build"
93 # Local compiler/linker search path
94 CPPFLAGS
="$CPPFLAGS -I$resultdir/include"
95 LDFLAGS
="$LDFLAGS -L$resultdir/lib"
97 test -n "$configure_no_more_flags" && return
99 # Add search paths to the configure line.
100 pkg_configure_opt
="$pkg_configure_opt CPPFLAGS=\"$CPPFLAGS\""
101 pkg_configure_opt
="$pkg_configure_opt LDFLAGS=\"$LDFLAGS\""
103 # Add extra flags to the configure line, if present.
104 if [ -n "$CFLAGS" ]; then
105 pkg_configure_opt
="$pkg_configure_opt CFLAGS=\"$CFLAGS\""
107 if [ -n "$CXXFLAGS" ]; then
108 pkg_configure_opt
="$pkg_configure_opt CXXFLAGS=\"$CXXFLAGS\""
116 echo "$prog: missing argument."
126 tool
=$tooldir/mpk-
$cmd
127 if [ -f $tool ]; then
130 echo $prog: Invalid
command: $cmd