How to build unity as Android/iOS library?

Please take a look at: Using Unity as a Library docs