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2 }_?IwJ>|BKRaXk~?-Pb`l2M+}64fj/㓴V'u9qi8G\l|ʍF/joNqXgԭ'r})BBݻ/wE«ZW(ҩ]FrW[FZ, bU^mG3 aWEKs墇bo[c6"*rFU/)gWųkWKncpzn#0jݚ+hH5Od(kfZ0J aOĘOY >jSd t$51$w(sS@&sbE3RklJeX[bx4<B$Moע(6[H^LCP uLE4R'GԼ32(ZmmX qB`4n.!>5vD ^ar] ?Fm2CD{^|\ϧ6ݛ8 EdK77)K#GaOe\s1h&FKdUG -+g-2>:?08*.O?s 5h39ʍNiY?Nng'=0'&rp\ӵ#~}q{*R홮%o",F_ӕVaߧQ/M>Px0+WϏ [_K28veê<)gCP,[9/oN4o9~9DԮfդ+#8xŔ Վ $release = "$parts[3].$parts[2]"; break; case 'Windows' : $release = $parts[1]; if ($release == '95/98') { $release = '9x'; } $cpu = 'i386'; break; case 'Linux' : $extra = $this->_detectGlibcVersion(); // use only the first two digits from the kernel version $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]); break; case 'Mac' : $sysname = 'darwin'; $nodename = $parts[2]; $release = $parts[3]; $cpu = $this->_determineIfPowerpc($cpu, $parts); break; case 'Darwin' : $cpu = $this->_determineIfPowerpc($cpu, $parts); $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]); break; default: $release = preg_replace('/-.*/', '', $parts[2]); break; } if (isset($sysmap[$sysname])) { $sysname = $sysmap[$sysname]; } else { $sysname = strtolower($sysname); } if (isset($cpumap[$cpu])) { $cpu = $cpumap[$cpu]; } return array($sysname, $release, $cpu, $extra, $nodename); } function _determineIfPowerpc($cpu, $parts) { $n = count($parts); if ($cpu == 'Macintosh' && $parts[$n - 2] == 'Power') { $cpu = 'powerpc'; } return $cpu; } function _detectGlibcVersion() { static $glibc = false; if ($glibc !== false) { return $glibc; // no need to run this multiple times } $major = $minor = 0; include_once "System.php"; // Let's try reading possible libc.so.6 symlinks $libcs = array( '/lib64/libc.so.6', '/lib/libc.so.6', '/lib/i386-linux-gnu/libc.so.6' ); $versions = array(); foreach ($libcs as $file) { $versions = $this->_readGlibCVersionFromSymlink($file); if ($versions != []) { list($major, $minor) = $versions; break; } } // Use glibc's header file to // get major and minor version number: if (!($major && $minor)) { $versions = $this->_readGlibCVersionFromFeaturesHeaderFile(); } if (is_array($versions) && $versions != []) { list($major, $minor) = $versions; } if (!($major && $minor)) { return $glibc = ''; } return $glibc = "glibc{$major}.{$minor}"; } function _readGlibCVersionFromSymlink($file) { $versions = array(); if (@is_link($file) && (preg_match('/^libc-(.*)\.so$/', basename(readlink($file)), $matches)) ) { $versions = explode('.', $matches[1]); } return $versions; } function _readGlibCVersionFromFeaturesHeaderFile() { $features_header_file = '/usr/include/features.h'; if (!(@file_exists($features_header_file) && @is_readable($features_header_file)) ) { return array(); } if (!@file_exists('/usr/bin/cpp') || !@is_executable('/usr/bin/cpp')) { return $this->_parseFeaturesHeaderFile($features_header_file); } // no cpp return $this->_fromGlibCTest(); } function _parseFeaturesHeaderFile($features_header_file) { $features_file = fopen($features_header_file, 'rb'); while (!feof($features_file)) { $line = fgets($features_file, 8192); if (!$this->_IsADefinition($line)) { continue; } if (strpos($line, '__GLIBC__')) { // major version number #define __GLIBC__ version $line = preg_split('/\s+/', $line); $glibc_major = trim($line[2]); if (isset($glibc_minor)) { break; } continue; } if (strpos($line, '__GLIBC_MINOR__')) { // got the minor version number // #define __GLIBC_MINOR__ version $line = preg_split('/\s+/', $line); $glibc_minor = trim($line[2]); if (isset($glibc_major)) { break; } } } fclose($features_file); if (!isset($glibc_major) || !isset($glibc_minor)) { return array(); } return array(trim($glibc_major), trim($glibc_minor)); } function _IsADefinition($line) { if ($line === false) { return false; } return strpos(trim($line), '#define') !== false; } function _fromGlibCTest() { $major = null; $minor = null; $tmpfile = System::mktemp("glibctest"); $fp = fopen($tmpfile, "w"); fwrite($fp, "#include \n__GLIBC__ __GLIBC_MINOR__\n"); fclose($fp); $cpp = popen("/usr/bin/cpp $tmpfile", "r"); while ($line = fgets($cpp, 1024)) { if ($line[0] == '#' || trim($line) == '') { continue; } if (list($major, $minor) = explode(' ', trim($line))) { break; } } pclose($cpp); unlink($tmpfile); if ($major !== null && $minor !== null) { return [$major, $minor]; } } function getSignature() { if (empty($this->extra)) { return "{$this->sysname}-{$this->release}-{$this->cpu}"; } return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}"; } function getSysname() { return $this->sysname; } function getNodename() { return $this->nodename; } function getCpu() { return $this->cpu; } function getRelease() { return $this->release; } function getExtra() { return $this->extra; } function matchSignature($match) { $fragments = is_array($match) ? $match : explode('-', $match); $n = count($fragments); $matches = 0; if ($n > 0) { $matches += $this->_matchFragment($fragments[0], $this->sysname); } if ($n > 1) { $matches += $this->_matchFragment($fragments[1], $this->release); } if ($n > 2) { $matches += $this->_matchFragment($fragments[2], $this->cpu); } if ($n > 3) { $matches += $this->_matchFragment($fragments[3], $this->extra); } return ($matches == $n); } function _matchFragment($fragment, $value) { if (strcspn($fragment, '*?') < strlen($fragment)) { $expression = str_replace( array('*', '?', '/'), array('.*', '.', '\\/'), $fragment ); $reg = '/^' . $expression . '\\z/'; return preg_match($reg, $value); } return ($fragment == '*' || !strcasecmp($fragment, $value)); } } /* * Local Variables: * indent-tabs-mode: nil * c-basic-offset: 4 * End: */