Lines 1447-1454
Link Here
|
1447 |
# There may be a better way to do this, like splitting unxmacxp into two, but |
1447 |
# There may be a better way to do this, like splitting unxmacxp into two, but |
1448 |
# hopefully this hack will work for now... |
1448 |
# hopefully this hack will work for now... |
1449 |
|
1449 |
|
1450 |
if ( $GUIBASE eq "aqua" ) { |
1450 |
if ($platform eq "$Macosx") |
1451 |
ToFile( "ENVCDEFS", "-DQUARTZ", "e" ); |
1451 |
{ |
|
|
1452 |
my $macosxCdefs="\""; |
1453 |
|
1454 |
if( ! -e "/usr/bin/osascript" ) { |
1455 |
# no command line applescript. Chances are we're on a Darwin system |
1456 |
|
1457 |
$macosxCdefs.=" -DBUILD_OS_DARWIN"; |
1458 |
open DARVER, "/usr/bin/uname -v |"; |
1459 |
my $s=<DARVER>; |
1460 |
chomp $s; |
1461 |
if ( $s =~ /(\d+?)\.(\d+?)(.*?)/) |
1462 |
{ |
1463 |
$macosxCdefs.=" -DBUILD_OS_MAJOR=" . $1; |
1464 |
$macosxCdefs.=" -DBUILD_OS_MINOR=" . $2; |
1465 |
|
1466 |
$s=$3; |
1467 |
if ( $s =~ /(\d+?)/) { |
1468 |
$macosxCdefs.=" -DBUILD_OS_REV=" . $1; |
1469 |
} else { |
1470 |
$macosxCdefs.=" -DBUILD_OS_REV=0"; |
1471 |
} |
1472 |
} |
1473 |
close DARVER; |
1474 |
} |
1475 |
else |
1476 |
{ |
1477 |
$macosxCdefs.=" -DBUILD_OS_APPLEOSX"; |
1478 |
|
1479 |
my $majorScript = <<EOF; |
1480 |
on Num32ToHex(num) |
1481 |
if num < 0 then |
1482 |
set num to (2 ^ 32) + num |
1483 |
end if |
1484 |
set out to "" |
1485 |
repeat with idx from 7 to 0 by -1 |
1486 |
set bas to (16 ^ idx) as integer |
1487 |
if num >= bas then |
1488 |
set mult to ((num - (num mod bas)) / bas) as integer |
1489 |
set out to out & character mult of "123456789ABCDEF" |
1490 |
set num to (num - bas * mult) |
1491 |
else |
1492 |
set out to out & "0" |
1493 |
end if |
1494 |
end repeat |
1495 |
return out |
1496 |
end Num32ToHex |
1497 |
|
1498 |
tell application "Finder" |
1499 |
system attribute "sysv" |
1500 |
end tell |
1501 |
|
1502 |
Num32ToHex(result) |
1503 |
return (text 5 through 6 of result) |
1504 |
EOF |
1505 |
open BLECH, ">/tmp/os$$"; |
1506 |
print BLECH $majorScript; |
1507 |
close BLECH; |
1508 |
|
1509 |
open OSXMAJ, "/usr/bin/osascript </tmp/os$$|"; |
1510 |
|
1511 |
my $tmp=<OSXMAJ>; |
1512 |
chomp $tmp; |
1513 |
$macosxCdefs.=" -DBUILD_OS_MAJOR=" . $tmp; |
1514 |
close OSXMAJ; |
1515 |
unlink "/tmp/os$$"; |
1516 |
|
1517 |
my $minorScript = <<EOF; |
1518 |
on Num32ToHex(num) |
1519 |
if num < 0 then |
1520 |
set num to (2 ^ 32) + num |
1521 |
end if |
1522 |
set out to "" |
1523 |
repeat with idx from 7 to 0 by -1 |
1524 |
set bas to (16 ^ idx) as integer |
1525 |
if num >= bas then |
1526 |
set mult to ((num - (num mod bas)) / bas) as integer |
1527 |
set out to out & character mult of "123456789ABCDEF" |
1528 |
set num to (num - bas * mult) |
1529 |
else |
1530 |
set out to out & "0" |
1531 |
end if |
1532 |
end repeat |
1533 |
return out |
1534 |
end Num32ToHex |
1535 |
|
1536 |
tell application "Finder" |
1537 |
system attribute "sysv" |
1538 |
end tell |
1539 |
|
1540 |
Num32ToHex(result) |
1541 |
return (text 7 through 7 of result) |
1542 |
EOF |
1543 |
|
1544 |
open BLECH, ">/tmp/os$$"; |
1545 |
print BLECH $minorScript; |
1546 |
close BLECH; |
1547 |
|
1548 |
open OSXMIN, "/usr/bin/osascript </tmp/os$$|"; |
1549 |
$tmp=<OSXMIN>; |
1550 |
chomp $tmp; |
1551 |
$macosxCdefs.=" -DBUILD_OS_MINOR=" . $tmp; |
1552 |
close OSXMIN; |
1553 |
unlink "/tmp/os$$"; |
1554 |
|
1555 |
my $revScript = <<EOF; |
1556 |
on Num32ToHex(num) |
1557 |
if num < 0 then |
1558 |
set num to (2 ^ 32) + num |
1559 |
end if |
1560 |
set out to "" |
1561 |
repeat with idx from 7 to 0 by -1 |
1562 |
set bas to (16 ^ idx) as integer |
1563 |
if num >= bas then |
1564 |
set mult to ((num - (num mod bas)) / bas) as integer |
1565 |
set out to out & character mult of "123456789ABCDEF" |
1566 |
set num to (num - bas * mult) |
1567 |
else |
1568 |
set out to out & "0" |
1569 |
end if |
1570 |
end repeat |
1571 |
return out |
1572 |
end Num32ToHex |
1573 |
|
1574 |
tell application "Finder" |
1575 |
system attribute "sysv" |
1576 |
end tell |
1577 |
|
1578 |
Num32ToHex(result) |
1579 |
return (text 8 through 8 of result) |
1580 |
EOF |
1581 |
open BLECH, ">/tmp/os$$"; |
1582 |
print BLECH $revScript; |
1583 |
close BLECH; |
1584 |
|
1585 |
open OSXREV, "/usr/bin/osascript </tmp/os$$|"; |
1586 |
$tmp=<OSXREV>; |
1587 |
chomp $tmp; |
1588 |
$macosxCdefs.=" -DBUILD_OS_REV=" . $tmp; |
1589 |
close OSXREV; |
1590 |
unlink "/tmp/os$$"; |
1591 |
} |
1592 |
|
1593 |
if ( $GUIBASE eq "aqua" ) { |
1594 |
$macosxCdefs.=" -DQUARTZ"; |
1595 |
} |
1596 |
|
1597 |
$macosxCdefs .= "\""; |
1598 |
ToFile( "ENVCDEFS", $macosxCdefs, "e"); |
1452 |
} |
1599 |
} |
1453 |
|
1600 |
|
1454 |
ToFile( "MKDEPENDSOLVER", "TRUE", "e" ); |
1601 |
ToFile( "MKDEPENDSOLVER", "TRUE", "e" ); |