aboutsummaryrefslogtreecommitdiff
path: root/print/pdftk/Makefile
blob: 2c691811bd185bb63de371968166e127d747b1b8 (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
# Created by: Patrick Dung (patrick_dkt@yahoo.com.hk)
# $FreeBSD$

PORTNAME=	pdftk
PORTVERSION=	2.02
PORTREVISION=	3
CATEGORIES=	print
MASTER_SITES=	http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
DISTNAME=	${PORTNAME}-${PORTVERSION}-src

MAINTAINER=	mat@FreeBSD.org
COMMENT=	Simple tool for doing everyday things with PDF documents

LICENSE=	GPLv2

# Get GCC version suffix without the dot in USE_GCC
CSUFF=		${_USE_GCC:S/.//}

USE_GCC=	yes
USES=		iconv gmake zip

# gcj/libgcj don't exist on some platforms
ONLY_FOR_ARCHS=		i386 amd64
ONLY_FOR_ARCHS_REASON=	GNU gcj does not exist on this platform

PATCH_WRKSRC=	${WRKDIR}/${PORTNAME}-${PORTVERSION}-dist
WRKSRC=		${PATCH_WRKSRC}/${PORTNAME}

MAKEFILE=	Makefile.FreeBSD
MAKE_ENV=	GCJ=gcj${CSUFF} GCJH=gcjh${CSUFF} GCPP=cpp${CSUFF} \
		OBJCOPY=${OBJCOPY} LANG=C LC_CTYPE=C

PLIST_FILES=	bin/${PORTNAME} man/man1/${PORTNAME}.1.gz

pre-configure:
	@if [ ! -e ${LOCALBASE}/bin/gcj${CSUFF} ]; then \
		${ECHO_MSG} ""; \
		${ECHO_MSG} "Can not find gcj${CSUFF}"; \
		${ECHO_MSG} "Please rebuild ${_GCC_PORT} with java support"; \
		${ECHO_MSG} ""; \
		exit 1; \
	fi

post-patch:
	@${REINPLACE_CMD} -e "s|TOOLPATH=|TOOLPATH=${LOCALBASE}/bin/|g" ${WRKSRC}/${MAKEFILE}
	@${REINPLACE_CMD} -e "s|VERSUFF=|VERSUFF=${CSUFF}|g" ${WRKSRC}/${MAKEFILE}
	@${REINPLACE_CMD} -e "s|GCJFLAGS=|GCJFLAGS= -L${LOCALBASE}/lib ${LDFLAGS} -w|g" ${WRKSRC}/${MAKEFILE}
	@${REINPLACE_CMD} -e "s|LDLIBS= -lgcj|LDLIBS= -lgcj ${PTHREAD_CFLAGS} ${PTHREAD_LIBS} ${ICONV_LIB} -lz -L${LOCALBASE}/lib ${LDFLAGS} -w|g" \
			${WRKSRC}/${MAKEFILE}

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/../${PORTNAME}.1 ${STAGEDIR}${PREFIX}/man/man1

.include <bsd.port.mk>