change libwriterperfect to shared library

There are already 3 libs linking with it and there will be another one
in near future. It is time to stop the duplication :-)

Change-Id: Ia7d24882c37a8bf49fa031b73fa1bd5296f78820
refactor to decrease the amount of copypasta

Change-Id: Iedfa2a358bf098f6a5e28b994c4c340654a7c295