I want to report that I moved my project forward.
As I want to understand how mobi format works I focused on recreating html-like markup from mobi file.
I implemented reconstruction of internal references to html targets.
Apart from reading and parsing mobi documents, libmobi should now be able to produce a set of files that may be used as an input to kindlegen.
I am sure there are still bugs and need for improvements. I am short of time and mobi format samples, but I will be working on it.
For those who would like to test it, but don't know how to compile programs, I attach statically built binaries for several architectures. The program – mobitool is very simple. Its main function is turning mobi document into markup files. Precompiled binaries may or may not work for your particular system. The best and recommended way to test the library is to compile it from sources (from github). Mobitool is build together with the library. The process is quite straightforward.
UPDATE: I removed outdated binaries. Please download current releases from project's github page.
Code:
usage: mobitool [-diemrsuvx7] [-o dir] [-p pid] filename
without arguments prints document metadata and exits
-d dump rawml text record
-e create EPUB file (with -s will dump EPUB source)
-i print detailed metadata
-m print records metadata
-o dir save output to dir folder
-p pid set pid for decryption
-r dump raw records
-s dump recreated source files
-u show rusage
-v show version and exit
-x extract conversion source and log (if present)
-7 parse KF7 part of hybrid file (by default KF8 part is parsed)