wpsbuild: Call gcc without having to create a temp file.
Change-Id: I7adc48209fd3050243770137df2022c617c68dc8 Reviewed-on: http://gerrit.rockbox.org/721 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
This commit is contained in:
parent
d0d9f868f6
commit
80aac924e8
1 changed files with 15 additions and 14 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
|
use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
|
||||||
|
use IPC::Open2;
|
||||||
|
|
||||||
my $ROOT="..";
|
my $ROOT="..";
|
||||||
my $wpsdir;
|
my $wpsdir;
|
||||||
|
@ -87,11 +88,11 @@ if(!$wpslist) {
|
||||||
sub getlcdsizes
|
sub getlcdsizes
|
||||||
{
|
{
|
||||||
my ($remote) = @_;
|
my ($remote) = @_;
|
||||||
|
my $str;
|
||||||
|
|
||||||
open(GCC, ">gcctemp");
|
|
||||||
if($remote) {
|
if($remote) {
|
||||||
# Get the remote LCD screen size
|
# Get the remote LCD screen size
|
||||||
print GCC <<STOP
|
$str = <<STOP
|
||||||
\#include "config.h"
|
\#include "config.h"
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
Height: LCD_REMOTE_HEIGHT
|
Height: LCD_REMOTE_HEIGHT
|
||||||
|
@ -102,7 +103,7 @@ STOP
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print GCC <<STOP
|
$str = <<STOP
|
||||||
\#include "config.h"
|
\#include "config.h"
|
||||||
Height: LCD_HEIGHT
|
Height: LCD_HEIGHT
|
||||||
Width: LCD_WIDTH
|
Width: LCD_WIDTH
|
||||||
|
@ -112,14 +113,15 @@ STOP
|
||||||
}
|
}
|
||||||
close(GCC);
|
close(GCC);
|
||||||
|
|
||||||
my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
|
my $cmd = "gcc $cppdef -I. -I$firmdir/export -E -P -";
|
||||||
|
my $pid = open2(*COUT, *CIN, $cmd) or die "Could not spawn child: $!\n";
|
||||||
|
|
||||||
#print "CMD $c\n";
|
print CIN $str;
|
||||||
|
close(CIN);
|
||||||
|
waitpid($pid, 0);
|
||||||
|
|
||||||
open(GETSIZE, "$c|");
|
my ($height, $width, $depth, $touch);
|
||||||
|
while(<COUT>) {
|
||||||
my ($height, $width, $depth);
|
|
||||||
while(<GETSIZE>) {
|
|
||||||
if($_ =~ /^Height: (\d*)/) {
|
if($_ =~ /^Height: (\d*)/) {
|
||||||
$height = $1;
|
$height = $1;
|
||||||
}
|
}
|
||||||
|
@ -129,12 +131,11 @@ STOP
|
||||||
elsif($_ =~ /^Depth: (\d*)/) {
|
elsif($_ =~ /^Depth: (\d*)/) {
|
||||||
$depth = $1;
|
$depth = $1;
|
||||||
}
|
}
|
||||||
if($height && $width && $depth) {
|
if($_ =~ /^Touchscreen/) {
|
||||||
last;
|
$touch = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(GETSIZE);
|
close(COUT);
|
||||||
unlink("gcctemp");
|
|
||||||
|
|
||||||
return ($height, $width, $depth);
|
return ($height, $width, $depth);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue