summaryrefslogtreecommitdiff
path: root/Build/source/texk/windvi/mksedscript
blob: d7f94968e087c055380b65203a3e483bb701ed23 (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

# Values from c-auto.h

mk_NOTOOL=
mk_GREY=
mk_BUTTONS=
mk_PS_GS=
mk_GS_PATH='gs'
mk_PS_DPS=
mk_PS_NEWS=
mk_A4=

# HyperTeX: There appears to be no (easy) way to disable this
mk_HTEX=1

# Kpathsea defaults, they are #if'ed in the source but there is no
# config option to disable them.
mk_SELFILE=1
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 -n "$mk_NOTOOL";	then mk_BUTTONS=;			fi
if test -z "$mk_GREY";		then echo '/^#ifgrey/,/^#/d';		fi
if test -z "$mk_BUTTONS";	then echo '/^#ifbuttons/,/^#/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_HTEX";		then echo '/^#ifhyper/,/^#/d';		fi
if test -n "$mk_NOGRID";	then echo '/^#ifgrid/,/^#/d';		fi

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

# -DNOSELFILE is supposed to override everything
case $mk_SELFILE:$mk_NOSELFILE in
    *:1)	echo '/^#ifselfile/,/^#/d';;
    1:*)	echo '/^#ifnoselfile/,/^#/d';
esac

# See HTEX comment above    
# if test -z "$mk_HAVE_LIBWWW" || test -z "$mk_HAVE_WWWLIB_H";
# 				then echo '/^#ifhyper/,/^#/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

# 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/@DEFAULT_FONT_SIZES@/$mk_DEFAULT_FONT_SIZES/" | sed -e "s/:/ :\\\\\\
/g"

# Remove all remaining '#' lines

echo	'/^#/d'

# Done

exit 0