slackbuilds_ponce/office/mobiperl/mobiperl.SlackBuild
B. Watson 7f99e446f8 office/mobiperl: Added (MobiPocket tools).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2017-04-11 00:18:02 +07:00

72 lines
2.4 KiB
Bash

#!/bin/sh
# Slackware build script for mobiperl
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=mobiperl
VERSION=${VERSION:-0.0.43}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
ARCH=noarch
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Get rid of some perl module dependencies, replacing with stuff that's
# shipped with Slackware's perl package. Specifically:
# The obsolete Getopt::Mixed module is replaced by Getopt::Long.
# Date::Format is only used for ctime(), which is replaced by POSIX::ctime().
# Date::Parse is supposedly required, but is never used (removed it).
# For anyone reading this, no, this didn't break opf2mobi (it was
# already broken).
patch -p1 < $CWD/reduce_dependency_hell.diff
# lit2mobi calls convertlit by its old name, which might trigger
# stupid content filters. Replace with modern inoffensive name, in
# silly obfuscated way so this script doesn't contain the old name.
# (In case you're wondering, I'm not offended by this, I just don't want
# to get complaints from easily-offended people).
sed -i 's,\<cl[^\000-\150\152-]t\>,convertlit,g' MobiPerl/Util.pm lit2mobi
# It's pure Perl code (no shared libs), but not packaged as a perl module.
# We'll install the modules in the standard place for 3rd-party perl modules.
mkdir -p $PKG/usr/share/perl5/vendor_perl
cp -a Palm MobiPerl $PKG/usr/share/perl5/vendor_perl
mkdir -p $PKG/usr/man/man1 $PKG/usr/bin
EXES="html2mobi lit2mobi mobi2html mobi2mobi opf2mobi mobils"
for exe in $EXES; do
pod2man -c 'SlackBuilds.org' -r $VERSION $exe | gzip -9c > $PKG/usr/man/man1/$exe.1.gz
install -m0755 -oroot -groot $exe $PKG/usr/bin/$exe
done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README *.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}