PhpBrew\Utils::getPkgConfigPrefix PHP Method

getPkgConfigPrefix() public static method

public static getPkgConfigPrefix ( string $package )
$package string
    public static function getPkgConfigPrefix($package)
    {
        if (self::findBin('pkg-config')) {
            $cmd = 'pkg-config --variable=prefix ' . $package;
            $process = new Process($cmd);
            $code = $process->run();
            if (intval($code) === 0) {
                $path = trim($process->getOutput());
                if (file_exists($path)) {
                    return $path;
                }
            }
            return false;
        }
        return false;
    }

Usage Example

Example #1
0
 public function checkPkgPrefix($option, $pkgName)
 {
     $prefix = Utils::getPkgConfigPrefix($pkgName);
     return $prefix ? $option . '=' . $prefix : $option;
 }