From 5eb04c91e6bdabb181eae8f4d7ed88905d2eae83 Mon Sep 17 00:00:00 2001 From: srinjoy933 Date: Fri, 20 Mar 2026 19:44:31 +0530 Subject: [PATCH 1/4] ci: add validation step for generated pkg-config files --- .github/workflows/CI.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b69bfdd2b..461382973 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -113,3 +113,25 @@ jobs: - name: Install project if: ${{ contains(matrix.build, 'cmake') }} run: cmake --install ${{ env.BUILD_DIR }} + + - name: Validate generated pkg-config file + if: ${{ contains(matrix.build, 'cmake') }} + shell: bash + run: | + # Ensure pkg-config is available + if ! command -v pkg-config &> /dev/null; then + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get update && sudo apt-get install -y pkg-config + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install pkg-config + fi + fi + + # Point to the installation directory specified by CMAKE_INSTALL_PREFIX + export PKG_CONFIG_PATH="$PWD/_dist/lib/pkgconfig:$PWD/_dist/share/pkgconfig:$PKG_CONFIG_PATH" + + # Run the validation + pkg-config --validate fortran_stdlib + + # Test flags to ensure no errors are thrown + pkg-config --cflags --libs fortran_stdlib \ No newline at end of file From a7f6645123153f0f32ed0b7867d61b400cadcef7 Mon Sep 17 00:00:00 2001 From: srinjoy933 Date: Mon, 23 Mar 2026 12:24:57 +0530 Subject: [PATCH 2/4] ci: dynamically locate pkg-config file --- .github/workflows/CI.yml | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 461382973..271e209b5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -118,20 +118,36 @@ jobs: if: ${{ contains(matrix.build, 'cmake') }} shell: bash run: | - # Ensure pkg-config is available - if ! command -v pkg-config &> /dev/null; then - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt-get update && sudo apt-get install -y pkg-config - elif [ "$RUNNER_OS" == "macOS" ]; then - brew install pkg-config - fi + # 1. Dynamically find the directory containing the .pc file (handles lib vs lib64) + PC_FILE=$(find $PWD/_dist -name "fortran_stdlib.pc" | head -n 1) + + if [ -z "$PC_FILE" ]; then + echo "Error: fortran_stdlib.pc was not found in the installation directory!" + exit 1 fi - # Point to the installation directory specified by CMAKE_INSTALL_PREFIX - export PKG_CONFIG_PATH="$PWD/_dist/lib/pkgconfig:$PWD/_dist/share/pkgconfig:$PKG_CONFIG_PATH" + PC_DIR=$(dirname "$PC_FILE") + export PKG_CONFIG_PATH="$PC_DIR:$PKG_CONFIG_PATH" + echo "Found pkg-config file in: $PC_DIR" - # Run the validation + # 2. Check if the module can be found and the syntax is valid pkg-config --validate fortran_stdlib - # Test flags to ensure no errors are thrown - pkg-config --cflags --libs fortran_stdlib \ No newline at end of file + # 3. Extract the paths that pkg-config generated + LIB_DIR=$(pkg-config --variable=libdir fortran_stdlib) + INC_DIR=$(pkg-config --variable=includedir fortran_stdlib) + + # 4. Verify the paths actually exist to catch double-prefixing + if [ ! -d "$LIB_DIR" ]; then + echo "Error: Library directory '$LIB_DIR' does not exist." + exit 1 + fi + + if [ ! -d "$INC_DIR" ]; then + echo "Error: Include directory '$INC_DIR' does not exist." + exit 1 + fi + + # 5. Print flags for debugging CI logs + echo "Resolved CFLAGS: $(pkg-config --cflags fortran_stdlib)" + echo "Resolved LIBS: $(pkg-config --libs fortran_stdlib)" \ No newline at end of file From 17c696a589a62f634853235640ae1d0d66f04197 Mon Sep 17 00:00:00 2001 From: srinjoy933 Date: Mon, 23 Mar 2026 16:43:07 +0530 Subject: [PATCH 3/4] ci: updated --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 271e209b5..9264cec33 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -115,7 +115,7 @@ jobs: run: cmake --install ${{ env.BUILD_DIR }} - name: Validate generated pkg-config file - if: ${{ contains(matrix.build, 'cmake') }} + if: ${{ matrix.build == 'cmake' }} shell: bash run: | # 1. Dynamically find the directory containing the .pc file (handles lib vs lib64) From 73eb5b60045d70dd5e671970e9417d382de40fbe Mon Sep 17 00:00:00 2001 From: srinjoy933 Date: Tue, 24 Mar 2026 23:10:14 +0530 Subject: [PATCH 4/4] updated --- .github/workflows/CI.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9264cec33..fb1bf81bd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,7 +5,6 @@ on: [push, pull_request] env: CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest - CTEST_PARALLEL_LEVEL: "2" CTEST_TIME_TIMEOUT: "5" # some failures hang forever HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: "ON" @@ -106,7 +105,6 @@ jobs: run: >- ctest --test-dir ${{ env.BUILD_DIR }} - --parallel --output-on-failure --no-tests=error