dvitomp fix from Akira
[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 ../../src/texk/configure --datadir=$DATADIR || exit 1 
54
55 # make the kpathsea library
56 (cd kpathsea;  $MAKE ../kpathsea/libkpathsea.la) || exit 1
57
58 # make ctangle
59 mkdir web2c/cwebdir
60 cd web2c/cwebdir
61 (cp ../../../../src/texk/web2c/cwebdir/* .; $MAKE )|| exit 1 
62 cd ../..
63
64 CTANGLE=../cwebdir/ctangle 
65 export CTANGLE 
66
67 # make the library
68 mkdir web2c/mpdir
69 cd web2c/mpdir
70 (../../../../src/texk/web2c/mpdir/configure --enable-lua=yes; $MAKE )|| exit 1 
71
72 # go back
73 cd ../../../..
74 # show the results
75 ls -l build/texk/web2c/mpdir/mpost
76 ls -l build/texk/web2c/mpdir/.libs/mplib.so