a project to simplify installation of open source software
on Mac OS X and Darwin
# $Id: Portfile 21847 2007-02-10 09:56:04Z takanori@macports.org $
PortSystem 1.0
name pTeX
version 20070210
epoch ${version}
categories tex print textproc japanese
maintainers takanori@macports.org
description Japanese TeX (pTeX) processing environment
long_description ${description}
platforms darwin macosx
homepage http://www.nn.iij4u.or.jp/~tutimura/tex/ptetex.html
master_sites ftp://ftp.lab.kdd.co.jp/CTAN/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://ftp.meisei-u.ac.jp/pub/CTAN/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://ftp.nara.wide.ad.jp/pub/TeX/CTAN/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://ftp.riken.go.jp/pub/tex-archive/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://ftp.yz.yamagata-u.ac.jp/pub/CTAN/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://dante.ctan.org/tex-archive/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://cam.ctan.org/tex-archive/systems/unix/teTeX/3.0/distrib/:tetex \
ftp://tug.ctan.org/tex-archive/systems/unix/teTeX/3.0/distrib/:tetex \
http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/:ptetex3 \
ftp://ftp.miko.org/pub/mirror/ptetex3/:ptetex3 \
http://www.opendarwin.org/~takanori/mirror/ptetex3/:ptetex3 \
ftp://ftp.miko.org/pub/mirror/ptetex3/:cmap \
http://www.opendarwin.org/~takanori/mirror/ptetex3/:cmap \
ftp://ftp.miko.org/pub/mirror/ptetex3/:okumacro \
http://www.opendarwin.org/~takanori/mirror/ptetex3/:okumacro \
http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/:okumacro
distfiles tetex-src-3.0.tar.gz:tetex \
tetex-texmf-3.0po.tar.gz:tetex \
ptetex3-${version}.tar.gz:ptetex3 \
cmap-gs854.tar.gz:cmap \
jsverb.zip:okumacro
patchfiles patch-7font-search.sh jsverb.diff
checksums tetex-src-3.0.tar.gz md5 944a4641e79e61043fdaf8f38ecbb4b3 \
sha1 7637789f7f4929694aed1b89820f5bad4753e8fc \
rmd160 15a139f5f36993e4ed3583260e175cfb13ce7bcc \
tetex-texmf-3.0po.tar.gz md5 ed9d30d9162d16ac8d5065cde6e0f6fa \
sha1 1be97f57a26a6e9b72ebfd932e45914a959aff16 \
rmd160 a1e87733fa3cbef04e39a690ed8549aeaaddb241 \
ptetex3-${version}.tar.gz md5 cd0f0f7227f204b7cde30f370a3aa95e \
sha1 69045b2ed3e46f736e87566c93df6f82012c69e6 \
rmd160 85741e705c67b940c45b985591abb08d1f2c0483 \
cmap-gs854.tar.gz md5 e8cbefa9584c4c72b01b05c127371c8b \
sha1 ba004879d1e486734ac780e3023975e2ae0fcee6 \
rmd160 af6f603525f80d519c08f9205817a9a99616ff3b \
jsverb.zip md5 aa00de964a11c8fbe08a40487b320319 \
sha1 784c12f74fbc012e176b9d667dff4c9f31e0c37e \
rmd160 f084a2fce22fbf2a2396e90481c5ce4e893d2c91
default_variants +hiragino +otf
depends_lib bin:gs:ghostscript \
bin:perl:perl5.8 \
lib:libX11:XFree86 \
lib:libXm:openmotif \
port:fontconfig \
port:freetype \
port:gd2 \
port:jpeg \
port:libiconv \
port:libpng \
port:ncurses \
port:t1lib \
port:zlib
depends_build bin:bash:bash \
port:nkf
depends_run port:texi2html \
port:texinfo
extract.only ptetex3-${version}.tar.gz
worksrcdir ptetex3-${version}
post-extract {
system "cd ${worksrcpath} && gzip -dc ${distpath}/cmap-gs854.tar.gz | tar --no-same-owner -xf -"
file copy ${distpath}/jsverb.zip ${worksrcpath}/macro/
}
configure.args --without-texi2html \
--without-texinfo \
--with-system-gd \
--with-system-ncurses \
--with-system-pnglib \
--with-system-t1lib \
--with-system-zlib \
--with-xdvi-x-toolkit=motif
# --enable-shared
configure {
set fd [open [file join ${worksrcpath} my_option] w 0644]
puts ${fd} "TMP_PREFIX=${workpath}/temp"
puts ${fd} "SRC_DIR=${distpath}"
puts ${fd} "PREFIX=${prefix}"
puts ${fd} "DATADIR=${prefix}/share"
puts ${fd} "CONF_OPTION=\"\$CONF_OPTION ${configure.args}\""
if {[variant_isset sjis]} {
puts ${fd} "KANJI_CODE=SJIS"
} elseif {[variant_isset utf8]} {
puts ${fd} "KANJI_CODE=UTF8"
} else {
puts ${fd} "KANJI_CODE=EUC"
}
if {[variant_isset nox11]} {
puts ${fd} "XDVI=echo"
}
puts ${fd} "CPPFLAGS=\"-I${prefix}/include\""
puts ${fd} "LDFLAGS=\"-L${prefix}/lib\""
puts ${fd} "LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:${prefix}/lib\""
puts ${fd} "export CPPFLAGS LDFLAGS LD_LIBRARY_PATH"
close ${fd}
}
#build.target x c macro
pre-build {
# file mkdir ${workpath}/temp
if {[variant_isset otf]} {build.target-append otf}
if {[variant_isset babel]} {build.target-append babel}
build.target-append fonty
}
test.run yes
destroot {
system "(cd ${workpath}/temp; tar cf - bin include lib share) | (cd ${destroot}${prefix}; tar xf -)"
system "(cd ${workpath}/temp; tar cf - info man) | (cd ${destroot}${prefix}/share; tar xf -)"
delete ${destroot}${prefix}/share/info/dir
file copy ${destroot}${prefix}/share/texmf/fonts/map/dvipdfm/morisawa.map ${destroot}${prefix}/share/texmf/fonts/map/dvipdfm/morisawa-hiraginoEmbed.map
foreach {mori hira} {Ryumin-Light HiraMinPro-W3.otf
GothicBBB-Medium HiraKakuPro-W3.otf
FutoMinA101-Bold HiraMinPro-W6.otf
FutoGoB101-Bold HiraKakuPro-W6.otf
Jun101-Light HiraMaruPro-W4.otf} {
reinplace "s|${mori}|${hira}|g" ${destroot}${prefix}/share/texmf/fonts/map/dvipdfm/morisawa-hiraginoEmbed.map
}
reinplace "s|^\\(KanjiMap morisawa.map\\)$|\\1\\\n#! KanjiMap morisawa-hiraginoEmbed.map|" ${destroot}${prefix}/share/texmf-config/web2c/updmap.cfg
# Update ls-R and map files (before packaging)
set destroot_var "PATH=\"${destroot}${prefix}/bin:$env(PATH)\" TEXMFMAIN=${destroot}${prefix}/share/texmf LD_LIBRARY_PATH=${destroot}${prefix}/lib"
system "${destroot_var} mktexlsr"
if {[variant_isset hiragino]} {
system "${destroot_var} updmap-sys --setoption kanjiEmbed hiragino --nomkmap || true"
system "${destroot_var} updmap-sys --disable morisawa.map --nomkmap || true"
system "${destroot_var} updmap-sys --enable KanjiMap morisawa-hiraginoEmbed.map --nomkmap || true"
system "${destroot_var} updmap-sys"
}
# Modify mktex.opt to force use of varfonts
reinplace "s|MT_FEATURES=appendonlydir|MT_FEATURES=appendonlydir:varfonts|g" ${destroot}${prefix}/share/texmf/web2c/mktex.opt
# Add a directory for local enhancements
file mkdir ${destroot}${prefix}/share/texmf-local
system "touch ${destroot}${prefix}/share/texmf-local/.ptetex3-${version}"
}
post-destroot {
file mkdir ${destroot}${prefix}/share/doc
system "ln -sf ../texmf/doc/ptetex ${destroot}${prefix}/share/doc/ptetex3"
}
post-activate {
system "ranlib ${prefix}/lib/libkpathsea.a"
system "${prefix}/bin/mktexlsr"
# Not elegant. But this will be helpful if you are using these packages
foreach f {tipa.map} {
system "(${prefix}/bin/kpsewhich ${f} > /dev/null) && ${prefix}/bin/updmap-sys --enable MixedMap ${f} --nomkmap || true"
}
foreach f {cm-super-t1.map cm-super-ts1.map cm-super-t2a.map cm-super-t2b.map cm-super-t2c.map cm-super-x2.map fourier.map} {
system "(${prefix}/bin/kpsewhich ${f} > /dev/null) && ${prefix}/bin/updmap-sys --enable Map ${f} --nomkmap || true"
}
system "${prefix}/bin/updmap-sys"
system "${prefix}/bin/fmtutil-sys --all"
}
#Embed Hiragino fonts in PDF
variant hiragino {}
#Use otf.sty
variant otf {}
#Use babel
variant babel {}
variant euc conflicts sjis utf8 {}
variant sjis conflicts euc utf8 {}
variant utf8 conflicts euc sjis {}
variant nox11 conflicts motif xaw xaw3d nextaw {
depends_lib-delete lib:libX11:XFree86 lib:libXm:openmotif port:fontconfig port:freetype port:gd2 port:jpeg port:libiconv
# gd2 requires X11
configure.args-delete --with-system-gd --with-xdvi-x-toolkit=motif
configure.args-append --without-system-gd --without-x --without-xdvik
}
variant motif conflicts nox11 xaw xaw3d nextaw {}
variant xaw conflicts nox11 motif xaw3d nextaw {
depends_lib-delete lib:libXm:openmotif
depends_lib-append lib:libXaw:XFree86
configure.args-delete --with-xdvi-x-toolkit=motif
configure.args-append --with-xdvi-x-toolkit=xaw
}
variant xaw3d conflicts nox11 motif xaw nextaw {
depends_lib-delete lib:libXm:openmotif
depends_lib-append port:Xaw3d
configure.args-delete --with-xdvi-x-toolkit=motif
configure.args-append --with-xdvi-x-toolkit=xaw3d
}
variant nextaw conflicts nox11 motif xaw xaw3d {
depends_lib-delete lib:libXm:openmotif
depends_lib-append port:neXtaw
configure.args-delete --with-xdvi-x-toolkit=motif
configure.args-append --with-xdvi-x-toolkit=neXtaw
}
platform macosx {}
livecheck.check regex
livecheck.url http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/?N=D
livecheck.regex ptetex3-(\[0-9\]+)\\.tar