hid/*: layer_sort() Only copper layers participate in the layer stack
[geda-pcb/pcjc2.git] / w32 / mpk
blob1652bc0df30e5e4de31958b22fa4c57c80e98ff4
1 #! /bin/sh
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/>.
19 bindir=$(dirname $0)
20 prog=$(basename $0)
21 case $bindir in
22 /*) ;;
23 *) bindir=$PWD/$bindir;;
24 esac
25 mpk=$bindir/$prog
26 prefix=$(cd $bindir && pwd)
27 tooldir=$prefix/tools
28 recipedir=$prefix/recipes
29 patchdir=$prefix/patches
31 MPK_VERSION=1.1.0
33 export PATH=$tooldir:$PATH
35 test -f ~/minipack.conf && . ~/minipack.conf
37 cwd=$PWD
38 topdir=$cwd
39 until [ "$topdir" = "/" ]; do
40 if [ -f $topdir/minipack.conf ]; then
41 break;
43 cd ..
44 topdir=$PWD
45 done
46 cd $cwd
48 if [ "$topdir" = "/" ]; then
49 echo Warning: no minipack.conf found.
50 topdir=$cwd
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.
59 export resultdir
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
69 get_recipe_name()
71 name=$recipedir/$1.recipe
72 if [ ! -f $name ]; then
73 echo >&2 "Recipe for \"$1\" not found."
74 exit 1
76 echo $name
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\""
110 if [ -n "$1" ]; then
111 cmd=$1
112 shift
113 else
114 echo "$prog: missing argument."
115 cmd=help
118 case $cmd in
119 --version)
120 cmd=version ;;
121 --help)
122 cmd=help ;;
123 esac
124 tool=$tooldir/mpk-$cmd
125 if [ -f $tool ]; then
126 . $tool "$@"
127 else
128 echo $prog: Invalid command: $cmd