correctly set opt_dir when building ruby-head, fix #3179