build: refactor build options handling