hid/hidint.h: Remove header guard check, it appears not to be required
[geda-pcb/pcjc2.git] / w32 / tools / mpk-build
blobd90f658176bf402421ba4630f0c5a59406a367e0
1 # mpk-build - Build packages.
2 # Copyright (C) 2008,2010 Cesar Strauss
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 build_source()
19   : ${top_srcdir:=$name-$version}
21   : ${pkg_builddir:=$builddir/$name-$version-$release/$top_srcdir}
23   if [ ! -d $pkg_builddir ]; then
24     $mpk unpack $pkg
25     if [ $? != 0 -o ! -d $pkg_builddir ]; then
26       echo >&2 "$(basename $0) build: Could not unpack $pkg"
27       exit 1
28     fi
29   fi
30   
31   cd $pkg_builddir
32   
33   src_build && success
36 src_build()
38   do_build
41 src_configure()
43   do_configure
46 src_compile()
48   do_compile
51 src_install()
53   do_install
56 do_build()
58   src_configure || fail
59   src_compile || fail
60   src_install || fail
63 do_configure()
65   setup_configure_options
67   echo "Configuring $pkg..."
68   mkdir -p ../logs
69   echo "$pkg_configure_opt" | xargs ./configure > ../logs/configure.log
72 do_compile()
74   echo "Compiling $pkg..."
75   mkdir -p ../logs
76   make $default_make_opts $make_opts > ../logs/make.log
79 do_install()
81   echo "Installing $pkg..."
82   mkdir -p ../logs
83   make install > ../logs/install.log
86 fail()
88   echo
89   echo "================="
90   echo "$pkg:"
91   echo "  Build failed."
92   echo "================="
93   echo
94   exit 1
97 success()
99   echo
100   echo "===================="
101   echo "$pkg:"
102   echo "  Build succeeded."
103   echo "===================="
104   echo
107 if [ -z "$1" ]; then
108   echo "Usage: $(basename $0) build package-name"
109   exit 1
111 pkg=$1
113 if [ -z "$pkg" ]; then
114   echo "Usage: $(basename $0) build package-name ..."
115   exit 1
118 recipe=$(get_recipe_name $pkg) || exit 1
120 . $recipe
122 build_source