Switched to CMake. This allows getting rid of several patches and hacks.
Added PKG_LICENSE information
Rearranged some stuff for consistency between packages.
Added some linked flags for smaller size. Saves around 500 bytes on MIPS.
Signed-off-by: Rosen Penev <rosenp@gmail.com>