Browse Source

ap/fop: Upgraded to fop-1.0.

slackware-14.2
Damien Goutte-Gattat 11 years ago
parent
commit
ea8b7fded1
  1. 12
      ap/fop/doinst.sh
  2. 1
      ap/fop/fop-0.95-bin.tar.gz.sha1
  3. 1
      ap/fop/fop-1.0-bin.tar.gz.sha1
  4. 39
      ap/fop/fop.SlackBuild
  5. 1
      ap/fop/offo-hyphenation-binary_v2.0.zip.sha1
  6. 1
      ap/fop/offo-hyphenation-fop-stable.zip.sha1
  7. 126
      ap/fop/ttf2fop.sh

12
ap/fop/doinst.sh

@ -0,0 +1,12 @@
#!/bin/sh
config()
{
NEW="$1"
OLD="`dirname $NEW`/`basename $NEW .new`"
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
rm $NEW
fi
}
config etc/fop.conf.new

1
ap/fop/fop-0.95-bin.tar.gz.sha1

@ -1 +0,0 @@
4d59d4a4b6704965cab87cfdb4b49e0d86b7837f fop-0.95-bin.tar.gz

1
ap/fop/fop-1.0-bin.tar.gz.sha1

@ -0,0 +1 @@
2e81bc0b6d26cba8af7d008cffe6a46955a82a4f fop-1.0-bin.tar.gz

39
ap/fop/fop.SlackBuild

