summaryrefslogtreecommitdiffstats
path: root/calibre
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2011-06-02 23:52:41 +0000
committer Eric Hameleers <alien@slackware.com>2011-06-02 23:52:41 +0000
commit2e0f14ffa26769c6c33899f580becec8a0b038f7 (patch)
treeca3f37d645e2eccc4abb8473d8f554908adbae89 /calibre
parente815d3cd69c996348a550aa243c35f268cef7034 (diff)
downloadasb-2e0f14ffa26769c6c33899f580becec8a0b038f7.tar.gz
asb-2e0f14ffa26769c6c33899f580becec8a0b038f7.tar.xz
This version successfully (no issues found in running it) built 0.8.3
A python2.7 plus supporting modules is built-in now
Diffstat (limited to 'calibre')
-rwxr-xr-xcalibre/build/calibre.SlackBuild638
1 files changed, 550 insertions, 88 deletions
diff --git a/calibre/build/calibre.SlackBuild b/calibre/build/calibre.SlackBuild
index 92c9c05d..ad40f04d 100755
--- a/calibre/build/calibre.SlackBuild
+++ b/calibre/build/calibre.SlackBuild
@@ -35,8 +35,9 @@
# * Initial build.
# 0.7.23-1: 12/oct/2010 by Eric Hameleers <alien@slackware.com>
# * Update.
-# 0.8.2-1: 24/may/2011 by Eric Hameleers <alien@slackware.com>
-# * Update.
+# 0.8.3-1: 02/jun/2011 by Eric Hameleers <alien@slackware.com>
+# * Update. Optionally, include the required python 2.7.x plus
+# additional modules in the package.
#
# Run 'sh calibre.SlackBuild' to build a Slackware package.
# The package (.tgz) and .txt file as well as build logs are created in /tmp .
@@ -47,25 +48,80 @@
# Set initial variables:
PRGNAM=calibre
-VERSION=${VERSION:-0.8.2}
+VERSION=${VERSION:-0.8.3}
BUILD=${BUILD:-1}
NUMJOBS=${NUMJOBS:" -j4 "}
TAG=${TAG:-alien}
DOCS="LICENSE* Changelog* COPYRIGHT README*"
-PYTHONLIB=$( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" )
+PYTHON=$(python -c 'import sys; print sys.version[:3]')
+
+# Only used in case we need to build our own python:
+INT_PYTHON=2.7.1
+INT_SETUPTOOLS=0.6c11
+INT_BEAUTIFULSOUP=3.2.0
+INT_DNSPYTHON=1.9.4
+INT_CSSUTILS=0.9.7
+INT_DATEUTIL=1.5
+INT_IMAGING=1.1.7
+INT_LXML=2.3
+INT_MECHANIZE=0.2.5
+INT_SIP=4.12.3
+INT_PYQT=4.8.4
# Where do we look for sources?
SRCDIR=$(cd $(dirname $0); pwd)
+PATCHDIR=${SRCDIR}/patches
# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
TMP=${TMP:-/tmp/build}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
-SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz"
-SRCURL="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz"
+SOURCE[0]="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz"
+SRCURL[0]="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz"
+
+if [ "$PYTHON" = "2.7" ]; then
+ BUILD_PYTHON="NO"
+else
+ # We need to build our own python 2.7 plus supporting modules:
+ BUILD_PYTHON="YES"
+
+ SOURCE[1]="$SRCDIR/Python-${INT_PYTHON}.tar.bz2"
+ SRCURL[1]="http://python.org/ftp/python/${INT_PYTHON}/Python-${INT_PYTHON}.tar.bz2"
+
+ SOURCE[2]="$SRCDIR/setuptools-${INT_SETUPTOOLS}.tar.gz"
+ SRCURL[2]="http://pypi.python.org/packages/source/s/setuptools/setuptools-${INT_SETUPTOOLS}.tar.gz"
+
+ SOURCE[3]="$SRCDIR/BeautifulSoup-${INT_BEAUTIFULSOUP}.tar.gz"
+ SRCURL[3]="http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-${INT_BEAUTIFULSOUP}.tar.gz"
+
+ SOURCE[4]="$SRCDIR/dnspython-${INT_DNSPYTHON}.tar.gz"
+ SRCURL[4]="http://www.dnspython.org/kits/${INT_DNSPYTHON}/dnspython-${INT_DNSPYTHON}.tar.gz"
+
+ SOURCE[5]="$SRCDIR/cssutils-${INT_CSSUTILS}.zip"
+ SRCURL[5]="http://cssutils.googlecode.com/files/cssutils-${INT_CSSUTILS}.zip"
+
+ SOURCE[6]="$SRCDIR/python-dateutil-${INT_DATEUTIL}.tar.gz"
+ SRCURL[6]="http://labix.org/download/python-dateutil/python-dateutil-${INT_DATEUTIL}.tar.gz"
+
+ SOURCE[7]="$SRCDIR/Imaging-${INT_IMAGING}.tar.gz"
+ SRCURL[7]="http://effbot.org/media/downloads/Imaging-${INT_IMAGING}.tar.gz"
+
+ SOURCE[8]="$SRCDIR/lxml-${INT_LXML}.tgz"
+ SRCURL[8]="http://codespeak.net/lxml/lxml-${INT_LXML}.tgz"
+
+ SOURCE[9]="$SRCDIR/mechanize-${INT_MECHANIZE}.tar.gz"
+ SRCURL[9]="http://wwwsearch.sourceforge.net/mechanize/src/mechanize-${INT_MECHANIZE}.tar.gz"
+
+ SOURCE[10]="$SRCDIR/PyQt-x11-gpl-${INT_PYQT}.tar.gz"
+ SRCURL[10]="http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-${INT_PYQT}.tar.gz"
+
+ SOURCE[11]="$SRCDIR/sip-${INT_SIP}.tar.gz"
+ SRCURL[11]="http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-${INT_SIP}.tar.gz"
+
+fi
##
## --- with a little luck, you won't have to edit below this point --- ##
@@ -114,23 +170,26 @@ rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log
# remove old log files
# Source file availability:
-if ! [ -f ${SOURCE} ]; then
- if ! [ "x${SRCURL}" == "x" ]; then
+for (( i = 0; i < ${#SOURCE[*]}; i++ )) ; do
+ if ! [ -f ${SOURCE[$i]} ]; then
+ echo "Source '$(basename ${SOURCE[$i]})' not available yet..."
# Check if the $SRCDIR is writable at all - if not, download to $OUTPUT
- [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename $SOURCE)"
- echo "Source '$(basename ${SOURCE})' not available yet..."
- echo "Will download file to $(dirname $SOURCE)"
- wget -nv -T 20 -O "${SOURCE}" "${SRCURL}" || true
- if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then
- echo "Downloading '$(basename ${SOURCE})' failed... aborting the build."
- mv -f "${SOURCE}" "${SOURCE}".FAIL
+ [ -w "$SRCDIR" ] || SOURCE[$i]="$OUTPUT/$(basename ${SOURCE[$i]})"
+ if [ -f ${SOURCE[$i]} ]; then echo "Ah, found it!"; continue; fi
+ if ! [ "x${SRCURL[$i]}" == "x" ]; then
+ echo "Will download file to $(dirname $SOURCE[$i])"
+ wget -nv -T 20 -O "${SOURCE[$i]}" "${SRCURL[$i]}" || true
+ if [ $? -ne 0 -o ! -s "${SOURCE[$i]}" ]; then
+ echo "Fail to download '$(basename ${SOURCE[$i]})'. Aborting the build."
+ mv -f "${SOURCE[$i]}" "${SOURCE[$i]}".FAIL
+ exit 1
+ fi
+ else
+ echo "File '$(basename ${SOURCE[$i]})' not available. Aborting the build."
exit 1
fi
- else
- echo "File '$(basename ${SOURCE})' not available... aborting the build."
- exit 1
fi
-fi
+done
if [ "$P1" == "--download" ]; then
echo "Download complete."
@@ -143,88 +202,484 @@ echo "++"
echo "|| $PRGNAM-$VERSION"
echo "++"
+if [ "$BUILD_PYTHON" = "YES" ]; then
+ # Sanity check: in case we need to build an internal set of python interpreter
+ # plus support modules, then you must not compile this package when calibre
+ # is already installed!
+ if [ -d /usr/lib${LIBDIRSUFFIX}/calibre/lib ]; then
+ echo ""
+ echo "** You have calibre installed in /usr/lib${LIBDIRSUFFIX}/calibre"
+ echo "** Compiling this package means you have to remove the existing"
+ echo "** calibre installation first, it conflicts with the compilation!"
+ echo ""
+ exit 1
+ fi
+fi
+
cd $TMP/tmp-$PRGNAM
echo "Extracting the source archive(s) for $PRGNAM..."
-tar -xvf ${SOURCE}
-cd ${PRGNAM}
-
-# Cut out the DOS crap:
-sed -i -e 's/\r//' src/calibre/web/feeds/recipes/*
-
-# Use standard manpage names:
-cat $SRCDIR/calibre.manpages.diff | patch -p1 --verbose \
- 2>&1 | tee $OUTPUT/patch-$PRGNAM.log
+tar -xvf ${SOURCE[0]}
+if [ "$BUILD_PYTHON" = "YES" ]; then
+for (( i = 1; i < ${#SOURCE[*]}; i++ )) ; do
+ if $(file ${SOURCE[$i]} | grep -qi ": zip"); then
+ unzip ${SOURCE[$i]}
+ else
+ tar -xvf ${SOURCE[$i]}
+ fi
+done
+fi
chown -R root:root .
chmod -R u+w,go+r-w,a+X-s .
echo Building ...
-OVERRIDE_CFLAGS="$SLKCFLAGS" python setup.py build \
- 2>&1 | tee $OUTPUT/make-${PRGNAM}.log
-
-# Create the directories the xdg-utils expects to be present:
-mkdir -p $PKG/usr/share/{applications,icons/hicolor,mime/packages}
-mkdir -p $PKG/usr/share/{desktop-directories,packages}
-
-# Create directory for calibre environment module:
-mkdir -p $PKG/$PYTHONLIB
-
-XDG_DATA_DIRS="$PKG/usr/share" \
-XDG_UTILS_INSTALL_MODE="system" \
-LIBPATH="/usr/lib${LIBDIRSUFFIX}" \
-python setup.py install \
- --root=$PKG/usr \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --staging-libdir=$PKG/usr/lib${LIBDIRSUFFIX} \
- 2>&1 | tee $OUTPUT/install-$PRGNAM.log
-
-# OK... first some fixes due to the below-par installer:
-
-# The bash completion files need to be in /etc :
-mv $PKG/usr/etc $PKG/
-
-# Move the man pages to the standard location:
-mv $PKG/usr/share/calibre/man $PKG/usr
-ln -sf /usr/man $PKG/usr/share/calibre/man
-
-# Mime type definition files end in .xml :
-mv $PKG/usr/share/mime/packages/calibre-mimetypes{,.xml}
-
-# This is stupid:
-rm -f $PKG/usr/bin/calibre-uninstall
-
-# I'd rather not ship 1.6MB of redundant fonts:
-( cd $PKG/usr/share/calibre/fonts/liberation/
- for FONT in *.ttf ; do
- rm $FONT
- ln -sf /usr/share/fonts/TTF/$FONT
- done
-)
-# All these files will be generated by update-mime-database:
-find $PKG/usr/share/mime -maxdepth 1 -type f | xargs rm -f
+#
+# Build python 2.7:
+#
+make_python() {
+
+echo -e "\n** python **\n"
+
+cd $TMP/tmp-$PRGNAM/Python-${INT_PYTHON}
+
+zcat $PATCHDIR/python.readline.set_pre_input_hook.diff.gz | patch -p1 --verbose
-# These files are generated by update-desktop-database while installing:
-rm -f $PKG/usr/share/applications/defaults.list
-rm -f $PKG/usr/share/applications/mimeinfo.cache
+# We are going to install python inside the calibre package. This requires some
+# changes to the standard build:
+# Creating the 'lib' directory below is needed! We are going to use rpath
+# so that we can run python from this non-standard path:
+mkdir -p /usr/lib${LIBDIRSUFFIX}/calibre/lib
-# These two served their purpose:
-rmdir $PKG/usr/share/{desktop-directories,packages}
+LDFLAGS="-Wl,-rpath /usr/lib${LIBDIRSUFFIX}/calibre/lib" \
+./configure \
+ --prefix=/usr/lib${LIBDIRSUFFIX}/calibre \
+ --bindir=/usr/lib${LIBDIRSUFFIX}/calibre \
+ --with-threads \
+ --enable-ipv6 \
+ --enable-shared \
+ --build=$ARCH-slackware-linux \
+ 2>&1 | tee $OUTPUT/configure-${PRGNAM}_python.log
-# And then some additions or it won't all look nice in your menu:
+make $NUMJOBS || make 2>&1 | tee $OUTPUT/make-${PRGNAM}_python.log
+make install DESTDIR=$PKG 2>&1 | tee -a $OUTPUT/make-${PRGNAM}_python.log
-# Add a MimeType icon for lrf, and add an application icon:
-for i in 16 24 32 48 64 96 128; do
- mkdir -p $PKG/usr/share/icons/hicolor/${i}x${i}/{apps,mimetypes}
- convert imgsrc/mimetypes/lrf.svg -scale $i \
- $PKG/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-x-sony-bbeb.png
- convert resources/images/library.png -resize ${i}x${i} \
- $PKG/usr/share/icons/hicolor/${i}x${i}/apps/calibre-gui.png
- convert imgsrc/viewer.svg -scale $i \
- $PKG/usr/share/icons/hicolor/${i}x${i}/apps/calibre-viewer.png
+# No need for man pages now:
+rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/calibre/share/man
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/python
+cp -a LICENSE README $PKG/usr/doc/$PRGNAM-$VERSION/python || true
+
+} # End of make_python
+
+#
+# Build pyseuptools:
+#
+make_setuptools() {
+
+echo -e "\n** setuptools **\n"
+
+cd $TMP/tmp-$PRGNAM/setuptools-${INT_SETUPTOOLS}
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_setuptools.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/setuptools
+cp -a *.txt $PKG/usr/doc/$PRGNAM-$VERSION/setuptools || true
+
+} # End make_setuptools
+
+#
+# Build BeautifulSoup:
+#
+make_BeautifulSoup() {
+
+echo -e "\n** BeautifulSoup **\n"
+
+cd $TMP/tmp-$PRGNAM/BeautifulSoup-${INT_BEAUTIFULSOUP}
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_BeautifulSoup.log
+
+} # End make_BeautifulSoup
+
+#
+# Build dnspython:
+#
+make_dnspython() {
+
+echo -e "\n** dnspython **\n"
+
+cd $TMP/tmp-$PRGNAM/dnspython-${INT_DNSPYTHON}
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_dnspython.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/dnspython
+cp -a ChangeLog LICENSE README TODO $PKG/usr/doc/$PRGNAM-$VERSION/dnspython || true
+
+} # End make_dnspython
+
+#
+# Build cssutils:
+#
+make_cssutils() {
+
+echo -e "\n** cssutils **\n"
+
+cd $TMP/tmp-$PRGNAM/cssutils-${INT_CSSUTILS}
+
+# The source is infested with DOS files:
+sed -i -e 's/\r//' $( find . -type f -exec file "{}" ";" | grep CRLF | cut -f1 -d: )
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_cssutils.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/cssutils
+cp -a COPYING* *.txt $PKG/usr/doc/$PRGNAM-$VERSION/cssutils || true
+
+} # End make_cssutils
+
+#
+# Build dateutil:
+#
+make_dateutil() {
+
+echo -e "\n** dateutil **\n"
+
+cd $TMP/tmp-$PRGNAM/python-dateutil-${INT_DATEUTIL}
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_dateutil.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/dateutil
+cp -a LICENSE NEWS README $PKG/usr/doc/$PRGNAM-$VERSION/dateutil || true
+
+} # End make_dateutil
+
+#
+# Build imaging:
+#
+make_imaging() {
+
+echo -e "\n** imaging **\n"
+
+cd $TMP/tmp-$PRGNAM/Imaging-${INT_IMAGING}
+
+# Installation path for headers:
+PYTHONINC=$( python -c 'from distutils.sysconfig import *;print get_python_inc()' )
+
+# Not needed in our internal build:
+## Fix library path on x86_64 :
+#cat $PATCHDIR/python-imaging.lib64.diff | patch -p1 --verbose \
+# 2>&1 | tee $OUTPUT/patch-$PRGNAM.log
+
+# Support transparent gifs:
+cat $PATCHDIR/python-imaging.giftrans.diff | patch -p1 --verbose \
+ 2>&1 | tee -a $OUTPUT/patch-$PRGNAM.log
+
+# Fix the python path for Scripts/*.py :
+for script in Scripts/*.py ; do
+ sed -i -e "s#/usr/local/bin/python#python#" $script
+ chmod 755 $script
done
+# Compile and install
+CFLAGS="$SLKCFLAGS" python setup.py build 2>&1 | tee $OUTPUT/make-${PRGNAM}_imaging.log
+( cd Sane
+ CFLAGS="$SLKCFLAGS" python setup.py build \
+ 2>&1 | tee -a $OUTPUT/make-${PRGNAM}_imaging.log
+)
+
+# Install all of this:
+mkdir -p $PKG/${PYTHONINC}/Imaging
+install -m 644 libImaging/*.h $PKG/${PYTHONINC}/Imaging
+python setup.py install --skip-build --root $PKG
+( cd Sane
+ python setup.py install --skip-build --root $PKG
+)
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/imaging
+cp -a README CHANGES $PKG/usr/doc/$PRGNAM-$VERSION/imaging || true
+
+} # End make_imaging
+
+#
+# Build lxml:
+#
+make_lxml() {
+
+echo -e "\n** lxml **\n"
+
+cd $TMP/tmp-$PRGNAM/lxml-${INT_LXML}
+
+# Compile and install
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_lxml.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/lxml
+cp -a *.txt doc/licenses $PKG/usr/doc/$PRGNAM-$VERSION/lxml || true
+
+} # End make_lxml
+
+#
+# Build mechanize:
+#
+make_mechanize() {
+
+echo -e "\n** mechanize **\n"
+
+cd $TMP/tmp-$PRGNAM/mechanize-${INT_MECHANIZE}
+
+# Compile and install
+export CFLAGS="$SLKCFLAGS"
+python setup.py install --root=$PKG 2>&1 | tee $OUTPUT/make-${PRGNAM}_mechanize.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/mechanize
+cp -a *.txt $PKG/usr/doc/$PRGNAM-$VERSION/mechanize || true
+
+} # End make_mechanize
+
+#
+# Build sip:
+#
+make_sip() {
+
+echo -e "\n** sip **\n"
+
+cd $TMP/tmp-$PRGNAM/sip-${INT_SIP}
+
+# Compile and install:
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+ python configure.py 2>&1 | tee $OUTPUT/configure-${PRGNAM}_sip.log
+make $NUMJOBS || make 2>&1 | tee $OUTPUT/make-${PRGNAM}_sip.log
+make install DESTDIR=$PKG 2>&1 | tee -a $OUTPUT/make-${PRGNAM}_sip.log
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/sip
+cp -a LICENSE COPYING* NEWS README TODO \
+ $PKG/usr/doc/$PRGNAM-$VERSION/sip || true
+
+} # End make_sip
+
+#
+# Build PyQt:
+#
+make_pyqt() {
+
+echo -e "\n** pyqt **\n"
+
+cd $TMP/tmp-$PRGNAM/PyQt-x11-gpl-${INT_PYQT}
+
+# Fix phonon detection:
+zcat $SRCDIR/patches/PyQt.phonon.diff.gz | patch -p1 --verbose
+
+# Compile and install
+# This avoids compiling a version number into KDE's .la files:
+export QTDIR=/usr/lib${LIBDIRSUFFIX}/qt
+
+export CFLAGS="$SLKCFLAGS"
+export CXXFLAGS="$SLKCFLAGS"
+
+python configure.py --confirm-license --verbose \
+ 2>&1 | tee $OUTPUT/configure-${PRGNAM}_pyqt.log
+make $NUMJOBS || make \
+ 2>&1 | tee $OUTPUT/make-${PRGNAM}_pyqt.log
+make install DESTDIR=$PKG \
+ 2>&1 | tee -a $OUTPUT/make-${PRGNAM}_pyqt.log
+
+# ... but remove ugly bits that threaten to overwrite a system file:
+rm -r $PKG/usr/lib${LIBDIRSUFFIX}/qt
+
+# Add documentation:
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/pyqt
+cp -a GPL_EXCEPTION*.TXT LICENSE.* NEWS OPENSOURCE-NOTICE.TXT README THANKS \
+ $PKG/usr/doc/$PRGNAM-$VERSION/pyqt || true
+
+} # End make_pyqt
+
+# --------------
+# Build calibre:
+# --------------
+make_calibre () {
+
+ echo -e "\n** calibre **\n"
+
+ cd $TMP/tmp-$PRGNAM/${PRGNAM}
+
+ # Place where we have to install stuff:
+ PYTHONLIB=$( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" )
+
+ # Create the directory for calibre's environment module:
+ mkdir -p $PKG$PYTHONLIB
+
+ # Find the prefix python was installed to (may be different from calibre's):
+ PYTHONROOT=$( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='/')" )
+ PYTHONPREF="${PYTHONLIB%$PYTHONROOT}"
+
+ # Massage the install script to actually install to that python libdir:
+ sed -e "/s.get_python_lib(prefix=/s,(prefix=.*),(prefix='$PKG$PYTHONPREF')," \
+ -i setup/install.py
+
+ # Cut out the DOS crap:
+ sed -i -e 's/\r//' src/calibre/web/feeds/recipes/*
+
+ # Use standard manpage names:
+ cat $PATCHDIR/calibre.manpages.diff | patch -p1 --verbose \
+ 2>&1 | tee $OUTPUT/patch-$PRGNAM.log
+
+ OVERRIDE_LDFLAGS="-Wl,-rpath /usr/lib${LIBDIRSUFFIX}/calibre/lib -L/usr/lib${LIBDIRSUFFIX}/calibre/lib" \
+ OVERRIDE_CFLAGS="$SLKCFLAGS" \
+ python setup.py build \
+ 2>&1 | tee $OUTPUT/make-${PRGNAM}.log
+
+ # Create the directories the xdg-utils expects to be present:
+ mkdir -p $PKG/usr/share/{applications,icons/hicolor,mime/packages}
+ mkdir -p $PKG/usr/share/{desktop-directories,packages}
+
+ XDG_DATA_DIRS="$PKG/usr/share" \
+ XDG_UTILS_INSTALL_MODE="system" \
+ LIBPATH="/usr/lib${LIBDIRSUFFIX}" \
+ python setup.py install \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --staging-root=$PKG/usr \
+ --staging-libdir=$PKG/usr/lib${LIBDIRSUFFIX} \
+ 2>&1 | tee $OUTPUT/install-$PRGNAM.log
+
+ # OK... first some fixes due to the below-par installer:
+
+ # The bash completion files need to be in /etc :
+ mv $PKG/usr/etc $PKG/
+
+ # Move the man pages to the standard location:
+ mv $PKG/usr/share/calibre/man $PKG/usr
+ ln -sf /usr/man $PKG/usr/share/calibre/man
+
+ # Mime type definition files end in .xml :
+ mv $PKG/usr/share/mime/packages/calibre-mimetypes{,.xml}
+
+ # This is stupid:
+ rm -f $PKG/usr/bin/calibre-uninstall
+
+ # I'd rather not ship 1.6MB of redundant fonts:
+ ( cd $PKG/usr/share/calibre/fonts/liberation/
+ for FONT in *.ttf ; do
+ rm $FONT
+ ln -sf /usr/share/fonts/TTF/$FONT
+ done
+ )
+
+ # All these files will be generated by update-mime-database:
+ find $PKG/usr/share/mime -maxdepth 1 -type f | xargs rm -f
+
+ # These files are generated by update-desktop-database while installing:
+ rm -f $PKG/usr/share/applications/defaults.list
+ rm -f $PKG/usr/share/applications/mimeinfo.cache
+
+ # These two served their purpose:
+ rmdir $PKG/usr/share/{desktop-directories,packages}
+
+ # And then some additions or it won't all look nice in your menu:
+
+ # Add a MimeType icon for lrf, and add an application icon:
+ for i in 16 24 32 48 64 96 128; do
+ mkdir -p $PKG/usr/share/icons/hicolor/${i}x${i}/{apps,mimetypes}
+ convert imgsrc/mimetypes/lrf.svg -scale $i \
+ $PKG/usr/share/icons/hicolor/${i}x${i}/mimetypes/application-x-sony-bbeb.png
+ convert resources/images/library.png -resize ${i}x${i} \
+ $PKG/usr/share/icons/hicolor/${i}x${i}/apps/calibre-gui.png
+ convert imgsrc/viewer.svg -scale $i \
+ $PKG/usr/share/icons/hicolor/${i}x${i}/apps/calibre-viewer.png
+ done
+
+} # End of make_calibre
+
+# Compilation of the software:
+if [ "$BUILD_PYTHON" = "YES" ]; then
+ # After each part is built we will sync to here because in the end, calibre
+ # will wipe the origin and we will have to sync it all back:
+ mkdir /usr/lib${LIBDIRSUFFIX}/calibre
+
+ make_python
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ # Ensure that our non-standard python2.7 is found and used:
+ export PATH="/usr/lib${LIBDIRSUFFIX}/calibre:$PATH"
+ export PKG_CONFIG_PATH="/usr/lib${LIBDIRSUFFIX}/calibre/lib/pkgconfig:$PKG_CONFIG_PATH"
+ export LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}/calibre/lib"
+
+ make_setuptools
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_BeautifulSoup
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_dnspython
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_cssutils
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_dateutil
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_imaging
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_lxml
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_mechanize
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_sip
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+ make_pyqt
+ rsync -a $PKG/usr/lib${LIBDIRSUFFIX}/calibre/ /usr/lib${LIBDIRSUFFIX}/calibre/
+
+fi
+
+make_calibre
+
+if [ "$BUILD_PYTHON" = "YES" ]; then
+
+ # Compiling calibre will have wiped all previously compiled python stuff,
+ # so we need to put it back into the package, and then it can go:
+ rsync -a /usr/lib${LIBDIRSUFFIX}/calibre/ $PKG/usr/lib${LIBDIRSUFFIX}/calibre/
+ rm -rf /usr/lib${LIBDIRSUFFIX}/calibre
+
+ ##!/bin/sh
+ #path=`readlink -e $0`
+ #base=`dirname $path`
+ #export PATH=$base/bin:$PATH
+ #export LD_LIBRARY_PATH=$base/lib:$LD_LIBRARY_PATH
+ #$base/bin/calibre "$@"
+
+ # We need to tell calibre to use the internal python:
+ for FILE in $PKG/usr/bin/* ; do
+ if ! file $FILE | grep -q ELF ; then
+ sed -i \
+ -e "s,^#!/usr/bin/env .*$,#!/usr/lib${LIBDIRSUFFIX}/calibre/python," \
+ $FILE
+ fi
+ done
+
+ # This is not needed in the package:
+ #rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/calibre/{bin,include,lib/pkgconfig,share}
+ rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/calibre/{bin,lib/pkgconfig,share}
+
+fi
+
# Create a doinst.sh:
mkdir -p $PKG/install
cat <<EOT >> $PKG/install/doinst.sh
@@ -244,6 +699,7 @@ EOT
# Add documentation:
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
+cp -a $SRCDIR/patches $PKG/usr/doc/$PRGNAM-$VERSION
cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc -type f -exec chmod 644 {} \;
@@ -261,7 +717,13 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
# Add a package description:
mkdir -p $PKG/install
cat $SRCDIR/slack-desc > $PKG/install/slack-desc
-cat $SRCDIR/slack-required > $PKG/install/slack-required
+if [ "$BUILD_PYTHON" = "YES" ]; then
+ cat $SRCDIR/slack-required \
+ | grep -Ev "BeautifulSoup|dnspython|pysetuptools|python-cssutils|python-dateutil|python-imaging|python-mechanize|python-lxml" \
+ > $PKG/install/slack-required
+else
+ cat $SRCDIR/slack-required > $PKG/install/slack-required
+fi
# Build the package:
cd $PKG