summaryrefslogtreecommitdiffstats
path: root/testing/calibre/APKBUILD
blob: ae92df9ec64eb140fdbb5bcc407aef9ce7784b3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Contributor: Francesco Colista <francesco.colista@gmail.com>
# Maintainer:
pkgname=calibre
pkgver=0.8.45
pkgrel=5
pkgdesc="Ebook management application"
url="http://calibre-ebook.com/"
arch="all"
license="GPL3"
depends=
depends_dev="python-dev imagemagick-dev py-qt py-sip py-imaging libusb-dev
	poppler-dev poppler-qt4-dev py-dbus py-pycountry py-lxml icu-dev
	desktop-file-utils py-sqlite sqlite-dev chmlib-dev podofo-dev
	py-sip-dev py-dateutil py-cherrypy py-beautifulsoup py-mechanize
	py-dnspython shared-mime-info unrar xdg-utils"
makedepends="$depends_dev"
install=""
subpackages=""
source="http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.xz
	calibre.confd
	calibre.initd"
_builddir="$srcdir"/$pkgname
build() {
	cd "$_builddir"
  	rm -rf src/cherrypy
	sed -i -e "s/ldflags = shlex.split(ldflags)/ldflags = shlex.split(ldflags) + ['-fPIC']/" setup/extensions.py
	sed -i -e 's:\(#!/usr/bin/env[ ]\+python$\|#!/usr/bin/python$\):\12:g' \
	$(find . -regex ".*.py\|.*.recipe")
	python setup.py build
	python setup.py resources
	python setup.py translations
}
package() {
	cd "$_builddir"
	 # More on desktop integration (e.g. enforce arch defaults)
	sed -i -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|" \
		-e "s/^Name=calibre/Name=Calibre/g" src/calibre/linux.py
	# Create a dir for ebook repository
	mkdir -p "${pkgdir}/var/lib/calibre"
	# 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"
	python setup.py install --root="${pkgdir}" --prefix=/usr \
		--no-postinstall \
		--staging-bindir="${pkgdir}/usr/bin" \
		--staging-libdir="${pkgdir}/usr/lib" \
		--staging-sharedir="${pkgdir}/usr/share"
	install -m755 -D ../$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
        install -m644 -D ../$pkgname.confd \
                "$pkgdir"/etc/conf.d/$pkgname || return 1
}
md5sums="005d5d9a0128f9f56493428aad176ee2  calibre-0.8.45.tar.xz
a53086675b33859da1d18cc21daa090b  calibre.confd
96a7744a8b5d63ed8fbe3c4919b0e40f  calibre.initd"