Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed the old make_*.bat stuff - Added build.bat and build.sh based on PHP's (build.php) and making the building system cross-system. - ... git-svn-id: http://pspautotests.googlecode.com/svn/trunk/pspautotests@45 998017b7-1407-6bc6-591a-4e5c7c3989f7
- Loading branch information
soywiz
committed
Dec 30, 2011
1 parent
58f1363
commit ac13da9
Showing
56 changed files
with
2,084 additions
and
197 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_LIBS=pspatrac3 pspaudio |
Binary file not shown.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_C_FILES=sascore-imports.S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@ECHO OFF | ||
REM "%~dp0\..\utils\win32\php.exe" "%~dp0\build.php" %* | ||
"c:\php\php.exe" "%~dp0\build.php" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
// Requires PHP >= 5.3 | ||
|
||
require_once(__DIR__ . '/build_utils.php'); | ||
|
||
$pspSdk = new PspSdk(); | ||
$PSPAUTOTESTS = dirname(__DIR__); | ||
|
||
//print_r($pspSdk); | ||
|
||
$params = array_slice($argv, 1); | ||
|
||
$filter = '*'; | ||
$path = __DIR__; | ||
|
||
if (count($params) > 0) { | ||
$param = $params[0]; | ||
|
||
if (dirname($param) == '.') { | ||
$filter = "*{$param}*"; | ||
} else { | ||
if (is_dir($param)) { | ||
$path = $param; | ||
} else { | ||
$path = dirname($param); | ||
} | ||
} | ||
} | ||
|
||
foreach (recursive_directory_iterator($path) as $file) { | ||
if (!endsWith($file, '.expected')) continue; | ||
|
||
//if (!preg_match('@kirk@', $file)) continue; | ||
//if (!preg_match('@vfpu@', $file)) continue; | ||
//if (!preg_match('@fonttest@', $file)) continue; | ||
if (!fnmatch($filter, $file)) continue; | ||
|
||
$filebase = substr($file, 0, strrpos($file, '.')); | ||
$dirbase = dirname($filebase); | ||
$cfile = "{$filebase}.c"; | ||
$outfile = "{$filebase}.elf"; | ||
$compilefile = "{$filebase}.compile"; | ||
|
||
$libraries = array( | ||
'pspumd', 'psppower', 'pspdebug', 'pspgum_vfpu', 'pspgu', | ||
'pspge', 'pspdisplay', 'pspsdk', 'm', 'c', 'pspnet', | ||
'pspnet_inet', 'pspuser', 'psprtc', 'pspctrl' | ||
); | ||
|
||
$sources = array( | ||
"{$PSPAUTOTESTS}/common/common.c", | ||
$cfile, | ||
); | ||
|
||
if (is_file($compilefile)) { | ||
$info = parse_ini_string(file_get_contents($compilefile)); | ||
if (isset($info['EXTRA_C_FILES'])) { | ||
$sources = array_merge($sources, array_map(function($name) use($dirbase) { | ||
return "{$dirbase}/{$name}"; | ||
}, explode(' ', $info['EXTRA_C_FILES']))); | ||
} | ||
if (isset($info['EXTRA_LIBS'])) { | ||
$libraries = array_merge($libraries, explode(' ', $info['EXTRA_LIBS'])); | ||
} | ||
if (isset($info['EXTRA_LIBS_PRE'])) { | ||
$libraries = array_merge(explode(' ', $info['EXTRA_LIBS_PRE']), $libraries); | ||
} | ||
} | ||
|
||
$gcc_args = array( | ||
'include_dirs' => array(".", "{$pspSdk->PSPSDK}/psp/sdk/include", "{$PSPAUTOTESTS}/common"), | ||
'library_dirs' => array(".", "{$pspSdk->PSPSDK}/psp/sdk/lib", "{$PSPAUTOTESTS}/common"), | ||
'defines' => array( | ||
"_PSP_FW_VERSION" => $pspSdk->PSP_FW_VERSION | ||
), | ||
'flags' => array('-Wall', '-g', '-O0'), | ||
'libraries' => $libraries, | ||
'sources' => $sources, | ||
'output' => $outfile, | ||
); | ||
|
||
echo "{$cfile}..."; | ||
$output = $pspSdk->gcc($gcc_args); | ||
echo $output; | ||
echo "Ok\n"; | ||
|
||
if (is_file($outfile)) { | ||
touch($outfile, filemtime($cfile)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
php build.php $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
// Requires PHP 5.3 | ||
|
||
class PspSdk { | ||
public $PSPSDK; | ||
public $GCC; | ||
public $FIXUP_IMPORTS; | ||
public $MKSFO; | ||
public $PACK_PBP; | ||
public $EXE_PREFIX; | ||
//public $PSP_FW_VERSION = 150; | ||
//public $PSP_FW_VERSION = 371; | ||
public $PSP_FW_VERSION = 500; | ||
|
||
public function __construct() { | ||
if (PHP_OS == 'WINNT') { | ||
$this->EXE_PREFIX = '.exe'; | ||
} else { | ||
$this->EXE_PREFIX = ''; | ||
} | ||
|
||
$this->PSPSDK = $this->detect_pspsdk_path(); | ||
$this->GCC = realpath("{$this->PSPSDK}/bin/psp-gcc{$this->EXE_PREFIX}"); | ||
$this->FIXUP_IMPORTS = realpath("{$this->PSPSDK}/bin/psp-fixup-imports{$this->EXE_PREFIX}"); | ||
$this->MKSFO = realpath("{$this->PSPSDK}/bin/mksfo{$this->EXE_PREFIX}"); | ||
$this->PACK_PBP = realpath("{$this->PSPSDK}/bin/pack-pbp{$this->EXE_PREFIX}"); | ||
} | ||
|
||
public function gcc($params) { | ||
$args = array(); | ||
|
||
$elfoutput = $params['output']; | ||
|
||
foreach ($params['include_dirs'] as $include_dir) $args[] = "-I{$include_dir}"; | ||
foreach ($params['library_dirs'] as $library_dir) $args[] = "-L{$library_dir}"; | ||
foreach ($params['defines'] as $key => $value) $args[] = "-D{$key}={$value}"; | ||
foreach ($params['flags'] as $flag) $args[] = $flag; | ||
foreach ($params['sources'] as $source) $args[] = $source; | ||
foreach ($params['libraries'] as $library) $args[] = "-l{$library}"; | ||
$args[] = '-o'; | ||
$args[] = $elfoutput; | ||
|
||
if (is_file($elfoutput)) @unlink($elfoutput); | ||
|
||
$gcc_cmd = $this->GCC . ' ' . implode(' ', array_map('escapeshellarg', $args)); | ||
$fixup_cmd = $this->FIXUP_IMPORTS . ' ' . escapeshellarg($elfoutput); | ||
//echo "$cmd\n"; | ||
$gcc_out = `{$gcc_cmd}`; | ||
$fixup_out = ''; | ||
|
||
if (is_file($elfoutput)) { | ||
$fixup_out = `$fixup_cmd`; | ||
} | ||
|
||
return trim("{$gcc_out}\n{$fixup_out}"); | ||
} | ||
|
||
static protected function detect_pspsdk_path() { | ||
$PSPSDK = getenv('PSPSDK'); | ||
|
||
if ($PSPSDK == '') { | ||
foreach (array('/pspsdk') as $path) { | ||
if (is_dir($path)) { | ||
$PSPSDK = realpath($path); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if ($PSPSDK == '') { | ||
throw(new Exception("Can't find the psp sdk. Please set the enviroment variable PSPSDK.")); | ||
} | ||
|
||
return $PSPSDK; | ||
} | ||
} | ||
|
||
function endsWith($str, $end) { | ||
return (substr($str, -strlen($end)) == $end); | ||
} | ||
|
||
function recursive_directory_iterator($dir) { | ||
return new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_LIBS=pspkernel |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_LIBS_PRE=glut glu gl pspvfpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_C_FILES=dmac-imports.S |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_C_FILES=libfont-imports.S |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_LIBS=pspkernel |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EXTRA_C_FILES=kirk-imports.S |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.