Generalize installing prebuilt libraries

Only libffi for now, libpcre will be added next