# makefile for use of: PIPS
# Date created: 26 Aug 2004
# Whom: Hajimu UMEMOTO <ume@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= pips${PRTYPE}
PORTVERSION?= 1.3.2
PORTREVISION?= 4
CATEGORIES?= print
MASTER_SITES= http://lx2.avasys.jp/pips/%SUBDIR%/
PIPS_MAJOR= ${PORTVERSION:C|^([0-9]+).([0-9]+).([0-9]+)$|\1|}
PIPS_MINOR= ${PORTVERSION:C|^([0-9]+).([0-9]+).([0-9]+)$|\2|}
#PIPS_PATCH= ${PORTVERSION:C|^([0-9]+).([0-9]+).([0-9]+)$|\3|}
PIPS_LEVEL!= /usr/bin/printf "%d%02d" ${PIPS_MAJOR} ${PIPS_MINOR}
#PIPS_VERSION!= /usr/bin/printf "%d%02d%02d" ${PIPS_MAJOR} ${PIPS_MINOR} \
# ${PIPS_PATCH}
.if ${PIPS_LEVEL} < 206
DIST_TYPE= lpr
.endif
DIST_TYPE?= ""
PRTYPE_PREFIX= ${PRTYPE:C|^([^0-9]+)[0-9]+.*$|\1|}
.if !defined(PRT_MODEL)
.if ${PRTYPE:C|^(.).*$|\1|} == "-"
PRT_MODEL= ${PRTYPE:U:S/^-//}
.elif ${PRTYPE} == 790
PRT_MODEL= PM${PRTYPE}PT
.elif ${PRTYPE} == "780cs"
PRT_MODEL= PM${PRTYPE:U}
.elif ${PRTYPE} == "820ug"
PRT_MODEL= PM820CUG
.elif ${PRTYPE} == 4000
PRT_MODEL= PM${PRTYPE}PX
.elif ${PRTYPE_PREFIX} == v || ${PRTYPE} == g900
PRT_MODEL= PX${PRTYPE:U}
.elif ${PRTYPE_PREFIX} == g
PRT_MODEL= PM${PRTYPE:U}
.else
PRT_MODEL= PM${PRTYPE}C
.endif
.endif
.if !defined(MASTER_SITE_SUBDIR)
.if ${PRTYPE:C|^(...).+(.)$|\1\2|} == "-scs"
MASTER_SITE_SUBDIR= ${PRTYPE:C|^-(sc.+)s$|\1|}${SUBDIR_SUFFIX}
.elif ${PRTYPE:C|^(.).*$|\1|} == "-"
MASTER_SITE_SUBDIR= ${PRTYPE:S/^-//}${SUBDIR_SUFFIX}
.else
MASTER_SITE_SUBDIR= ${PRT_MODEL:L}${SUBDIR_SUFFIX}
.endif
.endif
MAINTAINER= ume@FreeBSD.org
LIB_DEPENDS= png.6:${PORTSDIR}/graphics/png
RUN_DEPENDS= pstops:${PORTSDIR}/print/psutils-${PAPERSIZE} \
${LOCALBASE}/lib/pluginwrapper/pips.so:${PORTSDIR}/www/linuxpluginwrapper
USE_GMAKE= yes
USE_GNOME= glib12 gtk12
USE_GETTEXT= yes
USE_GHOSTSCRIPT_RUN=yes
ONLY_FOR_ARCHS= i386
.if ${DIST_TYPE} == cups
PKGNAMESUFFIX= -cups
.endif
DISTNAME= ${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}
MD5_FILE= ${.CURDIR}/distinfo
DESCR= ${.CURDIR}/pkg-descr
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --libdir=${PREFIX}/lib/pips
PLIST_SUB= PRTYPE=${PRTYPE} \
PRT_MODEL=${PRT_MODEL} \
LIB_README=${LIB_README} \
MODEL_FILE=${MODEL_FILE} \
CUPSOPT_FILE=${CUPSOPT_FILE} \
PIPS=${PIPS} \
PIPS_EN=${PIPS_EN} \
CUPS=${CUPS} \
EKPNAVI=${EKPNAVI} \
EKPNAVI_MO=${EKPNAVI_MO} \
EKPSTM_MO=${EKPSTM_MO} \
EKPSTM_PIXMAP=${EKPSTM_PIXMAP} \
DTRFILTER=${DTRFILTER} \
GSCONFIG=${GSCONFIG} \
PAPER_LIST=${PAPER_LIST}
.include <bsd.port.pre.mk>
CPPFLAGS= -I${LOCALBASE}/include
LDFLAGS= -L${LOCALBASE}/lib
.if ${PIPS_MAJOR} >= 2
CONFLICTS= pips*-2.*
USE_RC_SUBR= yes
EXTRA_PATCHES= ${FILESDIR}/extra-patch-2.6.2
.if ${PIPS_LEVEL} != 201 && ${DIST_TYPE} != cups
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-2.6.2-dtrfilter
.endif
.if ${DIST_TYPE} == lpr
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-2.6.2-ekpstm \
${FILESDIR}/extra-patch-2.6.2-ekpnavi \
${FILESDIR}/extra-patch-2.6.2-src \
${FILESDIR}/extra-patch-2.6.2-src-lpr
.elif ${DIST_TYPE} == cups
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-2.6.2-ekpstm \
${FILESDIR}/extra-patch-2.6.2-src-cups
LIB_DEPENDS+= cups.2:${PORTSDIR}/print/cups-base
USE_ICONV= yes
.else
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-2.6.2-common \
${FILESDIR}/extra-patch-2.6.2-src \
${FILESDIR}/extra-patch-2.6.2-src-cups
.if ${PRTYPE} != g700 && ${PRTYPE} != g900 && ${PRTYPE} != -scx3500_3600s && \
${PRTYPE} != -spr800
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-2.6.2-ekpstm::main.c
.endif
USE_AUTOTOOLS= autoconf:268
LIB_DEPENDS+= cups.2:${PORTSDIR}/print/cups-base
USE_ICONV= yes
.endif
LDFLAGS+= ${PTHREAD_LIBS}
CPPFLAGS+= ${PTHREAD_CFLAGS}
.endif
CONFIGURE_ENV+= CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
MAKE_ENV+= SED="${SED}"
LIB_FILE= lib${PRT_MODEL:L}.so
MODEL_FILE= ek${PRT_MODEL:L}.ppd
.if ${PIPS_LEVEL} == 201 || (${PIPS_LEVEL} >= 205 && ${DIST_TYPE} == lpr)
EKPNAVI_VER?= 1.1.2
.endif
.if defined(EKPNAVI_VER) || ${DIST_TYPE} == cups
.if ${PRTYPE} == 970 || ${PRTYPE} == v700
EKPSTM_VER?= 1.1.2
.else
EKPSTM_VER?= 1.0.2
.endif
.endif
.if ${DIST_TYPE} == cups
.if ${PRTYPE} == v700
CUPSOPT_FILE= cupsopt_px${PRTYPE}.csv
.else
CUPSOPT_FILE= cupsopt_pm${PRTYPE}c.csv
.endif
.else
CUPSOPT_FILE= cupsopt.csv
.endif
LIB_README= ${LIB_FILE:S/.so$//}.readme
PAPERSIZE?= a4
.if ${PIPS_MAJOR} == 1
FILTER_SRC= filter.org
PLIST= ${MASTERDIR}/pkg-plist132
.else
FILTER_SRC= filter.tmp
.if ${PIPS_LEVEL} == 201
INCLIST= PIPS EKPNAVI EKPNAVI_MO EKPSTM_MO GSCONFIG
.elif ${DIST_TYPE} == lpr
INCLIST= PIPS EKPNAVI EKPNAVI_MO EKPSTM_MO DTRFILTER PAPER_LIST
.elif ${DIST_TYPE} == cups
INCLIST= CUPS EKPSTM_MO PAPER_LIST
.else
INCLIST= PIPS CUPS EKPNAVI DTRFILTER PAPER_LIST
.endif
.if ${PRTYPE} == g700 || ${PRTYPE} == -sc65_66s || ${PRTYPE} == -sc85_86s || \
${PRTYPE} == -scx3500_3600s || ${PRTYPE} == -spr800
INCLIST+= PIPS_EN
.endif
.if defined(EKPSTM_VER)
.if ${EKPSTM_VER} == 1.1.2
INCLIST+= EKPSTM_PIXMAP
.endif
.endif
.for _P in PIPS PIPS_EN CUPS EKPNAVI EKPNAVI_MO EKPSTM_MO EKPSTM_PIXMAP \
DTRFILTER GSCONFIG PAPER_LIST
.if ${INCLIST:M${_P}} == ${_P}
${_P}=""
.else
${_P}="@comment "
.endif
.endfor
RC_SCRIPTS_SUB= PREFIX=${PREFIX} \
PRT_MODEL=${PRT_MODEL}
WITH_EKPD?= yes
.endif
PKGMESSAGE= ${WRKDIR}/pkg-message
DOCS= COPYING COPYING.KOWA COPYING.KOWA.ja COPYING.LIB
post-extract:
.if defined(EKPNAVI_VER)
cd ${WRKSRC}/ekpnavi && ${TAR} xzf ekpnavi-${EKPNAVI_VER}.tar.gz
.endif
.if defined(EKPSTM_VER)
cd ${WRKSRC}/ekpstm && ${TAR} xzf ekpstm-${EKPSTM_VER}.tar.gz
.endif
post-patch:
.if defined(EKPNAVI_VER)
cd ${WRKSRC}/ekpnavi/ekpnavi-${EKPNAVI_VER} && \
patch -p < ${FILESDIR}/ekpnavi-${EKPNAVI_VER}.diff
.endif
.if defined(EKPSTM_VER)
cd ${WRKSRC}/ekpstm/ekpstm-${EKPSTM_VER} && \
patch -p < ${FILESDIR}/ekpstm-${EKPSTM_VER}.diff
.endif
${REINPLACE_CMD} -e '/^SUBDIRS =/s/setup//' \
-e 's,setup redhat,redhat,' \
-e '/inst-post.sh/s/^/#/' \
${WRKSRC}/Makefile.in
${REINPLACE_CMD} -e 's,^prefix=/usr$$,,' -e 's,^sysconfdir=/etc$$,,' \
-e 's,/usr/local/EPKowa,${PREFIX}/libexec/pips,' \
-e 's,_nl_domain_bindings,libintl&,' \
${WRKSRC}/configure
${REINPLACE_CMD} -e 's,^pkgdatadir.*$$,pkgdatadir = ${DOCSDIR},' \
${WRKSRC}/doc/Makefile.in
.if ${DIST_TYPE} != cups
${REINPLACE_CMD} -e 's,^EKPSTM.*$$,EKPSTM=${PREFIX}/bin/ekpstm,' \
-e 's,/usr/local/EPKowa,${PREFIX}/libexec/pips,' \
-e 's,/usr/bin/pips,${PREFIX}/bin/pips,' \
-e 's,:/usr/local/bin$$,:${PREFIX}/bin,' \
-e 's,^GSCONF=%gsconfig_name%$$,GSCONF=${PREFIX}/bin/%gsconfig_name%,' \
${WRKSRC}/src/${FILTER_SRC}
.endif
.if ${PIPS_MAJOR} == 1
${REINPLACE_CMD} -e 's,^PREFIX.*$$,PREFIX=${PREFIX},' \
-e 's,^ETCDIR.*$$,ETCDIR=${PREFIX}/etc,' \
-e 's,/dev/lp0,/dev/lpt0,' \
-e 's,/usr/local/EPKowa,${PREFIX}/libexec/pips,' \
-e 's,/usr/bin/pips,${PREFIX}/bin/pips,' \
-e 's,:/usr/local/bin$$,:${PREFIX}/bin,' \
${WRKSRC}/setup/inst-post.sh
.endif
.if ${PIPS_LEVEL} >= 205 && ${DIST_TYPE} != cups
${REINPLACE_CMD} -e '/^dtrfilter_LDADD =/s/-ldl //' \
${WRKSRC}/dtrfilter/Makefile.in
${REINPLACE_CMD} -e 's,/etc/pipsrc,${PREFIX}&,' \
-e 's,/usr/local/EPKowa,${PREFIX}/libexec/pips,' \
${WRKSRC}/layout_script/gsconfig
.endif
.if ${PIPS_MAJOR} >= 2
${REINPLACE_CMD} -e 's,/etc/ekpdrc,${PREFIX}&,' \
${WRKSRC}/ekpd/cbtd_setup.c
${REINPLACE_CMD} -e 's;/dev/\(usb/\)\{0,1\}lp0;/dev/ulpt0;' \
-e 's,^SUBDIRS = rc$$,#&,' \
${WRKSRC}/ekpd/Makefile.in
.if ${PRTYPE} == g700 || ${PRTYPE} == g900 || ${PRTYPE} == -sc65_66s || \
${PRTYPE} == -sc85_86s || ${PRTYPE} == -scx3500_3600s || \
${PRTYPE} == -spr800
${REINPLACE_CMD} -e 's,^\(enum Ink\)set\(_Id inkbox_get_inkid\),\1box\2,' \
${WRKSRC}/ekpstm/inkbox.h
.endif
.if ${DIST_TYPE} != cups
${REINPLACE_CMD} -e 's,/etc/ekpdrc,${PREFIX}&,' ${WRKSRC}/src/setup.c
.endif
.if ${PIPS_LEVEL} >= 206 || ${DIST_TYPE} == lpr
${REINPLACE_CMD} -e 's,@CUPS_LIBS@,& -lintl,' \
-e 's;^\(INCLUDES = \{1,2\}\)\(@GTK_CFLAGS@ \)$$;\1$$(INCLTDL) \2;' \
${WRKSRC}/src/Makefile.in
.endif
.endif
pre-configure:
.if ${PIPS_LEVEL} >= 206 && ${DIST_TYPE} != lpr && ${DIST_TYPE} != cups
cd ${WRKSRC}/libltdl && ${LOCALBASE}/bin/autoconf-2.65
.endif
post-configure:
.if defined(EKPNAVI_VER)
cd ${WRKSRC}/ekpnavi/ekpnavi-${EKPNAVI_VER} && \
${CONFIGURE_ENV} ./configure --prefix=${PREFIX}
.endif
.if defined(EKPSTM_VER)
cd ${WRKSRC}/ekpstm/ekpstm-${EKPSTM_VER} && \
${CONFIGURE_ENV} ./configure --prefix=${PREFIX}
.endif
post-build:
.if ${PIPS_MAJOR} == 1
${SED} -e 's,$$GSCONF | $$PIPS -ui C,TMP=/tmp/pips.$$$$;\
trap "rm -rf $$TMP; exit" 0 2 3 4 6 7 8 10 11 12 13 15;\
psselect -r > $$TMP;\
$${GSCONF} < $$TMP | $${PIPS} -ui C,' \
-e 's,$${GSCONF} | $${PIPS} -ui C,TMP=/tmp/pips.$$$$;\
trap "rm -rf $$TMP; exit" 0 2 3 4 6 7 8 10 11 12 13 15;\
psselect -r > $$TMP;\
$${GSCONF} < $$TMP | $${PIPS} -ui C,' \
${WRKSRC}/src/filter${PRTYPE} \
> ${WRKSRC}/src/filter${PRTYPE}.rev
.endif
${SED} -e 's,%%PRTYPE%%,${PRTYPE},g' \
-e 's,%%PRT_MODEL%%,${PRT_MODEL},g' \
-e 's,%%VERSION%%,${PORTVERSION},'g \
-e 's,%%PREFIX%%,${PREFIX},g' \
-e 's,%%WITH_EKPD%%,${WITH_EKPD},g' \
${FILESDIR}/setup > ${WRKDIR}/setup.freebsd
.if ${PIPS_MAJOR} >= 2
${REINPLACE_CMD} -e 's,.rev$$,,' ${WRKDIR}/setup.freebsd
@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${FILESDIR}/ekpd.sh > ${WRKDIR}/ekpd.sh
@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${FILESDIR}/pips.sh > ${WRKDIR}/pips.sh
.endif
${SED} -e 's,%%LIB_FILE%%,${LIB_FILE},g' \
-e 's,%%PRT_MODEL%%,${PRT_MODEL},g' \
${MASTERDIR}/pkg-message > ${PKGMESSAGE}
post-install:
.if ${DIST_TYPE} != cups
${RM} -f ${PREFIX}/etc/pipsrc
${TOUCH} ${PREFIX}/etc/pipsrc
${CHMOD} 666 ${PREFIX}/etc/pipsrc
.endif
${INSTALL_SCRIPT} ${WRKDIR}/setup.freebsd \
${PREFIX}/libexec/pips/${PRT_MODEL}/setup
${MKDIR} ${PREFIX}/libexec/pips/${PRT_MODEL}/scripts
${INSTALL_DATA} ${FILESDIR}/en.lc \
${PREFIX}/libexec/pips/${PRT_MODEL}/scripts
${INSTALL_DATA} ${FILESDIR}/ja.lc \
${PREFIX}/libexec/pips/${PRT_MODEL}/scripts
.if ${PIPS_MAJOR} == 1
${INSTALL_SCRIPT} ${WRKSRC}/src/filter${PRTYPE}.rev \
${PREFIX}/libexec/pips/${PRT_MODEL}
.endif
.if !defined(NOPORTDOCS)
.for f in ${DOCS}
${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
@${ECHO_CMD} "lib/pips/${LIB_FILE}" >>${TMPPLIST}
.if ${PRTYPE} == 970 || ${PRTYPE} == 980 || ${PRTYPE} == 4000 || \
${PRTYPE} == -sp2100_2200
@${ECHO_CMD} "lib/pips/${LIB_FILE:S/.so/R1&/}" >>${TMPPLIST}
@${ECHO_CMD} "lib/pips/${LIB_FILE:S/.so/R2&/}" >>${TMPPLIST}
${INSTALL_SCRIPT} ${WRKDIR}/pips.sh ${PREFIX}/etc/rc.d
@${ECHO_CMD} "etc/rc.d/pips.sh" >>${TMPPLIST}
${PREFIX}/etc/rc.d/pips.sh start
.endif
@${ECHO_CMD} "@dirrm lib/pips" >>${TMPPLIST}
.for f in ${PATCH_PRN}
@${ECHO_CMD} "libexec/pips/${PRT_MODEL}/${f}" >>${TMPPLIST}
.endfor
@${ECHO_CMD} "@dirrm libexec/pips/${PRT_MODEL}" >>${TMPPLIST}
@${ECHO_CMD} "@dirrm libexec/pips" >>${TMPPLIST}
.if ${PIPS_MAJOR} >= 2
${INSTALL_SCRIPT} ${WRKDIR}/ekpd.sh ${PREFIX}/etc/rc.d
.endif
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>