Move helpers into compile

And use a case statement to guard BASH_SOURCE, since otherwise shunit2
has issues.