The following functionality is added in this pull request:
make-environment-linux.sh script detects the Linux distribution based on popular package managers such as dnf, yum, apt, and pacman. More support for other distributions can be added through this method in the future e.g. zypper for OpenSuse.
It looks for four package managers i.e. dnf, yum, apt, and pacman. If none of them is found, make process is exited with distribution not supported message.
Since dnf is recommended for redhat-8 and newer distributions, the script uses it to install the required packages.
The added script also enables additional repos such as epel, powertools (for Centos distributions), and ol*_codeready_builder (for Oracle Linux 8/9) for installing the required packages such as ccpcheck.
It seems that iwyu package is not available in the official repos for CentOS-8 and Oracle Linux 8/9 so we try to build it from the github repo.
Similarly, it also checks for the availability of lcovpackage and if not available, the latest rpm from github repo is downloaded and installed locally.
The new additions do not break the current support for debian-based distributions but add more support for other distributions.
Testing
Official docker images were used to test the new feature. These include:
Archlinux
Debian 11
Ubuntu 22.04
Ubuntu 20.04
Centos 8
Oracle Linux 8.6
Oracle Linux 9
I am attaching the standard output console logs logs.zip resulting from running make with this PR.
I have also tested it on CentOS 7 and Oracle Linux 7. The make environment tasks work fine, but there are CMake errors that need to be looked at.
cmake -S . -B /root/electionguard-cpp/build/libs/x86_64/Release \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ -DCAN_USE_VECTOR_INTRINSICS=ON \ -DCPM_SOURCE_CACHE=/root/electionguard-cpp/.cache/CPM CMake Error: The source directory "/root/electionguard-cpp/build/libs/x86_64/Release" does not exist. Specify --help for usage, or press the help button on the CMake GUI.
Since these distributions are not the latest ones and may not be supported anymore, therefore, we can avoid their support.
Issue
resolves #142
Description
This pull request adds support for making environment for Arch Linux and other redhat-based distributions such as Oracle Linux and CentOS. A new script called
make-environment-linux.sh
has been added and called after https://github.com/microsoft/electionguard-cpp/blob/8f8bcb550a273c58d7336f61621b00339913d817/Makefile#L47 when Linux is detected in the Makefile.The following functionality is added in this pull request:
make-environment-linux.sh
script detects the Linux distribution based on popular package managers such as dnf, yum, apt, and pacman. More support for other distributions can be added through this method in the future e.g. zypper for OpenSuse.distribution not supported
message.iwyu
package is not available in the official repos for CentOS-8 and Oracle Linux 8/9 so we try to build it from the github repo.lcov
package and if not available, the latest rpm from github repo is downloaded and installed locally.The new additions do not break the current support for debian-based distributions but add more support for other distributions.
Testing
Official docker images were used to test the new feature. These include:
I am attaching the standard output console logs logs.zip resulting from running
make
with this PR.I have also tested it on CentOS 7 and Oracle Linux 7. The
make environment
tasks work fine, but there are CMake errors that need to be looked at.cmake -S . -B /root/electionguard-cpp/build/libs/x86_64/Release \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ -DCAN_USE_VECTOR_INTRINSICS=ON \ -DCPM_SOURCE_CACHE=/root/electionguard-cpp/.cache/CPM CMake Error: The source directory "/root/electionguard-cpp/build/libs/x86_64/Release" does not exist. Specify --help for usage, or press the help button on the CMake GUI.
Since these distributions are not the latest ones and may not be supported anymore, therefore, we can avoid their support.