build script: rewrite to add more options