correctly set opt_dir when building ruby-head, fix #3179
merge #3181: correctly set opt_dir when building ruby-head for freebsd
fix #3179