[Mesa-users] Simplifying mesasdk_arch_check

RICHARD H D TOWNSEND townsend at astro.wisc.edu
Tue Oct 9 12:15:11 EDT 2018


Hi Ralph --

This is a great idea -- thanks, I'll include it in the next release.

cheers,

Rich

> On Oct 9, 2018, at 6:00 AM, Ralph Sutherland via Mesa-users <mesa-users at lists.mesastar.org> wrote:
> 
> Hi I had a minor glitch setting up the sdk on my iMacPro with the architecture checking perl script.
> 
> At least one version of the mesa sdk architecture check script ("x86_64-osx-10.12-20170921") breaks with an iMacPro, as it tries to match explicit model names and numbers rather than capabilities.  Adding iMacPro manually like I did first  just adds to the fragility of the script: ( It has probably been fixed in newer versions but I am keeping a project frozen for collaborative reasons)
> 
> The script has explicit model and model number checks
> 
> # Darwin (OS X) -- use system_profiler
> 
> my $hardware_data = `system_profiler SPHardwareDataType 2> /dev/null`;
> 
> if($hardware_data =~ m/^\s*Model Identifier:\s*([A-Za-z]+)(\d+),(\d+)\s*$/m) {
> 
>   my $model_name = $1;
>   my $model_major = $2;
>   my $model_minor = $3;
> 
>   if($model_name eq 'MacPro' ||
>     $model_name eq 'MacBookAir' ||
>     $model_name eq 'Xserve' ||
>     ($model_name eq 'MacBookPro' && $model_major >= 2) ||
>     ($model_name eq 'MacBook' && $model_major >= 2) ||
>     ($model_name eq 'iMac' && $model_major >= 5) ||
>     ($model_name eq 'iMacPro') ||
>     ($model_name eq 'Macmini' && $model_major >= 2)) {
>       $supported = 'Y';
>     }
> 
> }
> 
> If you want to use a separate Darwin check, you could use the BSD UNIX sysctl kernel variable tool to simply query 64 bit capability, independent of any mac model name or number:
> 
> Just a suggestion
> Cheers
> Ralph
> 
> 
> elsif($os eq 'Darwin') {
> #
> # Darwin (OS X) -- use sysctl or even uname same as above
> #
> # possible sysctl options -- mac model name independent
> # hw.cpu64bit_capable 1
> # hw.optional.x86_64 1
> #
> 	my $arch = `sysctl -n hw.cpu64bit_capable`;
> 	chomp $arch;
> 	if($arch eq '1') {
> 	$supported = 'Y';
> 	}
> #
> }
> 
> Also uname works in macOS (at least in 10.13 and 14) so it could all be simplified greatly to just the linux case, and maybe just uname -m  for  the whole script to just one test:
> 
>     my $arch = `uname -m 2>/dev/null`;
>     chomp $arch;
>     if($arch eq 'x86_64') {
>     $supported = 'Y';
>     }
>     elsif($arch eq 'i686') {
>     $supported = 'Y';
>     }
> _______________________________________________
> mesa-users at lists.mesastar.org
> https://lists.mesastar.org/mailman/listinfo/mesa-users
> 




More information about the Mesa-users mailing list