2001/02/11    VFlib, Ghostscript, GV, and TeX Family on MacOSX

G77、CERNLIB、ROOT といった仕事関係のソフト開発の環境や、それを使った自前のシミュレーションや解析ソフトの移植がほぼ完了したので、あとは論文作成環境を整備すればほぼ当初の目標をクリアーしたことになる。
TeX による論文作成には、表題のものが必要。理想は、TeX が MacOS X の上でネイティブに使えることだが、これに関しては内山さんが開発されているが、完全なカーボナイズにはあと一歩といった状況のようである。私の非力なマシン(G3 PB 266)では、Classic 環境と X とを同時に使うのはかなり厳しい。そこで応急処置として X 上に TeX 環境を構築することに。
コンパイルに特に問題はなかった。しいていえば、configure が darwin target を知らない場合は、どれでも良いので Darwin source に含まれる config.guss と config.sub をとってきて置き換えるのがこつ。後はほとんど linuxppc の SRPM の SPEC どおり。これ手でやるのが面倒なのでやはり Darwin 上に rpm を移植すべきだろうな。HP-UX ではそうしたおかげで保守が画期的に楽になったもの。
以下は作業記録。時間がないので解説は省略。
 

[0] Libraries needed to build Ghostscript, GV, etc.

---------
jpeg
---------
 
$ cd jpeg-6b/
$ ./configure --prefix=/usr/local
$ make >& make.log &
$ su
# mkdir -p tmp/usr/local/{bin,lib,share,man/man1}
# make install prefix=`pwd`/tmp/usr/local
# tar -zcvf <somewhere>/jpeg-6b-bin.tar.gz -C tmp usr
# tar -zxvf <somewhere>/jpeg-6b-bin.tar.gz -C /
# exit


---------
zlib
---------
 

$ cd zlib-1.1.3
$ ./configure --prefix=/usr/local
$ make
$ su
# make install prefix=`pwd`/tmp/usr/local
# cp zutil.h tmp/usr/local/include/
# mkdir -p tmp/usr/local/man/man3
# cp zlib.3 tmp/usr/local/man/man3/
# tar -zcvf ../../../../tgz/zlib-1.1.3-bin.tar.gz -C tmp usr
# tar -zxvf ../../../../tgz/zlib-1.1.3-bin.tar.gz -C /
# exit


---------
libpng
---------
 

$ cd libpng-1.0.1
$ cp scripts/makefile.dwn Makefile
$ vi Makefile
.....
 mkdir  ---> mkdir -p
.....
# make install prefix=`pwd`/tmp/usr/local
# ranlib -s tmp/usr/local/lib/libpng.a
# tar -zcvf ../../../tgz/libpng-1.0.1-bin.tar.gz -C tmp usr
# tar -zxpvf ../../../tgz/libpng-1.0.1-bin.tar.gz -C /
# exit


---------
VFlib
---------
 

