From ce044498133abe61cf28b803b0aad2a74d3ce3f0 Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Fri, 15 Dec 2023 16:05:22 -0800 Subject: [PATCH] refactor program data ongoing --- pinxi | 216 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/pinxi b/pinxi index 03da52d..f92204e 100755 --- a/pinxi +++ b/pinxi @@ -7499,10 +7499,9 @@ sub sound_data { } ## Servers ## if ($program = main::check_program('artsd')){ - $name = 'aRts'; + ($name,$version) = ProgramData::full('arts',$program); $status = (grep {/artsd/} @ps_cmd) ? 'active': 'off'; $type = 'Server'; - $version = ProgramData::version($program,'^artsd',2,'-v',1); if ($extra > 1){ $test = [['artswrapper','daemon'],]; $helpers = sound_helpers($test); @@ -7517,10 +7516,9 @@ sub sound_data { # pulseaudio-esound-compat has esd pointing to esdcompat if (($program = main::check_program('esd')) && !main::check_program('esdcompat')){ - $name = 'EsounD'; + ($name,$version) = ProgramData::full('esound',$program); $status = (grep {/\besd\b/} @ps_cmd) ? 'active': 'off'; $type = 'Server'; - $version = ProgramData::version($program,'^Esound',3,'--version',1,1); # if ($extra > 1){ # $test = [['','daemon'],]; # $helpers = sound_helpers($test); @@ -7533,10 +7531,9 @@ sub sound_data { ($status,$version,$helpers,$tools) = ('','',undef,undef); } if ($program = main::check_program('jackd')){ - $name = 'JACK'; + ($name,$version) = ProgramData::full('jack',$program); $status = jack_status(); $type = 'Server'; - $version = ProgramData::version($program,'^jackd',3,'--version',1); if ($extra > 1){ $test = [['a2jmidid','daemon'],['nsmd','daemon']]; $helpers = sound_helpers($test); @@ -7549,10 +7546,9 @@ sub sound_data { ($status,$version,$helpers,$tools) = ('','',undef,undef); } if ($program = main::check_program('nasd')){ - $name = 'NAS'; + ($name,$version) = ProgramData::full('nas',$program); $status = (grep {/(^|\/)nasd/} @ps_cmd) ? 'active': 'off'; $type = 'Server'; - $version = ProgramData::version($program,'^Network Audio',5,'-V',1); if ($extra > 1){ $test = [['audiooss','oss-compat'],]; $helpers = sound_helpers($test); @@ -7565,10 +7561,9 @@ sub sound_data { ($status,$version,$helpers,$tools) = ('','',undef,undef); } if ($program = main::check_program('pipewire')){ - $name = 'PipeWire'; + ($name,$version) = ProgramData::full('pipewire',$program); $status = pipewire_status(); $type = 'Server'; - $version = ProgramData::version($program,'^Compiled with libpipe',4,'--version',1); if ($extra > 1){ # pipewire-alsa is a plugin, but is just some config files $test = [['pipewire-pulse','daemon'],['pipewire-media-session','daemon'], @@ -7591,10 +7586,9 @@ sub sound_data { } # note: pactl info/list/stat could be used if ($program = main::check_program('pulseaudio')){ - $name = 'PulseAudio'; + ($name,$version) = ProgramData::full('pulseaudio',$program); $status = pulse_status($program); $type = 'Server'; - $version = ProgramData::version($program,'^pulseaudio',2,'--version',1); if ($extra > 1){ $test = [['pulseaudio-dlna','daemon'], ['pulseaudio-alsa','plugin','/etc/alsa/conf.d/*-pulseaudio-default.conf'], @@ -7610,10 +7604,9 @@ sub sound_data { ($status,$version,$helpers,$tools) = ('','',undef,undef); } if ($program = main::check_program('roard')){ - $name = 'RoarAudio'; + ($name,$version) = ProgramData::full('roaraudio',$program);# no version so far $status = (grep {/roard/} @ps_cmd) ? 'active': 'off'; $type = 'Server'; - # no version so far if ($extra > 1){ $test = [['roarplaylistd','daemon'],['roarify','pulse/viff-emulation']]; $helpers = sound_helpers($test); @@ -19099,7 +19092,7 @@ sub component_recursive_data { } ## MachineItem -# public subs: get(); is_vm() +# public methods: get(), is_vm() { my $b_vm; package MachineItem; @@ -28304,7 +28297,7 @@ sub version_bsd { # on earlier BSDs if (/^kern.compiler_version/){ @working = split(/:\s*/, $_); - $working[1] =~ /.*(gcc|clang)\sversion\s([\S]+)\s.*/; + $working[1] =~ /.*(clang|gcc|zigcc)\sversion\s([\S]+)\s.*/; @$compiler = ($1,$2); last; } @@ -28314,8 +28307,7 @@ sub version_bsd { # be Clang until way into the future, and it will be the installed version. if (ref $compiler ne 'ARRAY' || !@$compiler){ if (my $path = main::check_program('clang')){ - $compiler->[0] = 'clang'; - $compiler->[1] =ProgramData::version($path,'clang',3,'--version'); + ($compiler->[0],$compiler->[1]) = ProgramData::full('clang',$path); } } } @@ -28345,16 +28337,17 @@ sub version_proc { # $result='Linux version 6.5.0-9-generic (buildd@bos03-amd64-043) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0, GNU ld (GNU Binutils for Ubuntu) 2.41) #9-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 7 01:35:40 UTC 2023'; # $result='Linux version 6.5.13-un-def-alt1 (builder@localhost.localdomain) (gcc-13 (GCC) 13.2.1 20230817 (ALT Sisyphus 13.2.1-alt2), GNU ld (GNU Binutils) 2.41.0.20230826) #1 SMP PREEMPT_DYNAMIC Wed Nov 29 15:54:38 UTC 2023'; } + # Note: zigcc is only theoretical, but someone is going to try it! # cleanest, old style: 'clang version 9.0.0 (' | 'gcc version 7.5.0' - if ($result =~ /(gcc|clang).*?version\s([^,\s\)]+)/){ + if ($result =~ /(gcc|clang|zigcc).*?version\s([^,\s\)]+)/){ @$compiler = ($1,$2); } # new styles: compiler + stuff + x.y.z. Ignores modifiers to number: -4, -ubuntu - elsif ($result =~ /(gcc|clang).*?\s(\d+(\.\d+){2,4})[)\s,_-]/){ + elsif ($result =~ /(gcc|clang|zigcc).*?\s(\d+(\.\d+){2,4})[)\s,_-]/){ @$compiler = ($1,$2); } # failed, let's at least try for compiler type - elsif ($result =~ /(gcc|clang)/){ + elsif ($result =~ /(gcc|clang|zigcc)/){ @$compiler = ($1,'N/A'); } } @@ -30338,7 +30331,7 @@ sub set_gpart_data { sub get_display_manager { eval $start if $b_log; - my (@data,@glob,$link,$path,@temp); + my (@glob,$link,$path,@temp); my $found = []; # ldm - LTSP display manager. Note that sddm does not appear to have a .pid # extension in Arch. Guessing on cdm, qingy. pcdm uses vt, PCDM-vt9.pid @@ -30399,9 +30392,7 @@ sub get_display_manager { else {$path = $dm} # print "$path $extra\n"; @dm_info = (); - @data = ProgramData::full($dm,$path,3); - $dm_info[0] = $data[0]; - $dm_info[1] = $data[1]; + ($dm_info[0],$dm_info[1]) = ProgramData::full($dm,$path,3); if (scalar @dms > 1 && (my $temp = ServiceData::get('status',$dm))){ $dm_info[2] = message('stopped') if $temp && $temp =~ /stopped|disabled/; } @@ -30412,9 +30403,7 @@ sub get_display_manager { if (@{$ps_data{'dm-active'}}){ # ly does not have a run/pid file if (grep {$_ eq 'ly'} @{$ps_data{'dm-active'}}){ - @data = ProgramData::full('ly','ly',3); - $dm_info[0] = $data[0]; - $dm_info[1] = $data[1]; + ($dm_info[0],$dm_info[1]) = ProgramData::full('ly','ly',3); $found->[0] = [@dm_info]; } elsif (grep {/startx$/} @{$ps_data{'dm-active'}}){ @@ -31431,7 +31420,7 @@ sub get_gcc_data { return $gccs; } -## GlabelData - set/get +## GlabelData: public methods: set(), get() # Used only to get RAID ZFS gptid path standard name, like ada0p1 { package GlabelData; @@ -31513,10 +31502,10 @@ sub get { if (($comm && $comm =~ /systemd/) || -e '/run/systemd/units'){ $init = 'systemd'; if ($program = main::check_program('systemd')){ - $init_version = ProgramData::version($program,'^systemd','2','--version',1); + ($init,$init_version) = ProgramData::full('systemd',$program); } if (!$init_version && ($program = main::check_program('systemctl'))){ - $init_version = ProgramData::version($program,'^systemd','2','--version',1); + ($init,$init_version) = ProgramData::full('systemd',$program); } if ($runlevel && $runlevel =~ /^\d$/){ my $target = ''; @@ -31535,20 +31524,15 @@ sub get { $init = '31init'; # no version, this is a 31 line C program } - # epoch version == Epoch Init System 1.0.1 "Sage" elsif ($comm =~ /epoch/){ - $init = 'Epoch'; - $init_version = ProgramData::version('epoch', '^Epoch', '4','version'); + ($init,$init_version) = ProgramData::full('epoch'); } # if they fix dinit to show /proc/1/comm == dinit elsif ($comm =~ /^dinit/){ - dinit_data(); + ($init,$init_version) = ProgramData::full('dinit'); } elsif ($comm =~ /finit/){ - $init = 'finit'; - if ($program = main::check_program('finit')){ - $init_version = ProgramData::version($program,'^Finit','2','-v',1); - } + ($init,$init_version) = ProgramData::full('finit'); } # not verified elsif ($comm =~ /^hummingbird/){ @@ -31572,25 +31556,31 @@ sub get { # no version data as of 2022-10-26 } elsif ($comm =~ /shepherd/){ - $init = 'Shepherd'; - $init_version = ProgramData::version('shepherd', '^shepherd', '4','--version',1); + ($init,$init_version) = ProgramData::full('shepherd'); } # fallback for some inits that link to /sbin/init elsif ($comm eq 'init'){ # shows /sbin/dinit-init but may change if (-e '/sbin/dinit' && $link && $link =~ /dinit/){ - dinit_data(); + ($init,$init_version) = ProgramData::full('dinit'); } elsif (-e '/sbin/openrc-init' && $link && $link =~ /openrc/){ - ($init,$init_version) = openrc_data(); + $init = 'OpenRc'; + # /sbin/openrc --version: openrc (OpenRC) 0.13 + if ($program = main::check_program('openrc')){ + ($init,$init_version) = ProgramData::full('openrc',$program); + } + # /sbin/rc --version: rc (OpenRC) 0.11.8 (Gentoo Linux) + elsif ($program = main::check_program('rc')){ + ($init,$init_version) = ProgramData::full('rc',$program); + } } } } if (!$init){ # openwrt/busybox /sbin/init hangs on --version command if (-e '/sbin/init' && $link && $link =~ /busybox/){ - $init_version = ProgramData::version('init', 'busybox', '2','--help',1,1); - $init = 'BusyBox'; + ($init,$init_version) = ProgramData::full('busybox','/sbin/init'); } # risky since we don't know which init it is. $comm == 'init' # output: /sbin/init --version: init (upstart 1.1); init (upstart 0.6.3) @@ -31639,32 +31629,6 @@ sub get { }; } -sub dinit_data { - eval $start if $b_log; - $init = 'dinit'; - # Dinit version 0.15.1. - if ($program = main::check_program('dinit')){ - $init_version = ProgramData::version($program,'^Dinit','3','--version',1); - $init_version =~ s/\.$//; - } - eval $end if $b_log; -} - -sub openrc_data { - eval $start if $b_log; - my $version; - # /sbin/openrc --version == openrc (OpenRC) 0.13 - if ($program = main::check_program('openrc')){ - $version = ProgramData::version($program, '^openrc', '3','--version'); - } - # /sbin/rc --version == rc (OpenRC) 0.11.8 (Gentoo Linux) - elsif ($program = main::check_program('rc')){ - $version = ProgramData::version($program, '^rc', '3','--version'); - } - eval $end if $b_log; - return ('OpenRC',$version); -} - # Check? /var/run/nologin for bsds? sub get_runlevel { eval $start if $b_log; @@ -31996,7 +31960,7 @@ sub parameters_bsd { } } -## LsblkData - set/get +## LsblkData: public methods: set(), get() { package LsblkData; @@ -33702,7 +33666,7 @@ sub _round { } } -## PartitionData - set/get +## PartitionData: public methods: set(), get() # for /proc/partitions only, see DiskDataBSD for BSD partition data. { package PartitionData; @@ -33849,7 +33813,7 @@ sub get_pcie_data { eval $end if $b_log; } -## PowerData - get +## PowerData: public method: get() # No BSD support currently. Test by !$bsd_type. Should any BSD data source # appear, make bsd_data() and add $bsd_type switch here, remove from caller. { @@ -33914,15 +33878,16 @@ sub sys_data { } # ProgramData -# public subs: -# full() - returns (print name, version nu). -# values() - returns program values array -# version() - returns program version number +# public methods: +# full(): returns (print name, version nu). +# values(): returns program values array +# version(): returns program version number { package ProgramData; # returns array of: 0: program print name 1: program version -# args: 0: program values ID; 1: program version string; +# args: 0: program values ID [usually program name]; +# 1: program alternate name, or path [allows for running different command]; # 2: $extra level. Note that StartClient runs BEFORE -x levels are set! # Only use this function when you only need the name/version data returned sub full { @@ -33950,11 +33915,11 @@ sub full { # It's almost 1000 times slower to load these each time values() is called!! # %program_values: key: desktop/app command for --version => [0: search string; # 1: space print number; 2: [optional] version arg: -v, version, etc; -# 3: print name; 4: console 0/1; 5: [optional] exit first find 0/1; +# 3: print name; 4: console 0/1; 5: [optional] exit first line 0/1; # 6: [optional] 0/1 stderr output; 7: replace regex; 8: extra data] sub set_values { %program_values = ( - ## Clients ## + ## Clients (IRC,chat) ## 'bitchx' => ['bitchx',2,'','BitchX',1,0,0,'',''],# special 'finch' => ['finch',2,'-v','Finch',1,1,0,'',''], 'gaim' => ['[0-9.]+',2,'-v','Gaim',0,1,0,'',''], @@ -33975,6 +33940,11 @@ sub set_values { 'weechat-curses' => ['[0-9.]+',1,'-v','WeeChat',1,0,0,'',''], 'xchat-gnome' => ['[0-9.]+',2,'-v','X-Chat-Gnome',1,1,0,'',''], 'xchat' => ['[0-9.]+',2,'-v','X-Chat',1,1,0,'',''], + ## Compilers ## + 'clang' => ['clang',3,'--version','clang',1,1,0,'',''], + 'gcc' => ['^gcc',3,'--version','GCC',1,0,0,'',''], # not used due to inconsistent syntax + 'gcc-apple' => ['Apple[[:space:]]LLVM',2,'--version','LLVM',1,0,0,'',''], # not used + 'zigcc' => ['zigcc',0,'0','zigcc',1,1,0,'',''], # unverified ## Desktops / wm / compositors ## '2bwm' => ['^2bwm',0,'0','2bWM',0,1,0,'',''], # unverified/based on mcwm '3dwm' => ['^3dwm',0,'0','3Dwm',0,1,0,'',''], # unverified @@ -34106,6 +34076,7 @@ sub set_values { 'muffin' => ['^muffin',2,'--version','Muffin',0,1,0,'',''], 'musca' => ['^musca',0,'-v','Musca',0,1,0,'',''], # unverified 'mutter' => ['^mutter',2,'--version','Mutter',0,1,0,'',''], + 'mvwm' => ['^mvwm',0,'0','mvwm',0,1,0,'',''], # unverified 'mwm' => ['^mwm',0,'0','MWM',0,1,0,'',''],# no version 'nawm' => ['^nawm',0,'0','nawm',0,1,0,'',''],# unverified 'newm' => ['^newm',0,'0','newm',0,1,0,'',''], # unverified @@ -34204,10 +34175,6 @@ sub set_values { 'xmonad' => ['^xmonad',2,'--version','XMonad',0,1,0,'',''], 'xuake' => ['^xuake',0,'0','xuake',0,1,0,'',''], # unverified 'yeahwm' => ['^yeahwm',0,'--version','YeahWM',0,1,0,'',''], # unverified - ## Toolkits ## - 'gtk-launch' => ['^\S',1,'--version','GTK',0,1,0,'',''], - 'qmake' => ['^^Using Qt version',4,'--version','Qt',0,0,0,'',''], - 'qtdiag' => ['^qt',2,'--version','Qt',0,1,0,'',''], ## Display Managers (dm) ## 'brzdm' => ['^brzdm version',3,'-v','brzdm',0,1,0,'',''], # unverified, slim fork 'cdm' => ['^cdm',0,'0','CDM',0,1,0,'',''], @@ -34244,6 +34211,20 @@ sub set_values { 'xdmctl' => ['^xdm',0,'0','XDM',0,1,0,'',''],# opensuse/redhat may use this to start real dm 'xenodm' => ['^xenodm',0,'0','xenodm',0,1,0,'',''], 'xlogin' => ['^xlogin',0,'-V','xlogin',0,1,0,'',''], # unverified, probably clogin + ## Init ## + 'busybox' => ['busybox',2,'--help','BusyBox',0,1,1,'',''], + # Dinit version 0.15.1. [ends .] + 'dinit' => ['^Dinit',3,'--version','Dinit',0,1,0,'',''], + # version: Epoch Init System 1.0.1 "Sage" + 'epoch' => ['^Epoch',4,'version','Epoch',0,1,0,'',''], + 'finit' => ['^Finit',2,'-v','finit',0,1,0,'',''], + # /sbin/openrc --version: openrc (OpenRC) 0.13 + 'openrc' => ['^openrc',3,'--version','OpenRC',0,1,0,'',''], + # /sbin/rc --version: rc (OpenRC) 0.11.8 (Gentoo Linux) + 'rc' => ['^rc',3,'--version','OpenRC',0,1,0,'',''], + 'shepherd' => ['^shepherd',4,'--version','Shepherd',0,1,0,'',''], + 'systemd' => ['^systemd',2,'--version','systemd',0,1,0,'',''], + 'upstart' => ['upstart',3,'--version','Upstart',0,1,0,'',''], ## Shells - not checked: ion, eshell ## ## See ShellData::shell_test() for unhandled but known shells 'ash' => ['',3,'pkg','ash',1,0,0,'',''], # special; dash precursor @@ -34271,10 +34252,19 @@ sub set_values { 'xonsh' => ['^xonsh',1,'--version','xonsh',1,0,0,'^xonsh[\/-]',''], 'yash' => ['^Y',5,'--version','yash',1,0,0,'',''], 'zsh' => ['^zsh',2,'--version','Zsh',1,0,0,'',''], + ## Sound Servers ## + 'arts' => ['^artsd',2,'-v','aRts',0,1,0,'',''], + 'esound' => ['^Esound',3,'--version','EsounD',0,1,1,'',''], + 'jack' => ['^jackd',3,'--version','JACK',0,1,0,'',''], + 'nas' => ['^Network Audio',5,'-V','NAS',0,1,0,'',''], + 'pipewire' => ['^Compiled with libpipe',4,'--version','PipeWire',0,1,0,'',''], + 'pulseaudio' => ['^pulseaudio',2,'--version','PulseAudio',0,1,0,'',''], + 'roaraudio' => ['^roaraudio',0,'0','RoarAudio',0,1,0,'',''], # no version/unknown? + ## Toolkits ## + 'gtk-launch' => ['^\S',1,'--version','GTK',0,1,0,'',''], + 'qmake' => ['^^Using Qt version',4,'--version','Qt',0,0,0,'',''], + 'qtdiag' => ['^qt',2,'--version','Qt',0,1,0,'',''], ## Tools ## - 'clang' => ['clang',3,'--version','Clang',1,0,0,'',''], - 'gcc' => ['^gcc',3,'--version','GCC',1,0,0,'',''], - 'gcc-apple' => ['Apple[[:space:]]LLVM',2,'--version','LLVM',1,0,0,'',''], 'sudo' => ['^Sudo',3,'-V','Sudo',1,1,0,'',''], # sudo pre 1.7 does not have --version ); } @@ -34288,11 +34278,10 @@ sub set_values { # note: setting index 1 or 2 to 0 will trip flags to not do version # args: 0: program lower case name sub values { - my $app = $_[0]; my @values; ProgramData::set_values() if !%program_values; - if (defined $program_values{$app}){ - @values = @{$program_values{$app}}; + if (defined $program_values{$_[0]}){ + @values = @{$program_values{$_[0]}}; } # my $debug = Dumper \@values; main::log_data('dump','@values',\@values) if $b_log; @@ -34377,9 +34366,10 @@ sub version { # breaks version detection. A quick fix attempt is to just add 1 to $num # to get the next value. $version_nu = $data[$num+1] if $data[$num+1] && $version_nu =~ /version/i; - $version_nu =~ s/(\([^)]+\)|,|"|\||\(|\))//g if $version_nu; + $version_nu =~ s/(\([^)]+\)|,|"|\||\(|\)|\.$)//g if $version_nu; # trim off leading v but only when followed by a number $version_nu =~ s/^v([0-9])/$1/i if $version_nu; + # print "$version_nu\n"; last; } @@ -34438,7 +34428,10 @@ sub version_pkg { } ## PsData -# public subs: set_cmd(); set_gui() +# public methods: +# set_cmd(): sets @ps_aux, @ps_cmd +# set_dm(): sets $ps_data{'dm-active'} +# set_gui(): sets @ps_gui and $ps_data items { package PsData; @@ -34476,8 +34469,8 @@ sub set_cmd { # we want more data from ps busybox, to get TinyX screen res my $cols_use = ($b_busybox) ? 7 : 2; my $pattern = 'apache|brave|chrom(e|ium)|falkon|(fire|water)fox|gvfs|http|'; - $pattern .= 'konqueror|mariadb|mysql|openvpn|opera|pale|postgre|php|'; - $pattern .= 'qtwebengine|smbd|smtp|sssd|vivald'; + $pattern .= 'konqueror|mariadb|midori|mysql|nfsd|nginx|openvpn|opera|'; + $pattern .= 'pale|postgre|php|qtwebengine|smbd|smtp|sssd|vivald'; for (@$ps){ next if !$_; next if $self_name eq 'inxi' && /\/$self_name\b/; @@ -34497,12 +34490,13 @@ sub set_cmd { push(@ps_cmd,join(' ', @split[$ps_data{'header'}->[0] .. $final])); } } - # never prints with 5, because ps loaded before option handler - # print 'ps main: ', Data::Dumper::Dumper \@ps_cmd; # if $dbg[5]; + # dump multiple instances, just need to see if process running + main::uniq(\@ps_cmd) if @ps_cmd; + # Use $dbg[61] to see @ps_cmd result eval $end if $b_log; } -# only runs when no dm found +# only runs when no /run type dm found sub set_dm { eval $start if $b_log; # startx: /bin/sh /usr/bin/startx @@ -36477,10 +36471,11 @@ sub generate { main::set_dboot_data() if $bsd_type && !$loaded{'dboot'}; # note: ps aux loads before logging starts, so create debugger data here if ($b_log){ - # I don't think we need to see this, it's long, but leave in case we do + # With logging, we already get ps wwwaux so no need to get it again here # main::log_data('dump','@ps_aux',\@ps_aux); main::log_data('dump','@ps_cmd',\@ps_cmd); } + print Data::Dumper::Dumper \@ps_cmd if $dbg[61]; if ($show{'short'}){ $item = short_output(); assign_data($item); @@ -36788,7 +36783,7 @@ sub info_item { } } if ($extra > 0){ - my ($b_clang,$b_gcc,$gcc,$gcc_alt); + my ($b_gcc,$clang,$clang_version,$gcc,$gcc_alt,$path,$zigcc,$zigcc_version); my $gccs = main::get_gcc_data(); if (@$gccs){ $gcc = shift @$gccs; @@ -36798,22 +36793,27 @@ sub info_item { $b_gcc = 1; $gcc ||= 'N/A'; # should not be needed after fix but leave in case undef } - my $clang_version = ''; - if (my $path = main::check_program('clang')){ - $clang_version = ProgramData::version($path,'clang',3,'--version'); - $clang_version ||= 'N/A'; - $b_clang = 1; + if ($path = main::check_program('clang')){ + ($clang,$clang_version) = ProgramData::full('clang',$path); } - my $compiler = ($b_gcc || $b_clang) ? '': 'N/A'; + if ($path = main::check_program('zigcc')){ + ($zigcc,$zigcc_version) = ProgramData::full('zigcc',$path); + } + my $compiler = ($b_gcc || $clang || $zigcc) ? '': 'N/A'; $data->{$data_name}[$index]{main::key($num++,1,1,'Compilers')} = $compiler; + if ($clang){ + $clang_version ||= 'N/A'; + $data->{$data_name}[$index]{main::key($num++,0,2,'clang')} = $clang_version; + } if ($b_gcc){ $data->{$data_name}[$index]{main::key($num++,1,2,'gcc')} = $gcc; if ($extra > 1 && $gcc_alt){ $data->{$data_name}[$index]{main::key($num++,0,3,'alt')} = $gcc_alt; } } - if ($b_clang){ - $data->{$data_name}[$index]{main::key($num++,0,2,'clang')} = $clang_version; + if ($zigcc){ + $zigcc_version ||= 'N/A'; + $data->{$data_name}[$index]{main::key($num++,0,2,'zigcc')} = $zigcc_version; } } # $index++ if $extra > 1 && !$loaded{'shell-data'};