From c5e7725747bda000373015b5252ff828df7c590a Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 25 Jul 2024 12:08:22 -0700 Subject: [PATCH] Build fixes for codeQL (#100) --- .github/workflows/codeql-analysis.yml | 4 +++- build.psm1 | 12 +++++++----- src/libpsl-native/gmock.pc | 6 +++--- src/libpsl-native/gmock_main.pc | 6 +++--- src/libpsl-native/gtest.pc | 6 +++--- src/libpsl-native/gtest_main.pc | 6 +++--- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b25067e..89754d2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -53,7 +53,9 @@ jobs: name: Capture Environment - run: | - tools/releaseBuild/vstsBuild.ps1 -Name 'centos.7' -Verbose + Import-Module ./build.psm1 + Start-PSBootstrap + Start-BuildNativeUnixBinaries name: Build - name: Perform CodeQL Analysis diff --git a/build.psm1 b/build.psm1 index 05832f4..9c4ec58 100644 --- a/build.psm1 +++ b/build.psm1 @@ -136,13 +136,15 @@ function Get-EnvironmentInformation $environment += @{'IsUbuntu16' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '16.04'} $environment += @{'IsUbuntu17' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '17.10'} $environment += @{'IsUbuntu18' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '18.04'} + $environment += @{'IsUbuntu22' = $Environment.IsUbuntu -and $LinuxInfo.VERSION_ID -match '22.04'} $environment += @{'IsCentOS' = $LinuxInfo.ID -match 'centos' -and $LinuxInfo.VERSION_ID -match '7'} $environment += @{'IsFedora' = $LinuxInfo.ID -match 'fedora' -and $LinuxInfo.VERSION_ID -ge 24} + $environment += @{'IsRedHat' = $LinuxInfo.ID -match 'rhel'} $environment += @{'IsOpenSUSE' = $LinuxInfo.ID -match 'opensuse'} $environment += @{'IsSLES' = $LinuxInfo.ID -match 'sles'} $environment += @{'IsOpenSUSE13' = $Environmenst.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '13'} $environment += @{'IsOpenSUSE42.1' = $Environment.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '42.1'} - $environment += @{'IsRedHatFamily' = $Environment.IsCentOS -or $Environment.IsFedora} + $environment += @{'IsRedHatFamily' = $Environment.IsCentOS -or $Environment.IsFedora -or $Environment.IsRedHat} $environment += @{'IsSUSEFamily' = $Environment.IsSLES -or $Environment.IsOpenSUSE} $environment += @{'IsAlpine' = $LinuxInfo.ID -match 'alpine'} @@ -1891,7 +1893,7 @@ function Install-Dotnet { } function Get-RedHatPackageManager { - if ($Environment.IsCentOS) { + if ($Environment.IsCentOS -or $Environment.IsRedHat) { "yum install -y -q" } elseif ($Environment.IsFedora) { "dnf install -y -q" @@ -1978,13 +1980,13 @@ function Start-PSBootstrap { } } elseif ($Environment.IsRedHatFamily) { # Build tools - $Deps += "which", "curl", "gcc-c++", "cmake", "make" + $Deps += "which", "curl", "wget" # .NET Core required runtime libraries - $Deps += "libicu", "libunwind" + $Deps += "libicu", "openssl-libs" # Packaging tools - if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel' } + if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel', "gcc-c++" } $PackageManager = Get-RedHatPackageManager diff --git a/src/libpsl-native/gmock.pc b/src/libpsl-native/gmock.pc index dd45b5f..c876c6d 100644 --- a/src/libpsl-native/gmock.pc +++ b/src/libpsl-native/gmock.pc @@ -1,9 +1,9 @@ -libdir=/usr/local/lib +libdir=/usr/local/lib64 includedir=/usr/local/include Name: gmock Description: GoogleMock (without main() function) Version: 1.9.0 URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Libs: -L${libdir} -lgmock -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/src/libpsl-native/gmock_main.pc b/src/libpsl-native/gmock_main.pc index ad1e97b..de7b67b 100644 --- a/src/libpsl-native/gmock_main.pc +++ b/src/libpsl-native/gmock_main.pc @@ -1,9 +1,9 @@ -libdir=/usr/local/lib +libdir=/usr/local/lib64 includedir=/usr/local/include Name: gmock_main Description: GoogleMock (with main() function) Version: 1.9.0 URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock_main -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Libs: -L${libdir} -lgmock_main -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/src/libpsl-native/gtest.pc b/src/libpsl-native/gtest.pc index c7c84e6..b5157d7 100644 --- a/src/libpsl-native/gtest.pc +++ b/src/libpsl-native/gtest.pc @@ -1,9 +1,9 @@ -libdir=/usr/local/lib +libdir=/usr/local/lib64 includedir=/usr/local/include Name: gtest Description: GoogleTest (without main() function) Version: 1.9.0 URL: https://github.com/google/googletest -Libs: -L${libdir} -lgtest -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Libs: -L${libdir} -lgtest -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread diff --git a/src/libpsl-native/gtest_main.pc b/src/libpsl-native/gtest_main.pc index 4c5d885..9d3c318 100644 --- a/src/libpsl-native/gtest_main.pc +++ b/src/libpsl-native/gtest_main.pc @@ -1,4 +1,4 @@ -libdir=/usr/local/lib +libdir=/usr/local/lib64 includedir=/usr/local/include Name: gtest_main @@ -6,5 +6,5 @@ Description: GoogleTest (with main() function) Version: 1.9.0 URL: https://github.com/google/googletest Requires: gtest -Libs: -L${libdir} -lgtest_main -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 +Libs: -L${libdir} -lgtest_main -pthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -pthread