Skip to content

Commit 43f7b1b

Browse files
committed
Use build-type: Simple when possible
1 parent e57f62d commit 43f7b1b

16 files changed

+244
-34
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This GitHub workflow config has been generated by a script via
22
#
3-
# haskell-ci 'github' 'postgresql-libpq.cabal'
3+
# haskell-ci 'github' 'cabal.project'
44
#
55
# To regenerate the script (for example after adjusting tested-with) run
66
#
@@ -10,7 +10,7 @@
1010
#
1111
# version: 0.19.20240708
1212
#
13-
# REGENDATA ("0.19.20240708",["github","postgresql-libpq.cabal"])
13+
# REGENDATA ("0.19.20240708",["github","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -175,6 +175,8 @@ jobs:
175175
run: |
176176
touch cabal.project
177177
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
178+
echo "packages: $GITHUB_WORKSPACE/source/postgresql-libpq-pkgconfig" >> cabal.project
179+
echo "packages: $GITHUB_WORKSPACE/source/postgresql-libpq-pgconfig" >> cabal.project
178180
cat cabal.project
179181
- name: sdist
180182
run: |
@@ -188,15 +190,25 @@ jobs:
188190
run: |
189191
PKGDIR_postgresql_libpq="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-[0-9.]*')"
190192
echo "PKGDIR_postgresql_libpq=${PKGDIR_postgresql_libpq}" >> "$GITHUB_ENV"
193+
PKGDIR_postgresql_libpq_pkgconfig="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-pkgconfig-[0-9.]*')"
194+
echo "PKGDIR_postgresql_libpq_pkgconfig=${PKGDIR_postgresql_libpq_pkgconfig}" >> "$GITHUB_ENV"
195+
PKGDIR_postgresql_libpq_pgconfig="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/postgresql-libpq-pgconfig-[0-9.]*')"
196+
echo "PKGDIR_postgresql_libpq_pgconfig=${PKGDIR_postgresql_libpq_pgconfig}" >> "$GITHUB_ENV"
191197
rm -f cabal.project cabal.project.local
192198
touch cabal.project
193199
touch cabal.project.local
194200
echo "packages: ${PKGDIR_postgresql_libpq}" >> cabal.project
201+
echo "packages: ${PKGDIR_postgresql_libpq_pkgconfig}" >> cabal.project
202+
echo "packages: ${PKGDIR_postgresql_libpq_pgconfig}" >> cabal.project
195203
echo "package postgresql-libpq" >> cabal.project
196204
echo " ghc-options: -Werror=missing-methods" >> cabal.project
205+
echo "package postgresql-libpq-pkgconfig" >> cabal.project
206+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
207+
echo "package postgresql-libpq-pgconfig" >> cabal.project
208+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
197209
cat >> cabal.project <<EOF
198210
EOF
199-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(postgresql-libpq)$/; }' >> cabal.project.local
211+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(postgresql-libpq|postgresql-libpq-pgconfig|postgresql-libpq-pkgconfig)$/; }' >> cabal.project.local
200212
cat cabal.project
201213
cat cabal.project.local
202214
- name: dump install plan
@@ -226,13 +238,26 @@ jobs:
226238
run: |
227239
cd ${PKGDIR_postgresql_libpq} || false
228240
${CABAL} -vnormal check
241+
cd ${PKGDIR_postgresql_libpq_pkgconfig} || false
242+
${CABAL} -vnormal check
243+
cd ${PKGDIR_postgresql_libpq_pgconfig} || false
244+
${CABAL} -vnormal check
229245
- name: haddock
230246
run: |
231247
$CABAL v2-haddock --disable-documentation $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
232248
- name: unconstrained build
233249
run: |
234250
rm -f cabal.project.local
235251
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
252+
- name: prepare for constraint sets
253+
run: |
254+
rm -f cabal.project.local
255+
- name: constraint set no-pkg-config
256+
run: |
257+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' all --dry-run
258+
cabal-plan topo | sort
259+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' --dependencies-only -j2 all
260+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' all
236261
- name: save cache
237262
uses: actions/cache/save@v4
238263
if: always()

