desktop/calibre/PKGBUILD
2015-07-19 03:10:00 +00:00

81 lines
3.0 KiB
Bash

pkgname=calibre
pkgver=2.32.1
pkgrel=1
pkgdesc="Ebook management application"
arch=('x86_64')
url="http://calibre.kovidgoyal.net/"
license=('GPL3')
depends=('python2-six' 'python2-dateutil' 'python2-cssutils' 'python2-cherrypy'
'python2-mechanize' 'podofo' 'libwmf'
'imagemagick' 'chmlib' 'python2-lxml' 'libusb'
'python2-pillow' 'shared-mime-info' 'python2-dns'
'python2-pyqt5' 'python2-psutil' 'icu' 'libmtp' 'python2-dbus'
'python2-netifaces' 'python2-cssselect' 'python2-apsw' 'qt5-webkit'
'qt5-svg' 'python2-chardet' 'python2-html5lib' 'python2-pygments')
makedepends=('python2-pycountry' 'qt5-x11extras')
optdepends=('ipython2: to use calibre-debug'
'udisks: required for mounting certain devices')
screenshot=('https://lh5.googleusercontent.com/_lG58t3XWd3c/TcNwiXkAx_I/AAAAAAAAAEc/M34I4uY9UUY/s800/gui.jpeg')
install=${pkgname}.install
source=("http://download.calibre-ebook.com/${pkgver}/${pkgname}-${pkgver}.tar.xz")
sha256sums=('2fca4408cc304bdf43ada5a920147c00246a285506c9d0583ed72ee472a4b84d')
prepare() {
cd ${pkgname}-${pkgver}
# Remove unneded files and libs
rm -rf resources/${pkgname}-portable.* \
src/cherrypy \
#src/chardet \
#src/html5lib
sed -i -e "s/shlex.split(ldflags)/& + ['-fPIC']/" setup/extensions.py
sed -i 's:\(env[ ]\+python$\|/usr/bin/python$\):\12:g' \
$(find . -regex ".*\.py\|.*\.recipe")
sed -i "/pyqt_sip_dir/ s:=.*:= '/usr/share/sip/Py2-PyQt5':" setup/build_environment.py
# Desktop integration (e.g. enforce arch defaults)
sed -e "/self.create_uninstaller()/,/os.rmdir(config_dir)/d" \
-e "/\(cc('xdg-icon-resource\|self.icon_resources.append\|'128'))\)/d" \
-e "/render_img/ s/\('calibre-.*\.png'\)/os.path.join(dir, \1)/g" \
-e "/dir, 'calibre-lrf.png'/i \
\ dir = os.path.join(self.opts.staging_sharedir,'../pixmaps')\n\
\ os.mkdir(dir)" \
-e "/f = open/ s/\('calibre-.*\.desktop'\)/os.path.join(dir, \1)/g" \
-e "/dir, 'calibre-lrfviewer.desktop'/i \
\ dir = os.path.join(self.opts.staging_sharedir,'../applications')\n\
\ os.mkdir(dir)" \
-e "s/'ctc-posml'/'text' not in mt and 'pdf' not in mt and 'xhtml'/" \
-e "s/^Name=calibre/Name=Calibre/g" \
-i src/calibre/linux.py
}
build() {
cd ${pkgname}-${pkgver}
LANG=en_US.UTF-8 python2 setup.py build
LANG=en_US.UTF-8 python2 setup.py translations
}
package() {
cd ${pkgname}-${pkgver}
# Fix the environment module location
sed -i -e "s|(prefix=.*)|(prefix='${pkgdir}/usr')|g" setup/install.py
install -d "${pkgdir}/usr/lib/python2.7/site-packages"
install -d "${pkgdir}/usr/share/zsh/site-functions"
LANG=en_US.UTF-8 python2 setup.py install \
--root="${pkgdir}" \
--prefix=/usr \
--staging-bindir="${pkgdir}/usr/bin" \
--staging-libdir="${pkgdir}/usr/lib" \
--staging-sharedir="${pkgdir}/usr/share"
python2 -m compileall "${pkgdir}/usr/lib/calibre/"
python2 -O -m compileall "${pkgdir}/usr/lib/calibre/"
}