Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Adjust Setup PowerShell Scripts to Run on Barebones Windows #1277

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

dgreatwood
Copy link
Collaborator

The setup scripts, msvcsetup.ps1 or gccsetup.ps1, attempt to install necessary prerequisites, and configure the environment, so the Pistache library can be built, tested and installed. We have made a number of improvements to the scripts to handle Windows machines that have a minimum of prerequisites prior to the setup script being run. For instance, they will now execute even there is no git, no compiler, and no package manager on the Windows machine.

The scripts have also been extended to allow them to run without administrative privileges; if administrative privileges are required during setup, a new process/shell with admin rights is launched automatically.

See commit message for more details.

The setup scripts, msvcsetup.ps1 or gccsetup.ps1, attempt to install
necessary prerequisites, and configure the environment, so the
Pistache library can be built, tested and installed. We have made a
number of improvements to the scripts to handle Windows machines that
have a minimum of prerequisites prior to the setup script being run.

The scripts have also been extended to allow them to run without
admininstrative privileges; if admininstrative privileges are required
during setup, a new process/shell with admin rights is launched.

commonsetup.ps1
 - Add git to path when newly installed by winget
   (This applies generally to apps newly installed by winget. Although
    winget adjusts the path to reflect the newly installed app, that
    path adjustment takes effect only after we have started a new
    shell. So for the benefit of the current shell, we add the
    newly-installed app to the path)
 - Add more extensive output instructions telling the user to configure
   git when it is installed by our script.
 - Install Visual Studio earlier in the script, for the benefit of
   cmake.
 - Use Visual Studio's cmake if needed
 - Correctly capture the result (success or failure) of commands whose
   output is being piped to null. E.g.
       ($brotli_there = (vcpkg list "brotli")) *> $null
 - Invoke python to test if Python is present. Doing Get-Command
   doesn't work for Python.
 - Cope with long paths created in C:\Users\<name>\AppData in
   Windows 11 2H24.
 - Suppress pip3 warning
 - Uninstall non-openssl curl if needed
 - Implement the mechanism for getting admin rights when needed
 - Throw if running in a 32-bit shell
 - Get admin rights if needed before installing git
 - After installing git, exit with instructions on git configuration
 - When looking for existing vcpkg.exe, exclude Visual Studio version;
   Visual Studio version does not have the capability to install new
   packages in the way we'd want.
 - Get admin rights if needed before installing vcpkg
 - When checking for existing Visual Studio, check it's not empty
 - Get admin rights if needed before installing Visual Studio
 - Run Visual Studio installer with no GUI
 - Use vcpkg pkg-config if winget pkg-config package not available
 - Get admin rights if needed before installing googletest and zlib
 - Grant user write-access to "pistache_distribution" folder
 - Do git install/configure first, so if script has to exit from git
   install in a raised-privilege prompt, the script running at the
   lower-privileged prompt that caused the privilege-raise does not
   get confused.
 - Use "accept-source-agreements" with winget (for Windows Store TOS)
 - Before doing "python --version" to check for python, first do
   "Get-Command python". Needed on Windows Server 2019.
 - When checking for existing doxygen install, check $env:ProgramFiles
   and ${env:ProgramFiles(x86)}, not just the the user's home folder,
   in case we are executing at lower privilege but doxygen was
   installed in the system by a script running at a higher privilege.

gccsetup.ps1:
 - Correct syntax used in expansion of msys2
 - Add ninja to current path when newly installed by winget
 - Get admin rights if needed before installing msys2

msvcsetup.ps1:
 - Add ninja to current path when newly installed by winget
 - Skip configuring Visual Studio prompt if in a temporary
   administrator shell (which will exit before the prompt can be used)

tests/meson.build
 - Use Copy-Item, rather than creating a symbolic link where
   needed. Creation of a symbolic link can require admin rights in
   Windows.

installmanatinstall.ps1
 - Raise to admin level if needed when installing logging manifest

Building on Windows.txt
 - Add note on setting ExecutionPolicy so scripts can execute
 - Add note on disabling Enhanced Security Configuration for IE
 - Add note on fixing mingit circular config-file includes
@dgreatwood dgreatwood merged commit 0be5c9c into pistacheio:master Jan 6, 2025
134 of 135 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants