Sunday, September 19, 2010

Wikireader: compiling Wikibooks














Download the latest copy of Wikireader source from github and extract it to your home directory. Download the XML backup dump from the mediawiki website. In this example I've used wikibooks as below:

2010-09-08 22:36:40 done Articles, templates, image descriptions, and primary meta-pages.
2010-09-08 22:36:40: enwikibooks 85591 pages (497.926/sec), 85591 revs (497.926/sec), 98.2% prefetched, ETA 2010-09-08 22:41:50 [max 239932]
  • This contains current versions of article content, and is the archive most mirror sites will probably want.
  • pages-articles.xml.bz2 78.9 MB

The below procedure is based on github and the doc/Quickstart from the downloaded Wikireader package.

Install these packages for building:
  • apt-get install python-gd gawk gforth flex bison m4
  • apt-get install netpbm qt4-qmake libqt4-dev wget
  • apt-get install python-serial sqlite3 php5-cli python-dev
  • sudo apt-get install mecab-ipadic-utf8
  • sudo apt-get install python-mecab mecab-ipadic-utf8
Make sure samo-lib/include/config.h is setup. copy default configuration
  • cp samo-lib/include/config.h-default samo-lib/include/config.h
Edit samo-lib/include/config.h to remove // from the line:
  • //#define BOARD_SAMO_V1 1
so it looks like:
#define BOARD_SAMO_V1 1

Display the possible make targets with this command:
  • make help


Compiling WikiReader program and QT4 simulator
=====================================

  • make clean

There maybe errors because of missing programs, these will be indicated by an apt-get install message to show the Ubuntu 9.10 package(s) to install.

  • make


Compiling a test database (multiple language version - latest kernel.elf)
============================

1) mkdir -p image work

make DESTDIR=image WORKDIR=work WIKI_LANGUAGE=en \
XML_FILES="XML-Licenses/en/license.xml XML-Licenses/en/terms.xml xml-file-samples/enwikibooks-20100908-pages-articles.xml" \
cleandirs createdirs iprc

#Note: iprc => index parse render combine

2) Optionally: simulate using qt4-simulator:
make DESTDIR=image fonts-install nls-install sim4

4) Install fonts and programs
make DESTDIR=image install

5) Format a microSD card as FAT32 and copy the contents on image to it. You can use gparted to format your microSD.
e.g. mkfs.vfat -F 32 -n wikird /dev/sd
mount /dev/sd /mnt
cp -r image/* /mnt/

I tried this few months before and I couldn't even compile at that time. I did manage to compile the source with Wikiversity back then. This time around, while it did compile Wikibooks successfully, once loaded in Wikireader, it didn't function as expected. The search for only certain words worked. When I searched for some random words, it usually froze and I had to restart the device every time.

Therefore, I decided to setup my own Mediawiki website in a localhost and loaded with custom content. I exported C programming material from Wikibooks and imported to my Mediawiki website.

I also used Packedobjects reference material. First, using Html 2 Wiki tool, I converted it to Wiki format and imported to my Mediawiki running on my localhost.

From my Mediawiki, I exported XML dump and compiled with Wikireader source. It is also possible to export content using special:dump page in the Mediawiki that allows a list of articles to be output and usually has an option to include templates, but sometimes templates deeply nested inside other templates are often missed. To export XML dump using script, please follow these instructions.

With the imported content, there were some issues of loosing formatting and not displaying correctly. Mostly, the internal page links didn't display as it was which I had to correct manually. Also, the examples of programming codes (for example Packedobjects Real type) lost it's formatting such as indent and the text appear all wrapped up as in a paragraph.

Wikireader does have a potential to be used as an offline reading device in a different way then intended. Because of the freely available software, it allows to import custom content or even modify the software.

Wikireader currently supports 15 different languages but doesn't support 'Devanagari' yet. My attempt to compile Nepali Wikipedia failed. Wikireader screen may not be good enough to show such detailed letters, but I've requested the team to look into this.
Hopefully, it will be possible soon.

No comments :