From 3b65ac6f9a61fc7aa85f596ece1a560d37645f0b Mon Sep 17 00:00:00 2001 From: kleuter Date: Thu, 2 Jan 2025 16:01:09 +0100 Subject: [PATCH] Update compile_mac.pl --- 6.8.1/compile_mac.pl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/6.8.1/compile_mac.pl b/6.8.1/compile_mac.pl index 06887d6..2e8fa0a 100644 --- a/6.8.1/compile_mac.pl +++ b/6.8.1/compile_mac.pl @@ -33,6 +33,20 @@ sub run_command { } } +# Subroutine to run a command with optional elevation +sub run_command_with_sudo { + my ($cmd) = @_; + print "Running: $cmd\n"; + open(my $pipe, '-|', "sudo $cmd 2>&1") or die "Error: Unable to execute '$cmd' with sudo.\n"; + while (my $line = <$pipe>) { + print $line; + } + close($pipe); + if ($? != 0) { + die "Error: Command '$cmd' with sudo failed.\n"; + } +} + # Check for ninja if (!command_exists('ninja')) { die "Error: 'ninja' is not installed or not in the PATH. You can use 'brew install ninja' command\n"; @@ -63,8 +77,8 @@ run_command("../configure $skip_modules_string -- -DCMAKE_OSX_ARCHITECTURES=\"x8 print "Building Qt6...\n"; run_command("cmake --build . --parallel"); -# Install Qt6 -print "Installing Qt6...\n"; -run_command("cmake --install ."); +# Install Qt6 with sudo +print "Installing Qt6 with elevated privileges...\n"; +run_command_with_sudo("cmake --install ."); print "Qt6 has been successfully built and installed.\n"; \ No newline at end of file