More copyrights
[mplib] / build.sh
1 #!/usr/bin/env bash
2 # $Id$
3 #
4 # Copyright 2008 Taco Hoekwater.
5 #
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.
10 #
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.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>
18 #
19 #
20 # OME 20070912: Taken from luatex build.sh:
21 # try to find gnu make; we need it
22 MAKE=make;
23 if make -v 2>&1| grep "GNU Make" >/dev/null
24 then 
25   echo "Your make is a GNU-make; I will use that"
26 elif gmake -v >/dev/null 2>&1
27 then
28   MAKE=gmake;
29   echo "You have a GNU-make installed as gmake; I will use that"
30 else
31   echo "I can't find a GNU-make; I'll try to use make and hope that works." 
32   echo "If it doesn't, please install GNU-make."
33 fi
34
35 # this deletes all previous builds. 
36 # comment out the rm and mkdir if you want to keep them (and uncomment and
37 # change the $MAKE distclean below)
38 rm -rf build
39 mkdir build
40 cd build
41 # clean up (uncomment the next line if you have commented out the rm and
42 # mkdir above)
43 # $MAKE distclean;
44 #
45 # guess the correct datadir
46
47 DATADIR=`which kpsewhich > /dev/null && kpsewhich texmf.cnf | sed 's%/texmf.cnf$%%' | sed 's%/web2c$%%' | sed 's%/texmf[^\/]*$%%'`
48 if test -z "$DATADIR"; then 
49   DATADIR=/usr/share
50 fi
51 mkdir texk
52 cd texk
53 # do a configure without all the things we don't need
54 ../../src/texk/configure --datadir=$DATADIR || exit 1 
55
56 # make the kpathsea library
57 (cd kpathsea;  $MAKE ../kpathsea/libkpathsea.la) || exit 1
58
59 # make the library
60 mkdir web2c/mpdir
61 cd web2c/mpdir
62 (../../../../src/texk/web2c/mpdir/configure; $MAKE )|| exit 1 
63
64 # strip them
65 #STRIP=strip
66 # $STRIP web2c/mpdir/newmpost
67 # go back
68 cd ../../../..
69 # show the results
70 ls -l build/texk/web2c/mpdir/mpost