summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-13 23:05:35 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-15 13:40:34 +0100
commit80aac924e8321e7d50f31d0b62e48fee469282ef (patch)
tree087e2c98bb163b38b3d42866b12a9d7e988d5005
parentd0d9f868f628459ef9acda42d49a5b50492576f9 (diff)
downloadrockbox-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-xwps/wpsbuild.pl29
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 @@
10 10
11use strict; 11use strict;
12use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF 12use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
13use IPC::Open2;
13 14
14my $ROOT=".."; 15my $ROOT="..";
15my $wpsdir; 16my $wpsdir;
@@ -87,11 +88,11 @@ if(!$wpslist) {
87sub getlcdsizes 88sub getlcdsizes
88{ 89{
89 my ($remote) = @_; 90 my ($remote) = @_;
91 my $str;
90 92
91 open(GCC, ">gcctemp");
92 if($remote) { 93 if($remote) {
93 # Get the remote LCD screen size 94 # Get the remote LCD screen size
94 print GCC <<STOP 95 $str = <<STOP
95\#include "config.h" 96\#include "config.h"
96#ifdef HAVE_REMOTE_LCD 97#ifdef HAVE_REMOTE_LCD
97Height: LCD_REMOTE_HEIGHT 98Height: LCD_REMOTE_HEIGHT
@@ -102,24 +103,25 @@ STOP
102; 103;
103 } 104 }
104 else { 105 else {
105 print GCC <<STOP 106 $str = <<STOP
106\#include "config.h" 107\#include "config.h"
107Height: LCD_HEIGHT 108Height: LCD_HEIGHT
108Width: LCD_WIDTH 109Width: LCD_WIDTH
109Depth: LCD_DEPTH 110Depth: LCD_DEPTH
110STOP 111STOP
111; 112;
112} 113 }
113 close(GCC); 114 close(GCC);
114 115
115 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; 116 my $cmd = "gcc $cppdef -I. -I$firmdir/export -E -P -";
116 117 my $pid = open2(*COUT, *CIN, $cmd) or die "Could not spawn child: $!\n";
117 #print "CMD $c\n";
118 118
119 open(GETSIZE, "$c|"); 119 print CIN $str;
120 close(CIN);
121 waitpid($pid, 0);
120 122
121 my ($height, $width, $depth); 123 my ($height, $width, $depth, $touch);
122 while(<GETSIZE>) { 124 while(<COUT>) {
123 if($_ =~ /^Height: (\d*)/) { 125 if($_ =~ /^Height: (\d*)/) {
124 $height = $1; 126 $height = $1;
125 } 127 }
@@ -129,12 +131,11 @@ STOP
129 elsif($_ =~ /^Depth: (\d*)/) { 131 elsif($_ =~ /^Depth: (\d*)/) {
130 $depth = $1; 132 $depth = $1;
131 } 133 }
132 if($height && $width && $depth) { 134 if($_ =~ /^Touchscreen/) {
133 last; 135 $touch = 1;
134 } 136 }
135 } 137 }
136 close(GETSIZE); 138 close(COUT);
137 unlink("gcctemp");
138 139
139 return ($height, $width, $depth); 140 return ($height, $width, $depth);
140} 141}