From 8fa7cd67a88f870ccd68fe22004ee4b340e6fd0b Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 31 Dec 2024 16:10:09 +0100 Subject: [PATCH 1/3] Remove Setup.hs and switch to build-type: Simple --- HsOpenSSL.cabal | 13 ++--- Setup.hs | 136 ------------------------------------------------ 2 files changed, 5 insertions(+), 144 deletions(-) delete mode 100755 Setup.hs diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal index 0a2313e..aefa92e 100644 --- a/HsOpenSSL.cabal +++ b/HsOpenSSL.cabal @@ -10,7 +10,7 @@ Description: systems and stable. You may also be interested in the @tls@ package, , which is a pure Haskell implementation of SSL. -Version: 0.11.7.7 +Version: 0.11.7.9 License: PublicDomain License-File: COPYING Author: Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen @@ -33,11 +33,12 @@ Tested-With: || ==9.6.6 || ==9.8.1 || ==9.10.1 -Build-Type: Custom -Extra-Source-Files: +Build-Type: Simple +Extra-Doc-Files: AUTHORS ChangeLog README.md +Extra-Source-Files: cbits/HsOpenSSL.h cbits/mutex.h examples/Makefile @@ -50,7 +51,7 @@ Extra-Source-Files: Source-Repository head Type: git - Location: git://github.com/haskell-cryptography/HsOpenSSL.git + Location: https://github.com/haskell-cryptography/HsOpenSSL.git Flag fast-bignum Description: @@ -78,10 +79,6 @@ Flag use-pkg-config Manual: True -Custom-setup - setup-depends: Cabal >= 1.12 && < 4, - base >= 4.8 && < 5 - Library Build-Depends: base >= 4.8 && < 5, diff --git a/Setup.hs b/Setup.hs deleted file mode 100755 index b074354..0000000 --- a/Setup.hs +++ /dev/null @@ -1,136 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE TupleSections #-} - -#ifndef MIN_VERSION_Cabal --- MIN_VERSION_Cabal is defined and available to custom Setup.hs scripts --- if either GHC >= 8.0 or cabal-install >= 1.24 is used. --- So if it isn't defined, it's very likely we don't have Cabal >= 2.0. -#define MIN_VERSION_Cabal(x,y,z) 0 -#endif - -import Distribution.Simple -import Distribution.Simple.Setup (ConfigFlags(..), toFlag) -import Distribution.Simple.LocalBuildInfo (localPkgDescr) - -#if MIN_VERSION_Cabal(2,0,0) -import Distribution.PackageDescription (FlagName(..), mkFlagName) -#else -import Distribution.PackageDescription (FlagName(..)) -#endif - -#if MIN_VERSION_Cabal(2,1,0) -import Distribution.PackageDescription (mkFlagAssignment, unFlagAssignment) -#else -import Distribution.PackageDescription (FlagAssignment) -#endif - -import Distribution.Verbosity (silent) -import System.Info (os) -import qualified Control.Exception as E (tryJust, throw) -import System.IO.Error (isUserError) -import Control.Monad (forM) -import Data.List - -#if !(MIN_VERSION_Cabal(2,0,0)) -mkFlagName = FlagName -#endif - -#if !(MIN_VERSION_Cabal(2,1,0)) -mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment -mkFlagAssignment = id - -unFlagAssignment :: FlagAssignment -> [(FlagName, Bool)] -unFlagAssignment = id -#endif - --- On macOS we're checking whether OpenSSL library is avaiable --- and if not, we're trying to find Homebrew or MacPorts OpenSSL installations. --- --- Method is dumb -- set homebrew-openssl or macports-openssl flag and try --- to configure and check C libs. --- --- If no or multiple libraries are found we display error message --- with instructions. - -main - | os == "darwin" = - defaultMainWithHooks simpleUserHooks { confHook = conf } - | otherwise = - defaultMain - -flags = ["homebrew-openssl", "macports-openssl"] - -conf descr cfg = do - c <- tryConfig descr cfg - case c of - Right lbi -> return lbi -- library was found - Left e - | unFlagAssignment (configConfigurationsFlags cfg) - `intersect` [(mkFlagName f, True) | f <- flags] /= [] -> - E.throw e - -- flag was set but library still wasn't found - | otherwise -> do - r <- forM flags $ \ f -> - fmap (f,) $ tryConfig descr $ - setFlag (mkFlagName f) cfg { configVerbosity = toFlag silent } - -- TODO: configure is a long operation - -- while checkForeignDeps is fast. - -- Perhaps there is a way to configure once - -- and only apply flags to result and check. - -- However, additional `configure`s happen only on macOS - -- and only when library wasn't found. - case [(f,r) | (f, Right r) <- r] of - [(_,lbi)] -> - return lbi -- library was found - [] -> - fail notFound - fs -> - fail $ multipleFound fs - -notFound = unlines - [ "Can't find OpenSSL library." - , "Install it via 'brew install openssl' or 'port install openssl'." - , "" - , "If you already have OpenSSL installed, specify the location" - , "of the installed library in cabal.project:" - , "" - , "package HsOpenSSL" - , " extra-include-dirs: ..." - , " extra-lib-dirs: ..." - , "" - , "or use" - , "" - , "cabal configure --extra-include-dirs=... --extra-lib-dirs=..." - ] - -multipleFound fs = unlines - [ "Multiple OpenSSL libraries were found," - , "use " ++ intercalate " or " ["'-f " ++ f ++ "'" | (f,_) <- fs] - , "to specify location of installed OpenSSL library." - ] - -setFlag f c = c { configConfigurationsFlags = mkFlagAssignment - $ go - $ unFlagAssignment - $ configConfigurationsFlags c } - where go [] = [] - go (x@(n, _):xs) - | n == f = (f, True) : xs - | otherwise = x : go xs - -tryConfig descr flags = do - lbi <- confHook simpleUserHooks descr flags - -- confHook simpleUserHooks == Distribution.Simple.Configure.configure - - -- Testing whether C lib and header dependencies are working. - -- We check exceptions only here, to check C libs errors but not other - -- configuration problems like not resolved .cabal dependencies. - E.tryJust ue $ do - postConf simpleUserHooks [] flags (localPkgDescr lbi) lbi - -- postConf simpleUserHooks ~== - -- Distribution.Simple.Configure.checkForeignDeps - - return lbi - - where ue e | isUserError e = Just e - | otherwise = Nothing From 4658a571193cae5011becd773d5233780431f5ca Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 31 Dec 2024 16:10:32 +0100 Subject: [PATCH 2/3] CI: bump versions of checkout and cache actions --- .github/workflows/haskell.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 87e9c30..a85b3bd 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -52,7 +52,7 @@ jobs: # OpenSSL is installed in a non-standard location in MacOS. See # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-latest-Readme.md PKG_CONFIG_PATH: ${{ (matrix.os == 'macos-latest' && '/usr/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig') || (matrix.os == 'ubuntu-latest' && '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig') || '' }} - + # FIXME: this is arguably a bug, and pkg-config should return the right values! LD_LIBRARY_PATH: ${{ (matrix.os != 'windows-latest' && '/usr/local/lib') || '' }} @@ -75,7 +75,7 @@ jobs: automake ` libtool ` make - + # this seems to break something. It _must_ come after the pacman setup # above. It appears as if PATHEXT is set _after_ ghcup install ghc/cabal, and # as such we'd need pacman.exe instead. @@ -127,7 +127,7 @@ jobs: shell: bash run: echo '${{ steps.cabal-store.outputs.cabal-store }}' - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: "[PowerShell] Add build script path" if: runner.os == 'Windows' @@ -173,7 +173,7 @@ jobs: cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt - name: Cache Cabal store - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.cabal-store.outputs.cabal-store }} key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} From 9c35147a96de6cb28981a2065546197c374d682a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 31 Dec 2024 16:26:59 +0100 Subject: [PATCH 3/3] CI: include GHC 9.12.1; add old GHCs back for macos-13 --- .github/workflows/haskell.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index a85b3bd..7327c52 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -11,10 +11,6 @@ jobs: strategy: fail-fast: false matrix: - # Add more elements to this list to run multiple instances of the build in CI. Increasing the - # number instances is a good way to trigger flaky build failures - n: [1] - ghc: - "8.0.2" - "8.2.2" @@ -26,10 +22,11 @@ jobs: - "9.2.8" - "9.4.8" - "9.6.6" - - "9.8.2" + - "9.8.4" - "9.10.1" + - "9.12.1" # FIXME: Add windows-latest back to CI once it is passing. - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] # Action fails to install GHC < 8.10 on OSX with a generic error # messsage: @@ -40,14 +37,20 @@ jobs: # # Warning: Couldn't figure out LLVM version! # Make sure you have installed LLVM between [9 and 13) - exclude: - - {ghc: "8.0.2", os: "macos-latest"} - - {ghc: "8.2.2", os: "macos-latest"} - - {ghc: "8.4.4", os: "macos-latest"} - - {ghc: "8.6.5", os: "macos-latest"} - - {ghc: "8.8.4", os: "macos-latest"} - - {ghc: "8.10.7", os: "macos-latest"} - - {ghc: "9.0.2", os: "macos-latest"} + include: + - {ghc: "8.0.2" , os: "macos-13"} + - {ghc: "8.2.2" , os: "macos-13"} + - {ghc: "8.4.4" , os: "macos-13"} + - {ghc: "8.6.5" , os: "macos-13"} + - {ghc: "8.8.4" , os: "macos-13"} + - {ghc: "8.10.7", os: "macos-13"} + - {ghc: "9.0.2" , os: "macos-13"} + - {ghc: "9.2.8" , os: "macos-latest"} + - {ghc: "9.4.8" , os: "macos-latest"} + - {ghc: "9.6.6" , os: "macos-latest"} + - {ghc: "9.8.4" , os: "macos-latest"} + - {ghc: "9.10.1", os: "macos-latest"} + - {ghc: "9.12.1", os: "macos-latest"} env: # OpenSSL is installed in a non-standard location in MacOS. See # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-latest-Readme.md