@ -1,6 +1,6 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2008,2010 Damien Goutte-Gattat
# Copyright (C) 2008,2010,2011 Damien Goutte-Gattat
#
# Redistribution and use of this script, with or without modifications,
# is permitted provided that the following conditions are met:
@ -29,15 +29,15 @@
# Source package infos
NAMESRC=${NAMESRC:-fop}
VERSION=${VERSION:-0.95}
VERSION=${VERSION:-1.0}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION-bin.tar.gz}
WGET=${WGET:-ftp://mir1.ovh.net/ftp.apache.org/dist/xmlgraphics/fop/binaries/$ARCHIVE}
HYPH_SRC=${HYPH_SRC:-offo-hyphenation-fop-stable.zip}
HYPH_WGET=${HYPH_WGET:-http://surfnet.dl.sourceforge.net/sourceforge/offo/$HYPH_SRC}
HYPH_SRC=${HYPH_SRC:-offo-hyphenation-binary_v2.0.zip}
HYPH_WGET=${HYPH_WGET:-http://downloads.sourceforge.net/offo/$HYPH_SRC}
# Built package infos
NAMETGZ=${NAMETGZ:-fop}
BUILD=${BUILD:-2GGD}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-noarch}
EXT=${EXT:-txz}
@ -70,13 +70,14 @@ sha1sum -c $ARCHIVE.sha1
sha1sum -c $HYPH_SRC.sha1
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
# Prepare the package tree
# Extract
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
unzip $CWD/$HYPH_SRC
# Install Java libraries
mkdir -p $PKG/usr/lib/apache-xml
install -m 644 \
lib/avalon-framework-4.2.0.jar \
@ -84,13 +85,18 @@ install -m 644 \
lib/commons-io-1.3.1.jar \
lib/commons-logging-1.0.4.jar \
lib/xml-apis-ext-1.3.04.jar \
lib/xmlgraphics-commons-1.3.1.jar \
offo-hyphenation-fop-stable/fop-hyph.jar \
lib/xmlgraphics-commons-1.4.jar \
offo-hyphenation-binary/fop-hyph.jar \
$PKG/usr/lib/apache-xml
install -m 644 build/fop.jar $PKG/usr/lib/apache-xml/fop-$VERSION.jar
install -D -m 644 conf/fop.xconf $PKG/etc/fop.conf
# Install configuration file
install -D -m 644 conf/fop.xconf $PKG/etc/fop.conf.new
# Install executable scripts
install -D -m 755 $CWD/fop.sh $PKG/usr/bin/fop
install -m 755 $CWD/fop-ttfreader.sh $PKG/usr/bin/fop-ttfreader
install -m 755 $CWD/ttf2fop.sh $PKG/usr/bin/ttf2fop
# Install the documentation
mkdir -p $PKG/usr/doc/$NAME/offo
@ -100,11 +106,20 @@ find docs -type f -name '*.pdf' -delete
mv docs $PKG/usr/doc/$NAME/html
mv javadocs $PKG/usr/doc/$NAME/html/apidocs
mv examples $PKG/usr/doc/$NAME
install -m 644 offo-hyphenation-fop-stable/*.html $PKG/usr/doc/$NAME/offo
cp -r offo-hyphenation-fop-stable/{images,skin} $PKG/usr/doc/$NAME/offo
install -m 644 offo-hyphenation-binary/*.html $PKG/usr/doc/$NAME/offo
cp -r offo-hyphenation-binary/{images,skin} $PKG/usr/doc/$NAME/offo
# Create metric files for some standard fonts
mkdir -p $PKG/usr/share/fop/fonts
( cd $PKG/usr/share/fop/fonts
sh $CWD/ttf2fop.sh -l $PKG/usr/lib/apache-xml \
/usr/share/fonts/TTF/DejaVu* /usr/share/fonts/TTF/Liberation* \
> fonts.xml
)
# Copy slack-desc file
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG

1
ap/fop/offo-hyphenation-binary_v2.0.zip.sha1

@ -0,0 +1 @@
e6f4631ff33fea67a3945d9b1cd6f5855270c8bb offo-hyphenation-binary_v2.0.zip

1
ap/fop/offo-hyphenation-fop-stable.zip.sha1

@ -1 +0,0 @@
81f0b0962868714fa67eceba68f60fc5ffcb79da offo-hyphenation-fop-stable.zip

126
ap/fop/ttf2fop.sh

@ -0,0 +1,126 @@
#!/bin/bash
# ttf2fop - Prepare TrueType fonts for use with Apache FOP
# Copyright (C) 2011 Damien Goutte-Gattat
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
set -e
program_name=${0##*/}
fop_libs_dir=/usr/lib/apache-xml
fop_fonts_dir=/usr/share/fop/fonts
die()
{
echo "$program_name: $@" >&2
exit 1
}
show_usage()
{
cat <<EOH
Usage: $program_name [options] TTF_FILE...
Generate a FOP metrics file for each TTF file given on the
command line. If no file is given, read TTF filenames from
standard input.
Options:
-h, --help Show this help message.
-v, --version Show the version message.
-l, --fop-libs PATH Specify the location of FOP
Jar files (default: $fop_libs_dir).
-d, --fonts-dir PATH Specify the directory where the
metrics file should be stored
(default: $fop_fonts_dir).
EOH
}
process_ttf_file()
{
fontfile=$1
[ -f "$fontfile" ] || return
fontname=$(basename $fontfile .ttf)
fontbasename=$(echo $fontname | cut -d- -f1)
fontstylespec=$(echo $fontname | cut -d- -f2)
case "$fontstylespec" in
Italic|Oblique)
fontstyle=italic
fontweight=normal
filequalifier=italic
;;
Bold)
fontstyle=normal
fontweight=bold
filequalifier=bold
;;
BoldItalic|BoldOblique)
fontstyle=italic
fontweight=bold
filequalifier=bold-italic
;;
*)
fontstyle=normal
fontweight=normal
filequalifier=regular
;;
esac
java -cp $fop_libs_dir:$fop_libs_dir/* \
org.apache.fop.fonts.apps.TTFReader -q \
$fontfile $fontbasename-$filequalifier.xml
cat <<EOF
<font metrics-url="$fop_fonts_dir/$fontbasename-$filequalifier.xml"
embed-url="$fontfile"
kerning="yes">
<font-triplet name="$fontbasename" style="$fontstyle" weight="$fontweight" />
</font>
EOF
}
while true ; do
case "$1" in
-h|--help)
show_usage
exit 0
;;
-v|--version)
sed -n '2,/^$/ s/^# //' $0
exit 0
;;
-l|--fop-libs)
[ -n "$2" ] || die "missing argument for option --fop-libs"
fop_libs_dir=$2
shift 2
;;
-d|--fonts-dir)
[ -n "$2" ] || die "missing argument for option --fonts-dir"
fop_fonts_dir=$2
shift 2
;;
*)
break
;;
esac
done
echo "<?xml version=\"1.0\"?>"
echo "<fonts>"
if [ -z "$*" ]; then
cat | while read f ; do process_ttf_file $f ; done
else
for f in "$@" ; do process_ttf_file $f ; done
fi
echo "</fonts>"
Loading…
Cancel
Save