$message_32 = "32-bit ";
     $main_build_arch = "i386";
 } else {
     $build_32 = "";
     $message_32 = "";
     $main_build_arch = $host_arch;
 }
 // Kill /usr/ports/ if it's there
 $build = str_replace("/usr/ports/", "", $build);
 list($category, $port) = explode('/', $build);
 if ($pbi_options['build_options']) {
     if (!isset($options['q'])) {
         echo ">>> [" . date("H:i:s") . "] BUILD_OPTIONS: {$pbi_options['build_options']}\n";
     }
 }
 $pbi_conf = create_pbi_conf("{$category}/{$port}", $pbi_options['custom_name'], $pbi_options['build_options'], $pbi_options['ports_before'], $pbi_options['ports_after']);
 if (!is_dir("/pbi-build/modules/{$category}/{$port}")) {
     exec("mkdir -p /pbi-build/modules/{$category}/{$port}");
 }
 $pbi_confdir = "/pbi-build/modules/{$category}/{$port}";
 file_put_contents("{$pbi_confdir}/pbi.conf", $pbi_conf);
 $sign = "";
 if (!empty($options['S'])) {
     $sign = "--sign {$options['S']} ";
 }
 $redirbg = isset($options['v']) ? "" : " > {$pbi_confdir}/pbi.log 2>&1 &";
 if (empty($pbi_options['only_for_archs']) || in_array($main_build_arch, $pbi_options['only_for_archs'])) {
     echo ">>> [" . date("H:i:s") . "] Processing {$build} {$message_32}({$j}/{$total_to_build})\n";
     echo ">>> [" . date("H:i:s") . "] Executing /usr/local/sbin/pbi_makeport -o /usr/ports/packages/All/ -c {$pbi_confdir} {$build_32}{$sign}{$category}/{$port}\n";
     system("/usr/local/sbin/pbi_makeport -o /usr/ports/packages/All/ -c {$pbi_confdir} {$build_32}{$sign}{$category}/{$port}{$redirbg}");
     if (!isset($options['v'])) {
                foreach ($portopts as $po) {
                    if (substr($po, 0, 1) != '#') {
                        $build_options .= " " . $po;
                    }
                }
            }
            echo ">>> Processing {$build}\n";
            $category = trim(`echo \\"{$build}\\" | cut -d'/' -f4`);
            $port = trim(`echo \\"{$build}\\" | cut -d'/' -f5 | cut -d'"' -f1`);
            echo ">>> Category: {$category}/{$port} \n";
            if ($build_options) {
                if (!isset($options['q'])) {
                    echo " BUILD_OPTIONS: {$build_options}\n";
                }
            }
            $pbi_conf = create_pbi_conf($build, $build_options);
            if (!is_dir("/pbi-build/modules/{$category}/{$port}")) {
                exec("mkdir -p /pbi-build/modules/{$category}/{$port}");
            }
            file_put_contents("/pbi-build/modules/{$category}/{$port}/pbi.conf", $pbi_conf);
            echo ">>> Executing /usr/local/sbin/pbi_makeport -o /usr/ports/packages/All/ {$category}/{$port}\n";
            mwexec_bg("/usr/local/sbin/pbi_makeport -o /usr/ports/packages/All/ {$category}/{$port}");
            wait_for_procs_finish();
        }
    }
}
echo ">>> {$file_system_root}/usr/ports/packages/All now contains:\n";
system("ls {$file_system_root}/usr/ports/packages/All");
// Copy created packages to the package server via rsync
if ($copy_packages_to_folder_ssh) {
    echo ">>> Copying packages to {$copy_packages_to_host_ssh}\n";