summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/mksedscript
blob: 706ba4467b51e971a5494d39c2d7619c751b1b7f (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#! /bin/sh

srcdir=$1

# Values from c-auto.h

mk_GREY=
mk_PS_GS=
mk_GS_PATH='gs'
mk_PS_DPS=
mk_PS_NEWS=
mk_A4=
mk_MOTIF=
mk_COLOR=

# T1 is always true
mk_T1=1

# Kpathsea defaults, they are #if'ed in the source but there is no
# config option to disable them.
mk_KPATHSEA=1

# Optional values from CFLAGS

mk_MFMODE='unspecified'
mk_BDPI=600
mk_DEFAULT_FONT_SIZES='m0:m0.5:m1:m2:m3:m4:m5'
mk_SHRINK=8

# Get arguments from CFLAGS

for mk_arg
do
  case "$mk_arg" in
    -D*=*)
      eval "`echo \"$mk_arg\" | sed 's/^-D/mk_/'`"
      ;;
    -D*)
      eval "`echo \"$mk_arg\" | sed 's/^-D/mk_/'`=1"
      ;;
  esac
done

# Get arguments from c-auto.h

eval "`awk '/^#define/ { print "mk_"$2"="$3 }' c-auto.h`"

# eval "`cat c-auto.h \
#   | grep '^[ 	]*#[ 	]*define[ 	]' \
#   | sed 's/^[ 	]*#[ 	]*define[ 	][ 	]*/mk_/' \
#   | sed 's/[ 	][ 	]*/=/'`"

# Process simple boolean arguments.  Their values are empty or nonempty

if test -z "$mk_COLOR";		then echo '/^#ifcolor/,/^#/d';		fi
if test -z "$mk_GREY";		then echo '/^#ifgrey/,/^#/d';		fi
if test -z "$mk_PS_DPS";	then echo '/^#ifdps/,/^#/d';		fi
if test -z "$mk_PS_NEWS";	then echo '/^#ifnews/,/^#/d';		fi
if test -z "$mk_T1";		then echo '/^#ift1/,/^#/d';		fi
if test -z "$mk_MOTIF";		then echo '/^#ifmotif/,/^#/d';
				else echo '/^#ifxaw/,/^#/d';		fi

if test -z "$mk_KPATHSEA"; then	echo	'/^#ifkpathsea/,/^#/d';
			   else echo	'/^#ifnokpathsea/,/^#/d';	fi

# Process remaining PostScript emulation arguments

if test -z "$mk_PS_GS"; then
  echo '/^#ifghost/,/^#/d'
else
  echo "s^@GS_PATH@^$mk_GS_PATH^"
fi

if test -n "$mk_PS_GS" || test -n "$mk_PS_DPS" || test -n "$mk_PS_NEWS"; then
  mk_PS=y
  echo '/^#ifnops/,/^#/d'
else
  mk_PS=
  echo '/^#ifps/,/^#/d'
fi

# get version info and release date from CHANGES file

spacetab=' 	'
XDVI_VERSION_INFO=`egrep "^[$spacetab]+\*" $srcdir/CHANGES | sed 1q | awk '{print $2 " " $3}'`
XDVI_VERSION=`echo $XDVI_VERSION_INFO | awk '{print $1}'`
XDVI_DATE=`echo $XDVI_VERSION_INFO | awk '{print $2}' | sed 's/[():]//g'`

# Miscellaneous args

if test -n "$mk_A4"; then
  echo 's/@DEFAULT_PAGE_SIZE@/21 x 29.7 cm (A4 size)/'
  echo 's/@DEFAULT_UNIT@/cm " (centimeters)"/'
else
  echo 's/@DEFAULT_PAGE_SIZE@/8.5 x 11 inches/'
  echo 's/@DEFAULT_UNIT@/in " (inches)"/'
fi

echo "s^@MFMODE@^$mk_MFMODE^"
echo "s/@BDPI@/$mk_BDPI/"
echo "s/@SHRINK@/$mk_SHRINK/"
echo "s/@XDVI_VERSION@/$XDVI_VERSION/"
echo "s^@XDVI_DATE@^$XDVI_DATE^"

echo "s/@DEFAULT_FONT_SIZES@/$mk_DEFAULT_FONT_SIZES/" | sed -e "s/:/ :\\\\\\
/g"

# Remove all remaining '#' lines

echo	'/^#/d'

# Done

exit 0