Skip to content

Commit 1cc2bcf

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

16 files changed

+225
-31
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ jobs:
233233
run: |
234234
rm -f cabal.project.local
235235
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
236+
- name: prepare for constraint sets
237+
run: |
238+
rm -f cabal.project.local
239+
- name: constraint set no-pkg-config
240+
run: |
241+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' all --dry-run
242+
cabal-plan topo | sort
243+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' --dependencies-only -j2 all
244+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='postgresql-libpq -use-pkg-config' all
236245
- name: save cache
237246
uses: actions/cache/save@v4
238247
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)