2015-03-04 17:14:04 -06:00
|
|
|
LibreOffice On-Line WebSocket server
|
2015-04-21 05:48:17 -05:00
|
|
|
====================================
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-23 07:53:41 -05:00
|
|
|
Dependencies
|
2015-04-21 05:48:17 -05:00
|
|
|
------------
|
|
|
|
|
|
|
|
LibreOffice On-Line WebSocket server has the following dependencies:
|
|
|
|
|
|
|
|
* libpng
|
|
|
|
* Poco library: http://pocoproject.org/index.html.
|
2015-04-23 07:53:41 -05:00
|
|
|
* libcap-progs
|
2015-04-21 05:48:17 -05:00
|
|
|
|
|
|
|
Poco can be built with ./configure --prefix=/opt/poco && make install, but
|
|
|
|
distro packages exist too.
|
|
|
|
|
|
|
|
On openSUSE, you can use:
|
|
|
|
|
|
|
|
zypper ar http://download.opensuse.org/repositories/devel:/libraries:/c_c++/openSUSE_13.2/devel:libraries:c_c++.repo
|
2015-04-23 07:53:41 -05:00
|
|
|
zypper in poco-devel libcap-progs
|
2015-04-21 05:48:17 -05:00
|
|
|
|
|
|
|
Building
|
|
|
|
--------
|
|
|
|
|
|
|
|
loolwsd uses autoconf/automake, so build using the usual:
|
|
|
|
|
|
|
|
autoreconf
|
|
|
|
automake --add-missing
|
2015-04-21 07:24:28 -05:00
|
|
|
./configure --enable-silent-rules --with-lokit-path=<MASTER>/include
|
2015-04-21 05:48:17 -05:00
|
|
|
make
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
where <MASTER> is the location of the LibreOffice source tree.
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-22 07:50:09 -05:00
|
|
|
Note that the loolwsd program needs the CAP_SYS_CHROOT capability,
|
|
|
|
thus you will be asked the root password when running make as it
|
|
|
|
invokes sudo to run /sbin/setcap.
|
|
|
|
|
2015-04-21 05:48:17 -05:00
|
|
|
If you have self-built Poco, add the following to ./configure:
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-23 06:44:41 -05:00
|
|
|
--with-poco-includes=<POCOINST>/include --with-poco-libs=<POCOINST>/lib
|
|
|
|
|
|
|
|
where <POCOINST> means the Poco installation location.
|
2015-03-18 08:36:27 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
If you have the Poco debugging libraries (eg. you have a self-built
|
|
|
|
Poco), you can add --enable-debug to the configure options for
|
|
|
|
additional debugging.
|
2015-03-09 04:30:56 -05:00
|
|
|
|
|
|
|
For Windows, a proper VS2013 project is needed.
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
There is still unconditional debugging output etc. This is a work in
|
|
|
|
progress.
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-21 05:48:17 -05:00
|
|
|
Running
|
|
|
|
-------
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-24 09:45:57 -05:00
|
|
|
First create the directory used for caching tiles. It is set as
|
|
|
|
"${localstatedir}/cache/${PACKAGE}" in the configure.ac, so if you did
|
|
|
|
not pass any switch to the configure script that affects
|
|
|
|
"localstatedir, it will be /usr/local/var/cache/loolwsd . If you did
|
|
|
|
pass such a switch, like --prefix, check config.h for the exact value.
|
|
|
|
|
2015-04-23 10:24:22 -05:00
|
|
|
Now you need to set up a minimal chroot system, and directory for the jails:
|
|
|
|
|
|
|
|
./setup-sys-chroot <SYSTEMPLATE> <MASTER>/instdir
|
|
|
|
mkdir <ROOTFORJAILS>
|
|
|
|
|
|
|
|
To run loolwsd the way it is supposed to eventually be run "for real", you can
|
|
|
|
now do:
|
2015-04-21 05:48:17 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
./loolwsd --systemplate=<SYSTEMPLATE> --lotemplate=<MASTER>/instdir --childroot=<ROOTFORJAILS>
|
2015-04-21 05:48:17 -05:00
|
|
|
|
|
|
|
and connect loleaflet to that (see loleaflet/README for more info).
|
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
Again, <MASTER> is location of the LibreOffice source tree with a built
|
2015-04-21 05:48:17 -05:00
|
|
|
LibreOffice. This is work in progress, and consequently needs the latest
|
|
|
|
LibreOffice master.
|
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
The <SYSTEMPLATE> is a directory tree set up using the
|
|
|
|
setup-sys-chroot script here. It is intended to contain the runtime
|
|
|
|
environment needed by the LibreOffice dynamic libraries used through
|
|
|
|
LibreOfficeKit. Improvements to that script are very likely needed on
|
|
|
|
various distros.
|
2015-04-14 10:30:23 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
The <ROOTFORJAILS> directory above is a presumably initially empty
|
|
|
|
directory under which loolwsd will create chroot jails for editing
|
|
|
|
each specific document.
|
2015-04-14 10:30:23 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
As loolwsd uses hardlinks to "copy" the contents of both <SYSTEMPLATE>
|
2015-04-21 07:27:08 -05:00
|
|
|
and the <MASTER>/instdir directories into each chroot jail,
|
2015-04-21 07:24:28 -05:00
|
|
|
<SYSTEMPLATE> and <ROOTFORJAILS> need to be on the same file system as
|
|
|
|
<MASTER>/instdir.
|
2015-04-14 10:30:23 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
If you plan to hack on loolwsd, you probably want to familiarize
|
|
|
|
yourself with loolwsd's --test and --numprespawns switches, and the
|
2015-04-14 10:30:23 -05:00
|
|
|
'connect' test program.
|
|
|
|
|
|
|
|
For interactive testing, you can use the loolwsd --test switch, or you
|
|
|
|
can use the 'connect' program. Both accept "commands" from the
|
2015-04-21 07:24:28 -05:00
|
|
|
protocol on standard input. You can either used them tuly
|
|
|
|
interactively, or edit input lines into a file, or use shell
|
|
|
|
scripting, etc. For instance:
|
2015-04-21 05:48:17 -05:00
|
|
|
|
2015-04-21 07:24:28 -05:00
|
|
|
(echo load /some/where/foo.odt; echo tile width=500 height=500 tileposx=0 tileposy=0 tilewidth=10000 tileheight=10000; sleep 10) |
|
2015-04-23 07:51:10 -05:00
|
|
|
./loolwsd --test --systemplate=/home/tml/lo/master/lool-sys-template --lotemplate=/home/tml/lo/master/instdir --childroot=/home/tml/lo/master/lool-child-root
|
2015-03-04 17:14:04 -06:00
|
|
|
|
2015-04-23 10:24:22 -05:00
|
|
|
Debugging
|
|
|
|
---------
|
|
|
|
|
|
|
|
When debugging, you want to add --numprespawns=1 to the loolwsd parameters to
|
|
|
|
limit the amount of concurrently running processes.
|
|
|
|
|
|
|
|
When the crash happens too early, you also want to
|
|
|
|
|
|
|
|
export SLEEPFORDEBUGGER=<number of seconds>
|
|
|
|
|
|
|
|
so that you have time to attach to the process.
|
|
|
|
|
|
|
|
Then run loolwsd, and attach your debugger to the process you are interested
|
|
|
|
in.
|
2015-04-21 05:48:17 -05:00
|
|
|
|
|
|
|
Protocol description
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
See protocol.txt for a description of the protocol to be used over the
|
|
|
|
websocket.
|
2015-04-24 06:34:43 -05:00
|
|
|
|
|
|
|
Coding style
|
|
|
|
------------
|
|
|
|
|
|
|
|
There is not really any serious rationale why the code ended up being
|
|
|
|
written in the style it is... but unless you plan to change some style
|
|
|
|
detail completely and consistenly all over, please keep to the style
|
|
|
|
of the existing code when editing.
|
|
|
|
|
|
|
|
The style is roughly as follows, in rough order of importance:
|
|
|
|
|
|
|
|
- As in LO, no hard TABs in source files. Only spaces. Indentation
|
|
|
|
step is four columns.
|
|
|
|
|
|
|
|
- As in LO, the braces { and } of the block of if, switch, and while
|
|
|
|
statements go on separate lines.
|
|
|
|
|
|
|
|
- Following Poco conventions, member variables are prefixed with an
|
|
|
|
underscore. But I am not opposed to changing this to 'm_' for
|
|
|
|
instance.
|
|
|
|
|
|
|
|
- Do use C++11. I admit in some places (out of laziness or ignorance)
|
|
|
|
I use Poco API even if there probably is an equivalent std::
|
|
|
|
API. (Like for threads.) Feel free to change those, if the std:: API
|
|
|
|
is not much more verbose or ugly, and you are sure it is equivalent.
|
|
|
|
|
|
|
|
- Always prefer the C++ wrapped version of a C library
|
|
|
|
API. I.e. include <cstring> instead of <string.h>, use std::memcpy()
|
|
|
|
instead of memcpy(), etc.
|
|
|
|
|
|
|
|
- Use std:: prefix for all std API, i.e. don't ever do "using
|
|
|
|
std;". But it's OK to use "using Poco::Foo;" all over. Maybe that is
|
|
|
|
not a good idea?
|
|
|
|
|
|
|
|
- Be as portable as possible, i.e. don't intentionally write Unix-only
|
|
|
|
code if there is a choice. Obviously some parts of the code
|
|
|
|
currently use Unix-only things like chroot() and link() though.
|
|
|
|
|
|
|
|
- Member functions use camelCaseWithInitialLowerCase. I don't like
|
|
|
|
CamelCaseWithInitialUpperCase.
|
|
|
|
|
|
|
|
- No kind of Hungarian prefixes.
|