summaryrefslogtreecommitdiff
path: root/print/magicfilter/Makefile
blob: 966bb46ca330d66d5c17b841d07a6165be053eb9 (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
# $NetBSD: Makefile,v 1.50 2006/08/31 08:22:38 rillig Exp $

DISTNAME=	magicfilter-1.2
PKGREVISION=	5
CATEGORIES=	print
MASTER_SITES=	${MASTER_SITE_SUNSITE:=system/printing/}

MAINTAINER=	pkgsrc-users@NetBSD.org
COMMENT=	Customizable, extensible automatic printer filter

# Any version will do:
#
DEPENDS+=	a2ps-[0-9]*:../../print/a2ps
DEPENDS+=	netpbm-[0-9]*:../../graphics/netpbm
DEPENDS+=	papersize-[0-9]*:../../print/papersize

USE_TOOLS+=	gmake gs:run gzip
GNU_CONFIGURE=	yes
CONFIGURE_ENV+=	GHOSTSCRIPT=${TOOLS_PATH.gs}
CONFIGURE_ENV+= GZIP=${TOOLS_GZIP_CMD:Q}
TEX_ACCEPTED=	teTeX3

FILTER_DIR=	libexec/magicfilter

.include "../../mk/bsd.prefs.mk"

BUILD_DEFS+=	PAPERSIZE
PAPERSIZE?=	A4
LOWER_PAPERSIZE_cmd=	${ECHO} ${PAPERSIZE} | ${TR} "[A-Z]" "[a-z]"
LOWER_PAPERSIZE=	${LOWER_PAPERSIZE_cmd:sh}

SUBST_CLASSES+=		mf
SUBST_STAGE.mf=		post-build
SUBST_MESSAGE.mf=	Adjusting paper size in filters.
SUBST_FILES.mf=		filters/*-filter
SUBST_SED.mf=		-e 's/-sOutputFile=-/& -sPAPERSIZE=${LOWER_PAPERSIZE:Q:Q}/'

INSTALLATION_DIRS+=	${FILTER_DIR}

GENERATE_PLIST+= \
	(cd ${WRKSRC}/filters;						\
	for f in *-filter; do						\
	  ${ECHO} ${FILTER_DIR}/"$$f";					\
	done;								\
	${ECHO} "@dirrm ${FILTER_DIR}");

post-install:
	set -e;								\
	cd ${WRKSRC}/filters;						\
	for f in *-filter; do						\
	  ${ECHO} "Installing $$f as ${PREFIX}/${FILTER_DIR}/$$f";	\
	  ${INSTALL_SCRIPT} "$$f" ${PREFIX}/${FILTER_DIR}/"$$f";	\
	done

.include "../../mk/tex.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"