diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml deleted file mode 100644 index 705288a..0000000 --- a/.github/workflows/haskell-ci.yml +++ /dev/null @@ -1,277 +0,0 @@ -# This GitHub workflow config has been generated by a script via -# -# haskell-ci 'github' 'cabal.project' -# -# To regenerate the script (for example after adjusting tested-with) run -# -# haskell-ci regenerate -# -# For more information, see https://github.com/haskell-CI/haskell-ci -# -# version: 0.19.20250605 -# -# REGENDATA ("0.19.20250605",["github","cabal.project"]) -# -name: Haskell-CI -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - linux: - name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-24.04 - timeout-minutes: - 60 - container: - image: buildpack-deps:jammy - services: - postgres: - image: postgres:14 - env: - POSTGRES_PASSWORD: postgres - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - continue-on-error: ${{ matrix.allow-failure }} - strategy: - matrix: - include: - - compiler: ghc-9.12.1 - compilerKind: ghc - compilerVersion: 9.12.1 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.10.1 - compilerKind: ghc - compilerVersion: 9.10.1 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.8.4 - compilerKind: ghc - compilerVersion: 9.8.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.6.6 - compilerKind: ghc - compilerVersion: 9.6.6 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.4.8 - compilerKind: ghc - compilerVersion: 9.4.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.2.8 - compilerKind: ghc - compilerVersion: 9.2.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.0.2 - compilerKind: ghc - compilerVersion: 9.0.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.10.7 - compilerKind: ghc - compilerVersion: 8.10.7 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.8.4 - compilerKind: ghc - compilerVersion: 8.8.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.6.5 - compilerKind: ghc - compilerVersion: 8.6.5 - setup-method: ghcup - allow-failure: false - fail-fast: false - steps: - - name: apt-get install - run: | - apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 - apt-get install -y libpq-dev - - name: Install GHCup - run: | - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - - name: Install cabal-install - run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - - name: Install GHC (GHCup) - if: matrix.setup-method == 'ghcup' - run: | - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: Set PATH and environment variables - run: | - echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> "$GITHUB_ENV" - echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" - echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" - echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" - echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" - echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: env - run: | - env - - name: write cabal config - run: | - mkdir -p $CABAL_DIR - cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz - echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan - rm -f cabal-plan.xz - chmod a+x $HOME/.cabal/bin/cabal-plan - cabal-plan --version - - name: checkout - uses: actions/checkout@v4 - with: - path: source - - name: initial cabal.project for sdist - run: | - touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/postgresql-libpq-pkgconfig" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/postgresql-libpq-configure" >> cabal.project - cat cabal.project - - name: sdist - run: | - mkdir -p sdist - $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist - - name: unpack - run: | - mkdir -p unpacked - find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; - - name: generate cabal.project - run: | - PKGDIR_postgresql_libpq="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-[0-9.]*')" - echo "PKGDIR_postgresql_libpq=${PKGDIR_postgresql_libpq}" >> "$GITHUB_ENV" - PKGDIR_postgresql_libpq_pkgconfig="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-pkgconfig-[0-9.]*')" - echo "PKGDIR_postgresql_libpq_pkgconfig=${PKGDIR_postgresql_libpq_pkgconfig}" >> "$GITHUB_ENV" - PKGDIR_postgresql_libpq_configure="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-configure-[0-9.]*')" - echo "PKGDIR_postgresql_libpq_configure=${PKGDIR_postgresql_libpq_configure}" >> "$GITHUB_ENV" - rm -f cabal.project cabal.project.local - touch cabal.project - touch cabal.project.local - echo "packages: ${PKGDIR_postgresql_libpq}" >> cabal.project - echo "packages: ${PKGDIR_postgresql_libpq_pkgconfig}" >> cabal.project - echo "packages: ${PKGDIR_postgresql_libpq_configure}" >> cabal.project - echo "package postgresql-libpq" >> cabal.project - echo " ghc-options: -Werror=missing-methods" >> cabal.project - echo "package postgresql-libpq-pkgconfig" >> cabal.project - echo " ghc-options: -Werror=missing-methods" >> cabal.project - echo "package postgresql-libpq-configure" >> cabal.project - echo " ghc-options: -Werror=missing-methods" >> cabal.project - cat >> cabal.project <> cabal.project.local - cat cabal.project - cat cabal.project.local - - name: dump install plan - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all - cabal-plan - - name: restore cache - uses: actions/cache/restore@v4 - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - - name: install dependencies - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all - - name: build w/o tests - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: build - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - - name: tests - run: | - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - - name: cabal check - run: | - cd ${PKGDIR_postgresql_libpq} || false - ${CABAL} -vnormal check - cd ${PKGDIR_postgresql_libpq_pkgconfig} || false - ${CABAL} -vnormal check - cd ${PKGDIR_postgresql_libpq_configure} || false - ${CABAL} -vnormal check - - name: haddock - run: | - $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - - name: unconstrained build - run: | - rm -f cabal.project.local - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: prepare for constraint sets - run: | - rm -f cabal.project.local - - name: constraint set pkg-config - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq +use-pkg-config' all --dry-run - cabal-plan topo | sort - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq +use-pkg-config' --dependencies-only -j2 all - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq +use-pkg-config' all - - name: save cache - if: always() - uses: actions/cache/save@v4 - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store diff --git a/.github/workflows/simple.yml b/.github/workflows/simple.yml index 99a2438..72c3fb3 100644 --- a/.github/workflows/simple.yml +++ b/.github/workflows/simple.yml @@ -15,7 +15,8 @@ jobs: matrix: os: [macos-latest, windows-latest] # Older GHCs need LLVM on macos-latest (ARM) - ghc: ['9.2','9.4.8','9.6.6','9.8.2','9.10.1'] + ghc: ['9.10.2'] + psql: ['16', '17'] fail-fast: false timeout-minutes: 60 @@ -33,17 +34,34 @@ jobs: cabal-version: '3.10.2.0' - name: Set up PostgreSQL - uses: ikalnytskyi/action-setup-postgres@v6 + uses: ikalnytskyi/action-setup-postgres@v7 id: postgres with: username: ci password: sw0rdfish database: test - postgres-version: "14" + postgres-version: ${{ matrix.psql }} + - name: Debug + shell: bash + run: | + ls c:/progra~1/postgr~1/ || true + ls c:/progra~1/postgr~1/16 || true + ls c:/progra~1/postgr~1/17 || true + ls c:/progra~1/postgr~1/16/lib || true + ls c:/progra~1/postgr~1/17/lib || true + - name: Checkout uses: actions/checkout@v4 + - name: More debug + run: + gcc -o smalltest -IC:/PROGRA~1/POSTGR~1/${{ matrix.psql }}/include -LC:/PROGRA~1/POSTGR~1/${{ matrix.psql }}/lib small.c -lpq + + - name: More debug + run: + C:\ghcup\ghc\910~1.2\lib/../mingw//bin\clang.exe -o smalltest -IC:/PROGRA~1/POSTGR~1/${{ matrix.psql }}/include -LC:/PROGRA~1/POSTGR~1/${{ matrix.psql }}/lib small.c -lpq + - name: Cache uses: actions/cache@v4 with: diff --git a/postgresql-libpq-configure/configure b/postgresql-libpq-configure/configure index fe392c1..8d9894f 100755 --- a/postgresql-libpq-configure/configure +++ b/postgresql-libpq-configure/configure @@ -1535,6 +1535,9 @@ case "(($ac_try" in esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 + echo "$ac_link" + echo "$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS" + (eval "$ac_link") || true (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3987,6 +3990,8 @@ then : break fi + $PG_CONFIG + found_postgresql="yes" break done diff --git a/postgresql-libpq-configure/m4/ax_lib_postgresql.m4 b/postgresql-libpq-configure/m4/ax_lib_postgresql.m4 index fea8da1..3272f5e 100644 --- a/postgresql-libpq-configure/m4/ax_lib_postgresql.m4 +++ b/postgresql-libpq-configure/m4/ax_lib_postgresql.m4 @@ -98,6 +98,8 @@ AC_DEFUN([_AX_LIB_POSTGRESQL_OLD],[ ]) AS_IF([test "X$found_postgresql_req_version" = "Xno"],[break]) + $PG_CONFIG + found_postgresql="yes" break done diff --git a/small.c b/small.c new file mode 100644 index 0000000..06bcbaa --- /dev/null +++ b/small.c @@ -0,0 +1,7 @@ +#include + +int main() { + char conninfo[]="dbname = postgres"; + PGconn *conn; + conn = PQconnectdb(conninfo); +}