.github/workflows/simple.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ jobs:
5050
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
5151
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
5252

53-
- name: cabal.project.local
53+
- name: cabal.project (win)
5454
if: matrix.os == 'windows-latest'
55-
run: cp cabal.project.local.win cabal.project.local
55+
run: cp cabal.project.win cabal.project
56+
57+
- name: cabal.project (macos)
58+
if: matrix.os == 'macos-latest'
59+
run: cp cabal.project.macos cabal.project
5660

5761
- name: ghc-pkg dump
5862
run: ghc-pkg list

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
0.10.2.0
2+
--------
3+
4+
- Change `use-pkg-config` default to `True`.
5+
Windows and macOS users may need to disable the flag if their
6+
libpq installation doesn't provide pkg-config database entry.
7+
- Split the c library dependency into separate
8+
packages, so in `pkg-config` scenario, all packages
9+
are `build-type: Simple`.
10+
111
0.10.1.0
212
--------
313

cabal.haskell-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ postgresql: True
44
-- due build-type: Custom
55
test-output-direct: False
66
haddock-components: libs
7+
8+
constraint-set no-pkg-config
9+
constraints: postgresql-libpq -use-pkg-config

cabal.project

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
packages: .
2+
packages: postgresql-libpq-pkgconfig
3+
packages: postgresql-libpq-pgconfig

cabal.project.local.win

Lines changed: 0 additions & 4 deletions
This file was deleted.

cabal.project.macos

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
packages: .
2+
packages: postgresql-libpq-pgconfig
3+
4+
constraints: unix installed
5+
6+
package postgresql-libpq
7+
flags: -use-pkg-config

cabal.project.win

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
packages: .
2+
packages: postgresql-libpq-pgconfig
3+
4+
constraints: Win32 installed
5+
6+
package postgresql-libpq
7+
flags: -use-pkg-config
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.10
2+
----
3+
4+
* Initial release0.10

postgresql-libpq-pgconfig/LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Copyright (c) 2010, Grant Monroe
2+
Copyright (c) 2011, Leon P Smith
3+
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* Neither the name of the authors nor the names of other
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File renamed without changes.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
cabal-version: 2.4
2+
name: postgresql-libpq-pgconfig
3+
version: 0.10
4+
synopsis: low-level binding to libpq: pg_config based provider
5+
description:
6+
This is a binding to libpq: the C application
7+
programmer's interface to PostgreSQL. libpq is a
8+
set of library functions that allow client
9+
programs to pass queries to the PostgreSQL
10+
backend server and to receive the results of
11+
these queries.
12+
13+
homepage: https://github.com/haskellari/postgresql-libpq
14+
bug-reports: https://github.com/haskellari/postgresql-libpq/issues
15+
license: BSD-3-Clause
16+
license-file: LICENSE
17+
author: Grant Monroe, Leon P Smith, Joey Adams
18+
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
19+
copyright: (c) 2024 Oleg Grenrus
20+
category: Database
21+
build-type: Custom
22+
tested-with:
23+
GHC ==8.6.5
24+
|| ==8.8.4
25+
|| ==8.10.7
26+
|| ==9.0.2
27+
|| ==9.2.8
28+
|| ==9.4.8
29+
|| ==9.6.5
30+
|| ==9.8.2
31+
|| ==9.10.1
32+
33+
extra-source-files: CHANGELOG.md
34+
35+
custom-setup
36+
setup-depends:
37+
, base >=4.12.0.0 && <5
38+
, Cabal >=2.4 && <3.13
39+
40+
library
41+
default-language: Haskell2010
42+
build-depends: base <5
43+
44+
if os(windows)
45+
-- Due to https://sourceware.org/bugzilla/show_bug.cgi?id=22948,
46+
-- if we specify pq instead of libpq, then ld might link against
47+
-- libpq.dll directly, which can lead to segfaults. As a temporary hack,
48+
-- we force ld to link against the libpq.lib import library directly
49+
-- by specifying libpq here.
50+
extra-libraries: libpq
51+
52+
else
53+
extra-libraries: pq
54+
55+
if os(openbsd)
56+
extra-libraries:
57+
crypto
58+
ssl
59+
60+
source-repository head
61+
type: git
62+
location: https://github.com/haskellari/postgresql-libpq
63+
subdir: postgresql-libpq-pgconfig
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.10
2+
----
3+
4+
* Initial release0.10