$ cd VFlib2-2.24.2
$ patch -p1 -s < <somewhere>/VFlib2-2.24.2-macosx.patch
$ ./configure --prefix=/usr/local --with-x --with-freetype --with-freetype-includedir=/usr/local/include/freetype
$ make
$ su
# make install prefix=`pwd`/tmp/usr/local
make: `install' is up to date.
# vi Makefile
....
install::
....
# make install prefix=`pwd`/tmp/usr/local
# ln -s libVFlib2.a tmp/usr/local/lib/libVFlib.a
# tar -zcvf ../../../../tgz/VFlib-2.24.2-bin.tar.gz -C tmp usr
# tar -zxvf ../../../../tgz/VFlib-2.24.2-bin.tar.gz -C /
# tar -zxvf ../../../../tgz/xtt-truetypefont.tar.gz
# exit

[1] Ghostscript

$ tar -zxvf ../gs/gnu-gs-5.50.tar.gz
$ cd gs5.50/
$ tar -zxvf ../../gs/gnu-gs-5.50jpeg.tar.gz
$ tar -zxvf ../../gs/gdevmd2k-0.2a.tar.gz
$ cd ..
$ tar -zxvf ../gs/ghostscript-5.50gnu.tar.gz
$ cd gs5.50/
$ tar -zxvf ../../gs/gs5.50-vflib-1.0.tar.gz
$ tar -zxvf ../../gs/gs550j1.tar.gz
$ ln -s jpeg-6b jpeg
$ patch -s -p1 < gs5.50-vflib-1.0/gs5.50-vflib-1.0.diff
$ patch -s -p1 < ../../gs/ghostscript-5.50-configj.patch
$ patch -s -p1 < gs550j1.diff
$ cat jdevs.add >>contrib.mak
$ patch -s -p1 < ../../gs/gs5.50-rth.patch
$ patch -s -p1 < ../../gs/gs5.50-hp8xx.patch
$ mkdir tmp
$ cd tmp
$ unzip -a -L ../../../gs/hp8xxs13.zip
$ mv *.c *.h ..
$ tar -zxvf ../../../gs/epson740.tgz
$ mv epson740/*.upp ..
$ tar -zxvf ../../../gs/hpdj-2.6.tar.gz
$ tar -xvf hpdj-2.6/hpdj.tar
$ mv *.c *.h *.1 ..
$ cd ..
$ patch -s -p1 < ../../gs/ghostscript-5.50-cdj880.patch
$ cat tmp/contrib.mak-5.50.add  >>contrib.mak
$ patch -s -p1 < ../../gs/gs5.50-hpdj.patch
$ patch -s -p1 < ../../gs/gs5.50-lexmark5700.patch
$ mv gdevmd2k-0.2a/*.[ch] .
$ cat gdevmd2k-0.2a/gdevmd2k.mak-5.50 >>contrib.mak
$ perl -pi -e "s/^DEVICE_DEVS6=/DEVICE_DEVS6=md2k.dev md5k.dev /g" unix-gcc.mak
$ patch -s -p1 < ../../gs/gs5.50-lexmark7000.patch
$ patch -s -p1 < ../../gs/ghostscript-5.50-bmp16m.patch
$ patch -s -p1 < ../../gs/ghostscript-5.50-gcc296.patch
$ patch -s -p0 < ../../gs/ghostscript-5.50-jisb.patch
$ patch -s -p0 < ../../gs/ghostscript-5.50-ps.patch
$ rm -rf tmp/
$ ln -s unix-gcc.mak Makefile
$ mkdir obj
$ make obj
$ make obj/arch.h
$ ln -s obj/arch.h .
$ make gdevcd8.o
$ mv gdevcd8.o obj
$ make prefix=/usr/local >& make.log &
$ tail -f make.log
.....
cat ./obj/ld.tr >>./obj/ldt.tr
./obj/echogs -a ./obj/ldt.tr -s -  -lm
LD_RUN_PATH=; export LD_RUN_PATH; \
XCFLAGS= XINCLUDE= XLDFLAGS= XLIBDIRS= XLIBS= \
FEATURE_DEVS= DEVICE_DEVS= DEVICE_DEVS1= DEVICE_DEVS2= DEVICE_DEVS3= \
DEVICE_DEVS4= DEVICE_DEVS5= DEVICE_DEVS6= DEVICE_DEVS7= DEVICE_DEVS8= \
DEVICE_DEVS9= DEVICE_DEVS10= DEVICE_DEVS11= DEVICE_DEVS12= \
DEVICE_DEVS13= DEVICE_DEVS14= DEVICE_DEVS15= \
/bin/sh <./obj/ldt.tr
/usr/bin/ld: Undefined symbols:
_crc32
make: *** [obj/gs] Error 1
$ vi obj/ld.tr
.....
-lz \   # -lz should come last
$ make prefix=/usr/local
$ su
# mkdir -p tmp/usr/local/{bin,doc,man}
# make install prefix=`pwd`/tmp/usr/local mandir=`pwd`/tmp/usr/local
# tar -zxvf ../../../gs/gnu-gs-fonts-std-5.50.tar.gz
# tar -zxvf ../../../gs/gnu-gs-fonts-other-5.50.tar.gz
# chown -R root:wheel fonts/
# mv fonts tmp/usr/local/share/ghostscript/
# tar -zcvf ../../../../tgz/gs-5.50jp-bin.tar.gz -C tmp/ usr
# tar -zxvf ../../../../tgz/gs-5.50jp-bin.tar.gz -C /
# exit

 

[2] Ghostview

$ cd gv-3.5.8
$ patch -p1 -s < ../../gv/gv-3.5.8-config.patch
$ patch -p1 -s < ../../gv/gv-3.5.8-alias.patch
$ patch -p1 -s < ../../gv/gv-3.5.8-macosx.patch
$ xmkmf
$ make Makefiles
$ make
$ su
# mkdir -p tmp/private/etc
# ln -s private/etc tmp/etc
# make install DESTDIR=`pwd`/tmp

# tar -zcvf ../../../../tgz/gv-3.5.8-bin.tar.gz -C tmp/ .
# tar -zxvf ../../../../tgz/gv-3.5.8-bin.tar.gz -C /
# exit
 

[3] TeX Family

$ tar -zxvf ../ptex/web-7.2.tar.gz
$ tar -zxvf ../ptex/web2c-7.2.tar.gz
$ mkdir -p tmp/usr/local/share
$ tar -zxvf ../ptex/texmflib-7.3.tar.gz -C tmp/usr/local/share/
$ patch -p1 -s < ../ptex/mktexpk.patch
$ patch -p1 -s < ../ptex/mktexlsr.patch
$ pushd tmp/usr/local/share/texmf/tex/latex/base/
$ mv latex.ltx ../../../../../../../../tmp/latex.ltx.save
$ head -558 ../../../../../../../../tmp/latex.ltx.save > latex.ltx
$ tail +575 ../../../../../../../../tmp/latex.ltx.save >> latex.ltx
$ popd
$ export LD_LIBRARY_PATH=/Users/fujiik/sandbox/mypkg/src/ptex/build/tmp/usr/local/lib
$ su
# ln -s /Users/fujiik/sandbox/mypkg/src/ptex/build/tmp/usr/local/share/texmf /usr/local/share/.
# exit
$ cd web2c-7.2/
$ mv config.guess config.guess.ORIG
$ mv config.sub config.sub.ORIG
$ cp ../../../vflib/build/VFlib2/config.guess .
$ cp ../../../vflib/build/VFlib2/config.sub .
$ CFLAGS='-O' ./configure --prefix=/usr/local --datadir=/usr/local/share --with-x --with-x-toolkit=yes
$ TEXMF=`pwd`/../tmp/usr/local/share/texmf
$ make fmts=""
$ make prefix=`pwd`/../../../tmp/usr/local texmf="$TEXMF" fmts="" install

$ tar -zxvf ../../ptex/plib-1.4-euc.tar.gz -C `pwd`/../tmp/usr/local/share
$ tar -zxvf ../../ptex/ptex218.tar.gz -C web2c/
$ cd web2c/ptex218/
$ uudecode ../../../../ptex/Makefile.in.patch.txt
$ patch < Makefile.in.patch
$ ./configure EUC
$ make texmf="$TEXMF"
$ make prefix=`pwd`/../tmp/usr/local texmf="$TEXMF" install
$ cd ../..
$ mv ../tmp/usr/local/share/texmf/plib-1.4-euc.txt ..
$ mv web2c/ptex218/Changes.txt ..
$ mv web2c/ptex218/README.euc ..
$ pushd $TEXMF/web2c
$ cat ../../../../../../../ptex/texmf.cnf.patch | patch
$ popd
$ echo "ascgrp ascgrp" >> $TEXMF/fontname/special.map
$ echo "ascii  ascgrp" >> $TEXMF/fontname/special.map
$ mkdir -p ../tmp/private/var/tmp/texfonts
$ chmod 1777 ../tmp/private/var/tmp/texfonts
$ ln -s private/var ../tmp/var
$ ln -s mktexlsr ../tmp/usr/local/bin/MakeTeXls-R
$ su
# cd tmp
# tar -zcvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz .
# tar -zxvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz -C /

# cd ..
# mkdir -p tmp/usr/local/share/texmf/tex/{latex,platex,platex209}
# tar -zxvf ../platex/base-9906.tar.gz -C $TEXMF/tex/latex
# tar -zxvf ../platex/pl19990809e.tar.gz -C $TEXMF/tex/platex
# mv $TEXMF/tex/platex/19990809 $TEXMF/tex/platex/base
# tar -zxvf ../platex/ec.tar.gz
# tar -zxvf ../platex/ams-tfm.tgz
# tar -zxvf ../platex/ams-sources.tgz
# tar -zxvf ../platex/platex209.tar.gz
# mkdir -p $TEXMF/fonts/tfm/public/ec
# mkdir -p $TEXMF/fonts/tfm/source/ec
# cp -pPR ec/tfm/* $TEXMF/fonts/tfm/public/ec
# cp -pPR ec/ready-mf $TEXMF/fonts/source/ec
# rm -rf ec
# mkdir -p $TEXMF/fonts/tfm/ams
# mkdir -p $TEXMF/fonts/tfm/source/ams
# cp -pPR tfm/* $TEXMF/fonts/tfm/ams
# cp -pPR sources/* $TEXMF/fonts/source/ams
# rm -rf sources tfm
# mkdir -p $TEXMF/tex/platex209/base
# cp -pPR platex209/* $TEXMF/tex/platex209/base
# rm -rf platex209/

# TEXBIN=/usr/local/bin
# TEXMF=/usr/local/share/texmf
# BUILD_TEXBIN=`pwd`/tmp/usr/local/bin
# BUILD_TEXMF=`pwd`/tmp/usr/local/share/texmf
# TEXINPUTS=.:$BUILD_TEXMF/tex//
# TEXFORMATS=.:$BUILD_TEXMF/web2c:$TEXMF/web2c
# TEXPOOL=.:$BUILD_TEXMF/web2c:$TEXMF/web2c
# export TEXMF TEXINPUTS TEXFORMATS TEXPOOL

(cd $BUILD_TEXMF/tex/latex/base;$TEXBIN/tex -ini ./unpack.ins)
# (cd $BUILD_TEXMF/tex/latex/base;$TEXBIN/tex -ini ./latex.ltx)
# mv -f $BUILD_TEXMF/tex/latex/base/latex.fmt $BUILD_TEXMF/web2c
# (cd $BUILD_TEXBIN; ln -fs virtex latex)

# (cd $BUILD_TEXMF/tex/platex/base;$TEXBIN/ptex -ini ./plcore.ins)
# (cd $BUILD_TEXMF/tex/platex/base;$TEXBIN/ptex -ini ./platex.ltx)
# mv -f $BUILD_TEXMF/tex/platex/base/platex.fmt $BUILD_TEXMF/web2c
# (cd $BUILD_TEXBIN; ln -fs virptex platex)

# (cd $BUILD_TEXMF/tex/platex209/base;$TEXBIN/ptex -ini './jlplain.tex \dump')
# mv $BUILD_TEXMF/tex/platex209/base/jlplain.fmt $BUILD_TEXMF/web2c/jlatex.fmt
# (cd $BUILD_TEXBIN; ln -fs virptex jlatex)

# (cd $BUILD_TEXMF/tex/platex209/base;$TEXBIN/ptex -ini './plplain.tex \dump')
# mv $BUILD_TEXMF/tex/platex209/base/plplain.fmt $BUILD_TEXMF/web2c/platex209.fm
# (cd $BUILD_TEXBIN; ln -fs virptex platex209)
 
 

# tar  -zxvf ../latex/packages.tar.gz
# cd tmp
# mkdir -p usr/local/share/texmf/tex/latex/packages/amslatex
# mkdir -p usr/local/share/texmf/tex/latex/packages/babel
# mkdir -p usr/local/share/texmf/tex/latex/packages/expl3
# mkdir -p usr/local/share/texmf/tex/latex/packages/mfnfss
# mkdir -p usr/local/share/texmf/tex/latex/packages/psnfss
# mkdir -p usr/local/share/texmf/tex/latex/packages/graphics
# mkdir -p usr/local/share/texmf/tex/latex/packages/tools
# cd ../packages
# (cd amslatex/classes; ${TEXBIN}/latex ./amsclass.ins)
# (cd amslatex/math; ${TEXBIN}/latex ./amslatex.ins)
# (cd babel; ${TEXBIN}/latex ./babel.ins)
# (cd graphics; ${TEXBIN}/latex ./graphics.ins)
# (cd tools; ${TEXBIN}/latex ./tools.ins)
# TEXMF=$BUILD_TEXMF
# (cd amslatex/classes; install -m 644 * ${TEXMF}/tex/latex/packages/amslatex)
# (cd amslatex/math; install -m 644 * ${TEXMF}/tex/latex/packages/amslatex)
# (cd babel; install -m 644 * ${TEXMF}/tex/latex/packages/babel)
# (cd graphics; install -m 644 * ${TEXMF}/tex/latex/packages/graphics)
# echo "\ExecuteOptions{dvips}" > ${TEXMF}/tex/latex/packages/graphics/color.cfg
# echo "\ExecuteOptions{dvips}" > ${TEXMF}/tex/latex/packages/graphics/graphics.cfg
# (cd tools; install -m 644 * ${TEXMF}/tex/latex/packages/tools)
# cd ..
# rm -rf packages

# cd tmp
# mv -f latex.ltx.save ../tmp/usr/local/share/texmf/tex/latex/base/latex.ltx
# tar -zcvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz .
# tar -zxvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz -C /
# exit

$ tar -zxvf ../dvipsk/dvipsk-5.78a.tar.gz
$ cd dvipsk-5.78a/
$ tar -zxvf ../../dvipsk/dvipsk-jpatch-p1.4c.tar.gz
$ cd dvipsk
$ patch -p1 -s < ../dvipsk.patch
$ cd ..
$ mv config.guess config.guess.ORIG
$ mv config.sub config.sub.ORIG
$ cp ../../../vflib/build/VFlib2/config.guess .
$ cp ../../../vflib/build/VFlib2/config.sub .
$ ./configure --prefix=/usr/local
$ make CFLAGS='-O' >& make.log &
$ su
# make -C dvipsk prefix=`pwd`/../tmp/usr/local texmf=`pwd`/../tmp/usr/local/share/texmf install
# cp dvipsk/contrib/config.proto ../tmp/usr/local/share/texmf/dvips/config.ps
# cp dvipsk/psfonts.map ../tmp/usr/local/share/texmf/dvips/base/
# cd ../tmp
# tar -zxvf ../../../../tgz/jvf-1.0.tar.gz
# exit

$ cd ..
$ tar -zxvf ../xdvi/xdvik-20c.tar.gz
$ gzip -dc ../../xdvi/xdvik20c-j1.0p0c.patch.gz | patch -s -p1
$ patch -p1 -s < ../../xdvi/xdvik-20c-shrink.patch
$ patch -p1 -s < ../../xdvi/xdvik-20c-xaw3d.patch
$ mv config.guess config.guess.ORIG
$ mv config.sub config.sub.ORIG
$ cp ../../../vflib/build/VFlib2/config.guess .
$ cp ../../../vflib/build/VFlib2/config.sub .
$ ./configure --prefix=/usr/local --with-dvifilter=dvips --with-x-toolkit=yes
make VFLIB="-L/usr/local/lib -lVFlib2 -lttf" XDEFS="-DA4 -DNOTEXXET -DVI_KEY -DPTEX -DCOLOR -DBDPI=300 -DSHRINK=\\\"5\\\" -DSMALL_PANEL" x_ext_lib=-lXext >& make.log &
$ su
# mkdir -p ../tmp/usr/local/share/texmf/xdvi
# make prefix=`pwd`/../tmp/usr/local texmf=`pwd`/../tmp/usr/local/share/texmf install > & install.log &
# cp xdvik/xdvipaper.dvi2ps-j ../tmp/usr/local/share/texmf/xdvi/
# cp xdvik/xdvipaper.dvips  ../tmp/usr/local/share/texmf/xdvi/
# cp xdvik/xdvipaper.jdvi2kps  ../tmp/usr/local/share/texmf/xdvi/
# cat > ../tmp/usr/local/share/texmf/xdvi/vfontmap << EOF
 -> min     min     # for ASCII
 -> nmin    min     # for ASCII
 -> goth    goth    # for ASCII
 -> ngoth   goth    # for ASCII
 -> EOF
#exit

$ cd ..
$ tar -zxvf ../seetex/SeeTeX-2.19.tar.gz
$ gzip -dc ../../seetex/SeeTeX-2.19-2.19J.gz | patch -p1 -s
$ patch -p1 -s < ../../seetex/SeeTeX-2.19-glibc.patch
$ xmkmf
$ make Makefiles
$ $ make STD_DEFINES='-D_BSD_SOURCE' COMMON_SUBDIRS="libtex Dviselect Dviconcat" TEX_BINDIR=/usr/local/bin TEX_MANDIR=/usr/local/man/man1 FontDesc=/usr/local/share/texmf/dvi2ps/fontdesc
$ su
#  make COMMON_SUBDIRS="Dviselect Dviconcat" TEX_BINDIR=`pwd`/../tmp/usr/local/bin TEX_MANDIR=`pwd`/../tmp/usr/local/man/man1 MANSUFFIX=1 install install.man

# cd ../tmp
# chmod 1777 private/var/tmp/texfonts
# tar -zcvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz .
# tar -zxvf ../../../../tgz/pTeX-2.1.8-bin.tar.gz -C /
# exit
 

今までにコンパイルしたもののソースおよびパッチは macosx/src に、またバイナリーの tar ball は macosx/tgz または macosx/darwin.tgz にそれぞれ置いてある。いつものように使う場合は自己責任で。
 


Back to Keisuke Fujii's MkLinux/LinuxPPC Life