summaryrefslogtreecommitdiff
path: root/print/dvips/scripts/configure
blob: 6db0e2d8ffd93c2a88a723daeddb8b89f97c2de9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh


# paper size, default is no nor A4
A4=n
prefix=$PREFIX;
if `echo $PREFIX |grep -q X11` ; then
  prefix=/usr/local
fi
CACHE=$prefix/lib/texmf/fonts

if [ -f $prefix/bin/MakeTeXPK ]; then
  echo
  echo "**WARNING** MakeTeXPK already exists in $PREFIX/bin"
  echo "**WARNING** This file will be replaced during install."
  echo
fi


if [ ! -f ${WRKSRC}/MakeTeXPK.orig ]; then
  mv ${WRKSRC}/MakeTeXPK ${WRKSRC}/MakeTeXPK.orig || exit 1
fi
#find the resolutions
RES=`awk '{if(/test $BDPI/) printf "%s ",$5}' < ${WRKSRC}/MakeTeXPK.orig`
# and the corresponding modes
MODES=`awk -F= '{if(/MODE=[a-zA-Z]/) print $2}' < ${WRKSRC}/MakeTeXPK.orig`
set $MODES
echo "I need to set the mode of our printing/output device for the resolutions"
echo "$RES dpi. (the mode must be in your modes.mf file)"
SUBST=
for i in $RES; do
  echo -n "mode for $i dpi [$1]: ";
  read answ; if [ "$answ" = "" ]; then answ=$1; fi
  SUBST="$SUBST -e s/MODE=$1/MODE=$answ/"
  shift
done

rm -f $SCRIPTDIR/post-install
echo
echo "Choose a font directory for automatic font generation."
echo "------------------------------------------------------"
echo "The default directory is $CACHE. If you"
echo "don't want to make this directory world writable, then you"
echo "can choose eg. /tmp. Then you will have to periodically move "
echo "the files to $CACHE/pk."
echo -n "font directory [$CACHE]: "
read answ; if [ "$answ" != "" ]; then 
  CACHE=$answ; 
else
  echo "mkdir -p $CACHE/pk; chmod 1777 $CACHE/pk" > $SCRIPTDIR/post-install
fi
  
sed -e s:/usr/lib/tex:/$PREFIX/lib/texmf: \
    -e s:/LocalLibrary/Fonts/TeXFonts:$CACHE: \
     $SUBST <${WRKSRC}/MakeTeXPK.orig >${WRKSRC}/MakeTeXPK

#configure config.ps
if [ ! -f ${WRKSRC}/config.ps.orig ]; then
  mv ${WRKSRC}/config.ps ${WRKSRC}/config.ps.orig || exit 1
fi
RES=`awk '{if (/^D /) print $2}' <${WRKSRC}/config.ps.orig`
echo -n "what is the resolution of your printer (in dpi) [$RES]: ";
read res; if [ "$res" = "" ]; then res=$RES; fi
echo -n "do you want to use A4 paper? [$A4]: "
read answ; if [ "$answ" = "" ]; then answ=$A4; fi

if [ $answ = y ]; then
  sed  -e 's/\(^\*\)\(.*A4\)/\2/' -e  's/^@ letterSize/*@ letterSize/' \
	-e "s/^D $RES/D $res/" <${WRKSRC}/config.ps.orig > ${WRKSRC}/config.ps
else
  sed -e "s/^D $RES/D $res/" <${WRKSRC}/config.ps.orig > ${WRKSRC}/config.ps
fi

#makefile
echo "TEXDIR=$PREFIX/lib/texmf" >> ${WRKSRC}/Makefile || exit 1;
echo "LOCALDIR=$CACHE" >> ${WRKSRC}/Makefile
echo "TEXMACRODIR=\$(TEXDIR)/tex" >> ${WRKSRC}/Makefile
echo "FIGPATH = .:..:\$(TEXDIR)/tex" >> ${WRKSRC}/Makefile
echo "MANDIR=$PREFIX/man/man1" >> ${WRKSRC}/Makefile
echo "DEFS= -DTPIC -DDEBUG -DDEFRES=$res"  >> ${WRKSRC}/Makefile
echo "OPT = -O2 -funsigned-char"  >> ${WRKSRC}/Makefile
echo "BINDIR=$PREFIX/bin"  >> ${WRKSRC}/Makefile
echo "FLIBS=-lm" >> ${WRKSRC}/Makefile

exit 0;