postgresql-libpq-pkgconfig/LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Copyright (c) 2010, Grant Monroe
2+
Copyright (c) 2011, Leon P Smith
3+
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* Neither the name of the authors nor the names of other
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cabal-version: 2.4
2+
name: postgresql-libpq-pkgconfig
3+
version: 0.10
4+
synopsis: low-level binding to libpq: pkg-config based provider
5+
description:
6+
This is a binding to libpq: the C application
7+
programmer's interface to PostgreSQL. libpq is a
8+
set of library functions that allow client
9+
programs to pass queries to the PostgreSQL
10+
backend server and to receive the results of
11+
these queries.
12+
13+
homepage: https://github.com/haskellari/postgresql-libpq
14+
bug-reports: https://github.com/haskellari/postgresql-libpq/issues
15+
license: BSD-3-Clause
16+
license-file: LICENSE
17+
author: Grant Monroe, Leon P Smith, Joey Adams
18+
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
19+
copyright: (c) 2024 Oleg Grenrus
20+
category: Database
21+
build-type: Simple
22+
tested-with:
23+
GHC ==8.6.5
24+
|| ==8.8.4
25+
|| ==8.10.7
26+
|| ==9.0.2
27+
|| ==9.2.8
28+
|| ==9.4.8
29+
|| ==9.6.5
30+
|| ==9.8.2
31+
|| ==9.10.1
32+
33+
extra-source-files: CHANGELOG.md
34+
35+
library
36+
default-language: Haskell2010
37+
build-depends: base <5
38+
pkgconfig-depends: libpq >=10.22
39+
40+
source-repository head
41+
type: git
42+
location: https://github.com/haskellari/postgresql-libpq
43+
subdir: postgresql-libpq-pkgconfig

postgresql-libpq.cabal

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: 2.4
22
name: postgresql-libpq
3-
version: 0.10.1.0
4-
x-revision: 1
3+
version: 0.10.2.0
54
synopsis: low-level binding to libpq
65
description:
76
This is a binding to libpq: the C application
@@ -22,7 +21,7 @@ copyright:
2221
(c) 2011 Leon P Smith
2322

2423
category: Database
25-
build-type: Custom
24+
build-type: Simple
2625
extra-source-files: cbits/hs-libpq.h
2726
tested-with:
2827
GHC ==8.6.5
@@ -37,15 +36,10 @@ tested-with:
3736

3837
extra-source-files: CHANGELOG.md
3938

40-
custom-setup
41-
setup-depends:
42-
, base >=4.12.0.0 && <5
43-
, Cabal >=2.4 && <3.13
44-
4539
-- If true, use pkg-config, otherwise use the pg_config based build
4640
-- configuration
4741
flag use-pkg-config
48-
default: False
42+
default: True
4943
manual: True
5044

5145
library
@@ -87,24 +81,10 @@ library
8781
build-depends: Win32 >=2.2.0.2 && <2.15
8882

8983
if flag(use-pkg-config)
90-
pkgconfig-depends: libpq >=10.22
84+
build-depends: postgresql-libpq-pkgconfig ^>=0.10
9185

9286
else
93-
if os(windows)
94-
-- Due to https://sourceware.org/bugzilla/show_bug.cgi?id=22948,
95-
-- if we specify pq instead of libpq, then ld might link against
96-
-- libpq.dll directly, which can lead to segfaults. As a temporary hack,
97-
-- we force ld to link against the libpq.lib import library directly
98-
-- by specifying libpq here.
99-
extra-libraries: libpq
100-
101-
else
102-
extra-libraries: pq
103-
104-
if os(openbsd)
105-
extra-libraries:
106-
crypto
107-
ssl
87+
build-depends: postgresql-libpq-pgconfig ^>=0.10
10888

10989
build-tool-depends: hsc2hs:hsc2hs >=0.68.5
11090

0 commit comments

Comments
 (0)