3 # mpk - top level, user visible script.
4 # Copyright (C) 2008,2010 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,
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/>.
23 *) bindir
=$PWD/$bindir;;
26 prefix
=$
(cd $bindir && pwd)
28 recipedir
=$prefix/recipes
29 patchdir
=$prefix/patches
33 export PATH
=$tooldir:$PATH
35 test -f ~
/minipack.conf
&& . ~
/minipack.conf
39 until [ "$topdir" = "/" ]; do
40 if [ -f $topdir/minipack.conf
]; then
48 if [ "$topdir" = "/" ]; then
49 echo Warning
: no minipack.conf found.
53 builddir
=$topdir/build
54 resultdir
=$topdir/result
55 sourcedir
=$topdir/sources
56 local_tooldir
=$resultdir/lib
/mpk
/tools
58 # Export resultdir in case we need to call our newly built tools.
61 test -f $topdir/minipack.conf
&& .
$topdir/minipack.conf
63 # Setup environment variables
64 export PATH
=$local_tooldir:$PATH
65 export ACLOCAL
="aclocal -I $resultdir/share/aclocal"
66 export ACLOCAL_FLAGS
="-I $resultdir/share/aclocal"
67 export PKG_CONFIG_LIBDIR
=$resultdir/lib
/pkgconfig
71 name
=$recipedir/$1.recipe
72 if [ ! -f $name ]; then
73 echo >&2 "Recipe for \"$1\" not found."
79 setup_configure_options
()
81 pkg_configure_opt
="$def_configure_opt $configure_opt"
82 pkg_configure_opt
="$pkg_configure_opt --prefix=$resultdir"
84 if [ -n "$host" ]; then
85 pkg_configure_opt
="$pkg_configure_opt --host=$host"
87 if [ -n "$build" ]; then
88 pkg_configure_opt
="$pkg_configure_opt --build=$build"
91 # Local compiler/linker search path
92 CPPFLAGS
="$CPPFLAGS -I$resultdir/include"
93 LDFLAGS
="$LDFLAGS -L$resultdir/lib"
95 test -n "$configure_no_more_flags" && return
97 # Add search paths to the configure line.
98 pkg_configure_opt
="$pkg_configure_opt CPPFLAGS=\"$CPPFLAGS\""
99 pkg_configure_opt
="$pkg_configure_opt LDFLAGS=\"$LDFLAGS\""
101 # Add extra flags to the configure line, if present.
102 if [ -n "$CFLAGS" ]; then
103 pkg_configure_opt
="$pkg_configure_opt CFLAGS=\"$CFLAGS\""
105 if [ -n "$CXXFLAGS" ]; then
106 pkg_configure_opt
="$pkg_configure_opt CXXFLAGS=\"$CXXFLAGS\""
114 echo "$prog: missing argument."
124 tool
=$tooldir/mpk-
$cmd
125 if [ -f $tool ]; then
128 echo $prog: Invalid
command: $cmd