PlamoBuild.ghostscript-9.52 を自分のカスタム環境用に編集した。
・カスタマイズの目的:
1) ghostscript の source に含まれている CJK表示確認用の psファイル類が
plamolinux デフォルトの ghostscriptパッケージに含まれていないので
/usr/share/ghostscript/9.52/examples / に配置するよう修正した。
2)cidfmap に幾つか追記し、WadaMin-RegularH や HeiseiKakuGo-W5 などの
非埋め込みフォント指定されている psファイルも日本語表示されるようにした。
$ cat PlamoBuild.ghostscript-9.52
-----------------------------------------------------------------------------------------------------
#!/bin/sh
##############################################################
pkgbase='ghostscript'
vers="9.52"
url="https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${vers/./}/${pkgbase}-${vers}.tar.xz"
digest="md5sum:2dd455dba172010b46225819a5485389"
#fonturl="https://downloads.sourceforge.net/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
# https://downloads.sourceforge.net/gs-fonts/gnu-gs-fonts-other-6.0.tar.gz"
fonturl="https://downloads.sourceforge.net/gs-fonts/ghostscript-fonts-std-8.11.tar.bz2"
verify=""
arch=`uname -m`
build=B5
src="${pkgbase}-${vers}"
OPT_CONFIG="--enable-dynamic
--with-ijs
--with-jbig2dec
--with-x
--with-drivers=ALL
--enable-fontconfig
--enable-freetype
--enable-openjpeg
--enable-cups
--enable-dynamic
--with-system-libtiff
--with-libpaper
--disable-compile-inits"
fontpath="/usr/share/ghostscript/fonts
/usr/share/fonts
/usr/share/fonts/TTF
/usr/share/poppler/cMap/"
DOCS='LICENSE'
# CVE-2020-15900
# https://github.com/ArtifexSoftware/ghostpdl/commit/5d499272b95a6b890a1397e11d20937de000d31b.patch
patchfiles="5d499272b95a6b890a1397e11d20937de000d31b.patch"
compress=txz
##############################################################
source /usr/share/plamobuild_functions.sh
# このスクリプトで使う1文字変数の意味
#
# $W : このスクリプトを動かすカレントディレクトリ
# $S : ソースコードのあるディレクトリ(デフォルト: $W/${src})
# $B : ビルド用ディレクトリ(デフォルト: /tmp/build{,32})
# $P : ビルドしたファイルをインストールするディレクトリ(デフォルト: $W/work)
if [ $# -eq 0 ] ; then
opt_download=0 ; opt_config=1 ; opt_build=1 ; opt_package=1
else
opt_download=0 ; opt_config=0 ; opt_build=0 ; opt_package=0
for i in $@ ; do
case $i in
download) opt_download=1 ;;
config) opt_config=1 ;;
build) opt_build=1 ;;
package) opt_package=1 ;;
esac
done
fi
if [ $opt_download -eq 1 ] ; then
download_sources
for f in $fonturl
do
if [ ! -f ${f##*/} ]; then
wget $f
fi
done
fi
if [ $opt_config -eq 1 ] ; then
if [ -d $B ] ; then rm -rf $B ; fi ; cp -a $S $B
######################################################################
# don't copy sources, so need patch in the src dir
######################################################################
cd $B
for patch in $patchfiles ; do
patch -p1 < $W/$patch
done
# force to use system libraries
# rm -r cups/libs freetype ijs jpeg lcms2 libpng openjpeg tiff zlib
# use in-tree freetype because bug
rm -rf freetype jpeg lcms2 libpng libtiff png tiff zlib
autoreconf -vi
( cd jbig2dec ; autoreconf --force --install )
( cd ijs ; autoreconf --force --install )
# fontpath
fp=
for p in $fontpath
do
fp=${fp}:$p
done
fp=${fp/:/}
export PKG_CONFIG_PATH=/usr/${libdir}/pkgconfig:/usr/share/pkgconfig:/opt/kde/${libdir}/pkgconfig
export LDFLAGS='-Wl,--as-needed'
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir='${prefix}'/share/man ${OPT_CONFIG} \
--with-fontpath="$fp"
if [ $? != 0 ]; then
echo "configure error. $0 script stop"
exit 255
fi
fi
if [ $opt_build -eq 1 ] ; then
cd $B
export LDFLAGS='-Wl,--as-needed'
make
make so
if [ $? != 0 ]; then
echo "build error. $0 script stop"
exit 255
fi
fi
if [ $opt_package -eq 1 ] ; then
check_root
if [ -d $P ] ; then rm -rf $P ; fi ; mkdir -p $P
cd $B
export LDFLAGS='-Wl,--as-needed'
make install DESTDIR=$P
make soinstall DESTDIR=$P
# Don't ship .la files:
pushd $P
for lafile in usr/lib/*.la ; do
rm -f ${lafile} /${lafile}
done
popd
# copy examples to /usr/share/ghostscript/${vers}/
cp -a $S/examples $P/usr/share/ghostscript/${vers}/
# remove man of de
rm -rfv $P/usr/share/man/de
# header
install -v -m644 base/*.h $P/usr/include/ghostscript
ln -v -s ghostscript $P/usr/include/ps
# install cidfmap
# install -v -m644 -D $W/cidfmap $P/usr/share/ghostscript/${vers}/Resource/Init/cidfmap
cat <<"EOF" >> $P/usr/share/ghostscript/${vers}/Resource/Init/cidfmap
/ipag << /FileType /TrueType /Path (/usr/share/fonts/TTF/ipag.ttf) /SubfontID 0 /CSI [ (Japan1) 6 ] >> ;
/ipagp << /FileType /TrueType /Path (/usr/share/fonts/TTF/ipagp.ttf) /SubfontID 0 /CSI [ (Japan1) 6 ] >> ;
/ipam << /FileType /TrueType /Path (/usr/share/fonts/TTF/ipam.ttf) /SubfontID 0 /CSI [ (Japan1) 6 ] >> ;
/ipamp << /FileType /TrueType /Path (/usr/share/fonts/TTF/ipamp.ttf) /SubfontID 0 /CSI [ (Japan1) 6 ] >> ;
/Ryumin-Light /ipam ;
/Ryumin-Medium /ipam ;
/GothicBBB-Medium /ipag ;
/ChuGothicBBB-Medium /GothicBBB-Medium ;
/ChuGothicBBB-Medium-Mono /MS-Gothic ;
/FutoGoB101-Bold /GothicBBB-Medium ;
/FutoMinA101-Bold /Ryumin-Light ;
/GothicMB101-Bold /GothicBBB-Medium ;
/GothicMB101-hea /GothicBBB-Medium ;
/GothicMB101-Ult /GothicBBB-Medium ;
/ShinGo-Bold /GothicBBB-Medium ;
/ShinGo-Medium /GothicBBB-Medium ;
/ShinGo-regular /GothicBBB-Medium ;
/MS-Gothic /ipag ;
/MS-PGothic /ipagp ;
/MSPGothic /ipagp ;
/MSMincho /ipam ;
/MS-Mincho /ipam ;
/MS-PMincho /ipamp ;
/MSPMincho /ipamp ;
/HeiseiMin-W3 /Ryumin-Light ;
/HeiseiKakuGo-W5 /GothicBBB-Medium ;
/Kochi-Mincho /Ryumin-Light ;
/Kochi-Gothic /GothicBBB-Medium ;
/WadaMin-Regular /ipam ;
/WadaMin-RegularH /ipam ;
/WadaMin-Bold /ipam ;
/WadaGo-Regular /ipag ;
/WadaGo-RegularH /ipag ;
/WadaGo-Bold /ipag ;
/Adobe-Japan1 /Ryumin-Light ;
/Adobe-Japan2 /Ryumin-Light ;
EOF
# install std_font
for f in $fonturl
do
tar xvf $W/${f##*/} --no-same-owner -C $P/usr/share/ghostscript/
done
# link to /usr/share/fonts
mkdir -p $P/usr/share/fonts
ln -sfv ../ghostscript/fonts $P/usr/share/fonts/gsfonts
mkdir -p $P/install
cat <> $P/install/initpkg
if [ -x /usr/bin/fc-cache ]; then
/usr/bin/fc-cache -v
fi
EOF
################################
# install tweaks
# strip binaries, delete locale except ja, compress man,
# install docs and patches, compress them and chown root.root
################################
install_tweak
# move doc dir
mv -v $P/usr/share/doc/ghostscript/${vers}/* $docdir/$src/
rm -rfv $docdir/ghostscript
#############################
# convert symlink to null file and
# add "ln -sf" command into install/doinst.sh
################################
convert_links
cd $P
/sbin/makepkg ../$pkg.$compress <y
1
EOF
fi
------------------------------------------------------------------------------------------------------------------
アップデート後の表示テスト結果
$ gv /usr/share/ghostscript/9.52/examples/cjk/all_aj1.ps
(HeiseiKakuGo-W5 フォントを ipaゴシックフォントでエミュレーション)
このページ(11ページ目)を印刷コマンドでプリンタに流したところ、
問題なくゴシック体で印刷できた。
( $ lp /usr/share/ghostscript/9.52/examples/cjk/all_aj1.ps -P 11 -d HP_Photosmart_5520 )
$ gv /usr/share/ghostscript/9.52/examples/cjk/all_aj2.ps
(WadaMin-RegularH フォントを ipa明朝フォントでエミュレーション)
コメント