Skip to content

Commit

Permalink
Merge pull request #63 from haskellari/separate-packages
Browse files Browse the repository at this point in the history
Use build-type: Simple when possible
  • Loading branch information
phadej authored Aug 19, 2024
2 parents e57f62d + e76c7e1 commit fee482e
Show file tree
Hide file tree
Showing 23 changed files with 5,945 additions and 88 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This GitHub workflow config has been generated by a script via
#
# haskell-ci 'github' 'postgresql-libpq.cabal'
# haskell-ci 'github' 'cabal.project'
#
# To regenerate the script (for example after adjusting tested-with) run
#
Expand All @@ -10,7 +10,7 @@
#
# version: 0.19.20240708
#
# REGENDATA ("0.19.20240708",["github","postgresql-libpq.cabal"])
# REGENDATA ("0.19.20240708",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -175,6 +175,8 @@ jobs:
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: |
Expand All @@ -188,15 +190,25 @@ jobs:
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 <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(postgresql-libpq)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(postgresql-libpq|postgresql-libpq-configure|postgresql-libpq-pkgconfig)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
Expand Down Expand Up @@ -226,13 +238,26 @@ jobs:
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 $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
uses: actions/cache/save@v4
if: always()
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ jobs:
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-

- name: cabal.project.local
- name: cabal.project (win)
if: matrix.os == 'windows-latest'
run: cp cabal.project.local.win cabal.project.local
run: cp cabal.project.win cabal.project

- name: cabal.project (macos)
if: matrix.os == 'macos-latest'
run: cp cabal.project.macos cabal.project

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

- name: Dependencies
run: cabal build all --enable-tests --only-dependencies

- name: Build
run: cabal build all --enable-tests

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.10.2.0
--------

- Split the c library dependency into separate packages.
Now the dependencies are either all `build-type: Simple` (`-f +use-pkg-config`)
or `build-type: Configure` (`-f -use-pkg-config`).

0.10.1.0
--------

Expand Down
55 changes: 0 additions & 55 deletions Setup.hs

This file was deleted.

3 changes: 3 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ postgresql: True
-- due build-type: Custom
test-output-direct: False
haddock-components: libs

constraint-set pkg-config
constraints: postgresql-libpq +use-pkg-config
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
packages: .
packages: postgresql-libpq-pkgconfig
packages: postgresql-libpq-configure
4 changes: 0 additions & 4 deletions cabal.project.local.win

This file was deleted.

7 changes: 7 additions & 0 deletions cabal.project.macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
packages: .
packages: postgresql-libpq-configure

constraints: unix installed

package postgresql-libpq
flags: -use-pkg-config
7 changes: 7 additions & 0 deletions cabal.project.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
packages: .
packages: postgresql-libpq-configure

constraints: Win32 installed

package postgresql-libpq
flags: -use-pkg-config
5 changes: 5 additions & 0 deletions postgresql-libpq-configure/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
postgresql-libpq-configure.buildinfo
config.log
config.status
aclocal.m4
autom4te.cache/
4 changes: 4 additions & 0 deletions postgresql-libpq-configure/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0.10
----

* Initial release0.10
31 changes: 31 additions & 0 deletions postgresql-libpq-configure/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Copyright (c) 2010, Grant Monroe
Copyright (c) 2011, Leon P Smith

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of the authors nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 6 additions & 0 deletions postgresql-libpq-configure/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Main (main) where

import Distribution.Simple (defaultMainWithHooks, autoconfUserHooks)

main :: IO ()
main = defaultMainWithHooks autoconfUserHooks
Loading

0 comments on commit fee482e

Please sign in to comment.