summaryrefslogtreecommitdiff
path: root/print/dvipdfmx
diff options
context:
space:
mode:
authorminskim <minskim>2005-11-20 18:46:22 +0000
committerminskim <minskim>2005-11-20 18:46:22 +0000
commitf24d7f912daaa3b4e5ab1b426028f78a48878f0b (patch)
tree6d8fa9ce750b14ea1e51b8fa20dce87bd8fb8629 /print/dvipdfmx
parent0f6d2587fd6cf685e1015356f7bf3fbcda1692ab (diff)
downloadpkgsrc-f24d7f912daaa3b4e5ab1b426028f78a48878f0b.tar.gz
Add a INSTALL/DEINSTALL template to handle font maps for dvipdfmx.
Diffstat (limited to 'print/dvipdfmx')
-rw-r--r--print/dvipdfmx/files/map.tmpl48
1 files changed, 48 insertions, 0 deletions
diff --git a/print/dvipdfmx/files/map.tmpl b/print/dvipdfmx/files/map.tmpl
new file mode 100644
index 00000000000..11ae0c612c6
--- /dev/null
+++ b/print/dvipdfmx/files/map.tmpl
@@ -0,0 +1,48 @@
+# $NetBSD: map.tmpl,v 1.1 2005/11/20 18:46:22 minskim Exp $
+#
+# Update dvipdfmx.cfg.
+#
+
+###############################################################################
+# replace_line(file, pattern, line)
+# The first line in file that matches pattern gets replaced by line.
+# line will be added at the end of the file if pattern does not match.
+###############################################################################
+replace_line()
+{
+ file=$1; pat=$2; line=$3
+
+ if grep "$pat" "$file" >/dev/null; then
+ ed "$file" >/dev/null 2>&1 <<-eof
+ /$pat/
+ c
+ $line
+ .
+ w
+ q
+eof
+ else
+ echo "$line" >> "$file"
+ fi
+}
+
+case ${STAGE} in
+POST-INSTALL)
+ if ${TEST} ! -f @DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg; then
+ @CP@ @DVIPDFMX_CONFIG_DIR@/sample.dvipdfmx.cfg \
+ @DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg
+ fi
+ for map in @DVIPDFMX_FONTMAPS@; do
+ replace_line "@DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg" \
+ "^%![ ]*$map" "f $map"
+ done
+ ;;
+DEINSTALL)
+ for map in @DVIPDFMX_FONTMAPS@; do
+ replace_line "@DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg" \
+ "^f[ ]*$map" "%! f $map"
+ done
+ ;;
+*)
+ ;;
+esac