slightly larger test for makempx
[mplib] / build.sh
1 #!/usr/bin/env bash
2 # $Id: Build,v 1.3 2005/05/08 15:55:26 taco Exp $
3
4 # builds new metapost binary. 
5 # this is a temporary hack, it simply copies the source dir to the build dir.
6 # no mpware support yet, either
7
8 # OME 20070912: Taken from luatex build.sh:
9 # try to find gnu make; we need it
10 MAKE=make;
11 if make -v 2>&1| grep "GNU Make" >/dev/null
12 then 
13   echo "Your make is a GNU-make; I will use that"
14 elif gmake -v >/dev/null 2>&1
15 then
16   MAKE=gmake;
17   echo "You have a GNU-make installed as gmake; I will use that"
18 else
19   echo "I can't find a GNU-make; I'll try to use make and hope that works." 
20   echo "If it doesn't, please install GNU-make."
21 fi
22
23 # this deletes all previous builds. 
24 # comment out the rm and mkdir if you want to keep them (and uncomment and
25 # change the $MAKE distclean below)
26 rm -rf build
27 mkdir build
28 cd build
29 # clean up (uncomment the next line if you have commented out the rm and
30 # mkdir above)
31 # $MAKE distclean;
32 #
33 # guess the correct datadir
34
35 DATADIR=`which kpsewhich > /dev/null && kpsewhich texmf.cnf | sed 's%/texmf.cnf$%%' | sed 's%/web2c$%%' | sed 's%/texmf[^\/]*$%%'`
36 if test -z "$DATADIR"; then 
37   DATADIR=/usr/share
38 fi
39 mkdir texk
40 cd texk
41 # do a configure without all the things we don't need
42 ../../src/texk/configure --datadir=$DATADIR || exit 1 
43
44 # make the kpathsea library
45 (cd kpathsea;  $MAKE ../kpathsea/libkpathsea.la) || exit 1
46
47 # make the library
48 mkdir web2c
49 mkdir web2c/mpdir
50 mkdir web2c/mpdir/lib
51 cd web2c/mpdir/lib
52 (../../../../../src/texk/web2c/mpdir/lib/configure; $MAKE )|| exit 1 
53
54 # make the newmpost binary
55 cd .. 
56 ln -s ../../../../src/texk/web2c/mpdir/Makefile .
57 ln -s ../../../../src/texk/web2c/mpdir/mpost.w .
58 $MAKE || exit 1
59 # strip them
60 #STRIP=strip
61 # $STRIP web2c/mpdir/newmpost
62 # go back
63 cd ../../../..
64 # show the results
65 ls -l build/texk/web2c/mpdir/newmpost