Add conditions to source building dependencies

This means that the `build-essential` and `perl` dependancies aren't installed if we're not compiling from source.