From 31b80abcc6ccda2e94d8ffb3bf08582fc38a3f4c Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Mon, 8 Aug 2022 18:04:51 +0530 Subject: [PATCH] Add use-native build flag --- src/Streamly/Internal/System/Process.hs | 2 -- streamly-process.cabal | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Streamly/Internal/System/Process.hs b/src/Streamly/Internal/System/Process.hs index a923d44d..cc9ac8af 100644 --- a/src/Streamly/Internal/System/Process.hs +++ b/src/Streamly/Internal/System/Process.hs @@ -93,8 +93,6 @@ module Streamly.Internal.System.Process ) where --- #define USE_NATIVE - import Control.Exception (Exception(..), catch, throwIO) import Control.Monad (void, unless) import Control.Monad.Catch (MonadCatch, throwM) diff --git a/streamly-process.cabal b/streamly-process.cabal index e2c0c097..7c9ae4cf 100644 --- a/streamly-process.cabal +++ b/streamly-process.cabal @@ -48,6 +48,11 @@ flag use-gauge manual: True default: False +flag use-native + description: Do not depend on the process package + manual: True + default: False + common compile-options default-language: Haskell2010 ghc-options: @@ -70,6 +75,8 @@ common optimization-options -fdicts-strict -fspec-constr-recursive=16 -fmax-worker-args=16 + if flag(use-native) + cpp-options: -DUSE_NATIVE library import: compile-options, optimization-options @@ -78,18 +85,20 @@ library Streamly.System.Process Streamly.Internal.System.Process Streamly.Internal.System.Command - if !os(windows) + if flag (use-native) && !os(windows) exposed-modules: Streamly.Internal.System.Process.Posix build-depends: base >= 4.8 && < 5 , exceptions >= 0.8 && < 0.11 - , process >= 1.0 && < 1.7 -- Uses internal APIs , streamly == 0.9.0.* - if !os(windows) - build-depends: - unix >= 2.5 && < 2.8 + if !flag(use-native) + build-depends: process >= 1.0 && < 1.7 + else + if !os(windows) + build-depends: + unix >= 2.5 && < 2.8 ------------------------------------------------------------------------------- -- Benchmarks