author | Mike Kinghan <mikek@symbian.org> |
Sat, 27 Nov 2010 17:23:11 +0000 | |
changeset 41 | 1600211976c3 |
parent 10 | b2a53d442fd6 |
permissions | -rwxr-xr-x |
10
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
2 |
# Copyright (c) 2010 Symbian Foundation Ltd |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
3 |
# This component and the accompanying materials are made available |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
4 |
# under the terms of the License "Eclipse Public License v1.0" |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
5 |
# which accompanies this distribution, and is available |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
7 |
# |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
8 |
# Initial Contributors: |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
9 |
# Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution. |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
10 |
|
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
11 |
# Subroutine to get the wordsize in bits of the host machine. |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
12 |
|
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
13 |
use strict; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
14 |
use File::Path; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
15 |
use File::Spec; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
16 |
use check_os; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
17 |
use places; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
18 |
|
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
19 |
sub get_host_wordsize() |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
20 |
{ |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
21 |
if (os_is_windows()) { |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
22 |
print ">>> Only 32bit Windows supported\n"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
23 |
return 32; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
24 |
} |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
25 |
my $source = "get_wordsize.c"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
26 |
unless(-f "$source") { |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
27 |
die "*** Error: $source not found ***"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
28 |
} |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
29 |
my $compile_cmd = "gcc -o get_wordsize $source"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
30 |
print ">>> Excuting: $compile_cmd\n"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
31 |
system($compile_cmd) >> 8 and die "*** Error: Could not compile $source ***"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
32 |
my $get_wordsize = "\.\/get_wordsize"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
33 |
print ">>> Excuting: $get_wordsize\n"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
34 |
my $wordsize = `$get_wordsize`; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
35 |
chomp $wordsize; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
36 |
die "$!", if ($? >> 8); |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
37 |
$wordsize *= 8; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
38 |
print ">>> Host system wordsize is $wordsize bits\n"; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
39 |
unlink("get_wordsize") or die $!; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
40 |
return $wordsize; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
41 |
} |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
42 |
|
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
43 |
1; |
b2a53d442fd6
1) Introducing support for 32/64-bit variants of the patch files
mikek
parents:
diff
changeset
|
44 |