Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2010
Device: none
|
How to install Calibre on FreeBSD
I think Calibre is great, but the information to get it working on my preferred O/S (FreeBSD) is pretty thin on the ground so I am posting this in the hope that it may be useful to someone.
It would be better if this was done in the port, but I don't know how to do that so this will have to do for the moment.
The port version on FreeBSD is well out of date at the moment. 7.23, current is 7.52
Here are the steps I use to get the newest version.
Before you start, you should make sure python is >=v2.7 and that all your QT ports are at the latest version. If you upgrade QT afterwards, Calibre may stop working.
1. Download latest from Kovid
2. Edit distfiles so that the checksum and size agree
3. Deinstall calibre (we're going to edit some files, and portupgrade will undo our changes by the extracting source again)
4. Edit Makefile and change Version to the right number
5. make extract
6. Get rid of all references to Bambook in builtins.py, driver.py and device.py
7. make install
8. Calibre should be installed and ready to go.
Note: Removing the Bambook device shouldn't cause any great hardship to most people, as I understand it, device detection is not supported other than for Linux and Windows.
Script started on Mon Mar 28 23:57:41 2011
[root@ /usr/ports/deskutils/calibre]# ls
Makefile distinfo pkg-descr pkg-plist calibre-0.7.52.tar.gz
[root@ /usr/ports/deskutils/calibre]# cat distinfo
SHA256 (calibre-0.7.23.tar.gz) = f68ce7414150e04c2f174f45b4def2c76ac2bfe751213353bc 771cd46f931f53
SIZE (calibre-0.7.23.tar.gz) = 17438838
[root@ /usr/ports/deskutils/calibre]# sha256 calibre-0.7.52.tar.gz >>distinfo
[root@ /usr/ports/deskutils/calibre]# ls -l
-rw-r--r-- 1 root wheel 236 Mar 28 23:59 distinfo
-rw-r--r-- 1 root wheel 27439729 Mar 26 02:47 calibre-0.7.52.tar.gz
-rw-r--r-- 1 root wheel 294 Oct 12 2009 pkg-descr
-rw-r--r-- 1 root wheel 98063 Oct 10 04:28 pkg-plist
-rw-r--r-- 1 root wheel 823 Mar 28 23:58 typescript
[root@ /usr/ports/deskutils/calibre]# vi distinfo
[root@ /usr/ports/deskutils/calibre]# cat distinfo
SHA256 (calibre-0.7.23.tar.gz) = f68ce7414150e04c2f174f45b4def2c76ac2bfe751213353bc 771cd46f931f53
SIZE (calibre-0.7.23.tar.gz) = 17438838
SHA256 (calibre-0.7.52.tar.gz) = 7652beca7c4ed0dadd9490448265efd1b19e723054e3950909 ac2f1550c11090
SIZE (calibre-0.7.52.tar.gz) = 27439729
[root@ /usr/ports/deskutils/calibre]# mv calibre-0.7.52.tar.gz /usr/ports/distfiles/
[root@ /usr/ports/deskutils/calibre]# vi Makefile
[root@ /usr/ports/deskutils/calibre]# grep PORTVERSION Makefile
PORTVERSION = 0.7.52
[root@ /usr/ports/deskutils/calibre]# make
===> Vulnerability check disabled, database not found
===> License check disabled, port has not defined LICENSE
===> Found saved configuration for calibre-0.7.49_1
===> Extracting for calibre-0.7.52_1
=> SHA256 Checksum OK for calibre-0.7.52.tar.gz.
<SNIP>
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/ebooks/metadata/meta.py", line 11, in <module>
from calibre.customize.ui import get_file_type_metadata, set_file_type_metadata
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/ui.py", line 14, in <module>
from calibre.customize.builtins import plugins as builtin_plugins
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py", line 581, in <module>
from calibre.devices.bambook.driver import BAMBOOK
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/devices/bambook/driver.py", line 15, in <module>
from calibre.devices.bambook.libbambookcore import Bambook, text_encoding, CONN_CONNECTED, is_bambook_lib_ready
ImportError: cannot import name text_encoding
*** Error code 1
Stop in /usr/ports/deskutils/calibre.
*** Error code 1
Stop in /usr/ports/deskutils/calibre.
*** Error code 1
Stop in /usr/ports/deskutils/calibre.
[root@ /usr/ports/deskutils/calibre]# cp /usr/ports/deskutils/calibre/work/calibre/src/calibre/devices/bambook/driver.py /usr/ports/deskutils/calibre/work/calibre/src/calibre/devices/bambook/driver.py.old
[root@ /usr/ports/deskutils/calibre]# pkg_deinstall calibre
---> Deinstalling 'calibre-0.7.49_1'
<SNIP>
[Updating the pkgdb <format:dbm_hash> in /var/db/pkg ... - 1038 packages found (-1 +0) (...) done]
[root@ /usr/ports/deskutils/calibre]# make install
####### Building extension progress_indicator #######
* Running gui
Traceback (most recent call last):
File "setup.py", line 99, in <module>
sys.exit(main())
File "setup.py", line 85, in main
command.run_all(opts)
File "/usr/ports/deskutils/calibre/work/calibre/setup/__init__.py", line 159, in run_all
self.run_cmd(self, opts)
File "/usr/ports/deskutils/calibre/work/calibre/setup/__init__.py", line 152, in run_cmd
self.run_cmd(scmd, opts)
File "/usr/ports/deskutils/calibre/work/calibre/setup/__init__.py", line 155, in run_cmd
cmd.run(opts)
File "/usr/ports/deskutils/calibre/work/calibre/setup/gui.py", line 36, in run
self.build_forms()
File "/usr/ports/deskutils/calibre/work/calibre/setup/gui.py", line 59, in build_forms
from calibre.gui2 import build_forms
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/gui2/__init__.py", line 19, in <module>
from calibre.ebooks.metadata.meta import get_metadata, metadata_from_formats
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/ebooks/metadata/meta.py", line 11, in <module>
from calibre.customize.ui import get_file_type_metadata, set_file_type_metadata
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/ui.py", line 14, in <module>
from calibre.customize.builtins import plugins as builtin_plugins
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py", line 581, in <module>
from calibre.devices.bambook.driver import BAMBOOK
File "/usr/ports/deskutils/calibre/work/calibre/src/calibre/devices/bambook/driver.py", line 15, in <module>
from calibre.devices.bambook.libbambookcore import Bambook, text_encoding, CONN_CONNECTED, is_bambook_lib_ready
ImportError: cannot import name text_encoding
*** Error code 1
Stop in /usr/ports/deskutils/calibre.
*** Error code 1
Stop in /usr/ports/deskutils/calibre.
[root@ /usr/ports/deskutils/calibre]# vi /usr/ports/deskutils/calibre/work/calibre/src/calibre/devices/bambook/driver.py
Remove all references BAMBOOK/Bambook/bambook (Sorry, should have a diff.)
[root@ /usr/ports/deskutils/calibre]# cp /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py.old
[root@ /usr/ports/deskutils/calibre]# vi /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py
Remove all references to BAMBOOK/Bambook/bambook. Here's the diff.
[root@ /usr/ports/deskutils/calibre]# diff /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py.old
diff /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py /usr/ports/deskutils/calibre/work/calibre/src/calibre/customize/builtins.py.old
580a581
> from calibre.devices.bambook.driver import BAMBOOK
699a701
> BAMBOOK,
[root@ /usr/ports/deskutils/calibre]# make install
===> Installing for calibre-0.7.52_1
Calibre should now be installed, but it won't run because there is more Bambook stuff in the device.py file.
[root@ /usr/ports/deskutils/calibre]# vi /usr/local/lib/calibre/calibre/gui2/device.py
Remove all references to BAMBOOK/Bambook/bambook. Sorry, no diff.
|