rpm: stop using statics; move main() to the end of the source file