Commit 46d1474d authored by abveritas's avatar abveritas

Rebuild calibre, has desktop entries now

parent 375918a8
......@@ -8,15 +8,16 @@ source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
pkgname=calibre
pkgver=0.7.35
pkgrel=1
pkgrel=2
pkgdesc="E-book library management application"
arch=('i686' 'x86_64')
url="http://calibre.kovidgoyal.net/"
license=('GPL3')
depends=('python2' 'python-distribute' 'python-imaging' 'libusb' 'pyqt' 'python-mechanize'
depends=('python2' 'python-imaging' 'libusb' 'pyqt' 'python-mechanize'
'imagemagick' 'dbus-python' 'python-lxml' 'beautiful-soup' 'python-dateutil'
'python-cssutils-beta' 'desktop-file-utils' 'shared-mime-info' 'python-dnspython'
'podofo>=0.8.1-6' 'xdg-utils' 'cherrypy' 'python-pypdf' 'unrar' 'chmlib' 'poppler' 'poppler-qt' 'liblqr' 'icu' 'sip' 'libffi')
makedepends=('python-distribute')
install=calibre.install
source=(http://downloads.sourceforge.net/project/calibre/${pkgver}/${pkgname}-${pkgver}.tar.gz)
md5sums=('4b2fb8e12ab7de2eec6e07962e438f0f')
......@@ -24,25 +25,41 @@ md5sums=('4b2fb8e12ab7de2eec6e07962e438f0f')
build() {
cd "${pkgname}"
rm -rf src/{cherrypy,pyPdf} || return 1
rm -rf src/{cherrypy,pyPdf}
# Hador patches
sed -e "/render_img('mimetypes\/lrf.png', 'calibre-lrf.png')/,/self.icon_resources.append(('apps', 'calibre-viewer', '128'))/c \ \
dir = os.path.join(self.opts.staging_sharedir,'../pixmaps')\n \
os.mkdir(dir)\n \
render_img('mimetypes/lrf.png', os.path.join(dir,'calibre-lrf.png'))\n \
render_img('lt.png', os.path.join(dir, 'calibre-gui.png'))\n \
render_img('viewer.png', os.path.join(dir, 'calibre-viewer.png'))" \
-e "/f = open('calibre-lrfviewer.desktop', 'wb')/c \ \
dir = os.path.join(self.opts.staging_sharedir,'../applications')\n \
os.mkdir(dir)\n \
f = open(os.path.join(dir, 'calibre-lrfviewer.desktop'), 'wb')" \
-e "s/if mt and 'chemical' not in mt:/if mt and 'chemical' not in mt and 'text' not in mt and 'pdf' not in mt and 'xhtml' not in mt:/g" \
-e "s/f = open('calibre-ebook-viewer.desktop', 'wb')/f = open(os.path.join(dir, 'calibre-ebook-viewer.desktop'), 'wb')/g" \
-e "s/f = open('calibre-gui.desktop', 'wb')/f = open(os.path.join(dir, 'calibre-gui.desktop'), 'wb')/g" \
-e "/des = ('calibre-gui.desktop', 'calibre-lrfviewer.desktop',/,/f = open('calibre-mimetypes', 'wb')/c \ \
dir = os.path.join(self.opts.staging_sharedir,'../mime/packages/')\n \
os.makedirs(dir)\n \
f = open(os.path.join(dir, 'calibre.xml'), 'wb')" \
-e "/self.mime_resources.append('calibre-mimetypes')/,/check_call('xdg-mime install .\/calibre-mimetypes', shell=True)/d" \
-i src/calibre/linux.py
# Larryhaja patches
sed -ie "/self.setup_desktop_integration()/,/os.rmdir(config_dir)/d" src/calibre/linux.py || return 1
sed -ie "s|self.opts.staging_sharedir, 'man/man1'|self.opts.staging_root, 'usr/share/man/man1'|" src/calibre/linux.py || return 1
sed -ie "s|manpath, prog+'.1'+__appname__+'.bz2'|manpath, prog+'.1'+'.bz2'|" src/calibre/linux.py || return 1
sed -ie "s/ldflags = shlex.split(ldflags)/ldflags = shlex.split(ldflags) + ['-fPIC']/" setup/extensions.py || return 1
sed -e "s:old_udev = '/etc:old_udev = '${pkgdir}/etc:" -i src/calibre/linux.py || return 1
# Temp
perl -pe 'undef $/; s/if islinux:\n\n/\n/' src/calibre/linux.py > src/calibre/linux.py.tmp
mv -f src/calibre/linux.py.tmp src/calibre/linux.py
sed -e "/self.create_uninstaller()/,/os.rmdir(config_dir)/d" \
-e "s|self.opts.staging_sharedir, 'man/man1'|self.opts.staging_root, 'usr/share/man/man1'|" \
-e "s|manpath, prog+'.1'+__appname__+'.bz2'|manpath, prog+'.1'+'.bz2'|" \
-e "s:old_udev = '/etc:old_udev = '${pkgdir}/etc:" -i src/calibre/linux.py
sed -e "s/ldflags = shlex.split(ldflags)/ldflags = shlex.split(ldflags) + ['-fPIC']/" -i setup/extensions.py
# Disable unnecessary privilege dropping
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" -i setup/install.py || return 1
sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" -i setup/install.py
python2 setup.py build || return 1
#python setup.py install --root=${pkgdir} --prefix=/usr || return 1
python2 setup.py build
}
package() {
......@@ -52,19 +69,18 @@ package() {
python2 setup.py install --root=${pkgdir} --prefix=/usr \
--staging-bindir=${pkgdir}/usr/bin \
--staging-libdir=${pkgdir}/usr/lib \
--staging-sharedir=${pkgdir}/usr/share || return 1
--staging-sharedir=${pkgdir}/usr/share
find ${pkgdir} -type d -empty -delete
sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
-e "s|#![ ]*/usr/bin/env *python$|#!/usr/bin/env python2|" \
$( find "${pkgdir}" -type f -regex ".+\.py\|.+\.recipe" )
# Decompress the man pages so makepkg will do it for us.
for decom in ${pkgdir}/usr/share/man/man1/*.bz2; do
bzip2 -d ${decom}
done
sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
-e "s|#![ ]*/usr/bin/env *python$|#!/usr/bin/env python2|" \
$( find "${pkgdir}" -type f -name "*.py" )
find "${pkgdir}/usr/bin" -type f -exec sed -i -e "s|#![ ]*/usr/bin/env *python$|#!/usr/bin/env python2|" {} +
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment