diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-01-13 23:05:35 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-01-15 13:40:34 +0100 |
commit | 80aac924e8321e7d50f31d0b62e48fee469282ef (patch) | |
tree | 087e2c98bb163b38b3d42866b12a9d7e988d5005 | |
parent | d0d9f868f628459ef9acda42d49a5b50492576f9 (diff) | |
download | rockbox-80aac924e8321e7d50f31d0b62e48fee469282ef.tar.gz rockbox-80aac924e8321e7d50f31d0b62e48fee469282ef.zip |
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>
-rwxr-xr-x | wps/wpsbuild.pl | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl index a420faddd8..35febe3bcb 100755 --- a/wps/wpsbuild.pl +++ b/wps/wpsbuild.pl @@ -10,6 +10,7 @@ use strict; use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF +use IPC::Open2; my $ROOT=".."; my $wpsdir; @@ -87,11 +88,11 @@ if(!$wpslist) { sub getlcdsizes { my ($remote) = @_; + my $str; - open(GCC, ">gcctemp"); if($remote) { # Get the remote LCD screen size - print GCC <<STOP + $str = <<STOP \#include "config.h" #ifdef HAVE_REMOTE_LCD Height: LCD_REMOTE_HEIGHT @@ -102,24 +103,25 @@ STOP ; } else { - print GCC <<STOP + $str = <<STOP \#include "config.h" Height: LCD_HEIGHT Width: LCD_WIDTH Depth: LCD_DEPTH STOP ; -} + } close(GCC); - my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; - - #print "CMD $c\n"; + my $cmd = "gcc $cppdef -I. -I$firmdir/export -E -P -"; + my $pid = open2(*COUT, *CIN, $cmd) or die "Could not spawn child: $!\n"; - open(GETSIZE, "$c|"); + print CIN $str; + close(CIN); + waitpid($pid, 0); - my ($height, $width, $depth); - while(<GETSIZE>) { + my ($height, $width, $depth, $touch); + while(<COUT>) { if($_ =~ /^Height: (\d*)/) { $height = $1; } @@ -129,12 +131,11 @@ STOP elsif($_ =~ /^Depth: (\d*)/) { $depth = $1; } - if($height && $width && $depth) { - last; + if($_ =~ /^Touchscreen/) { + $touch = 1; } } - close(GETSIZE); - unlink("gcctemp"); + close(COUT); return ($height, $width, $depth); } |