diff mbox series

[bug#38423,09/49] gnu: Add ghc-wai-cors.

Message ID 20191129113751.82405-9-rob@vllmrt.net
State Accepted
Headers show
Series [bug#38423,01/49] gnu: Add ghc-text-printer. | expand

Commit Message

Robert Vollmert Nov. 29, 2019, 11:37 a.m. UTC
* gnu/packages/haskell-web.scm (ghc-wai-cors): New package.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/haskell-web.scm                  | 42 +++++++++++++++++++
 .../ghc-wai-cors-skip-phantomjs-tests.patch   | 13 ++++++
 3 files changed, 56 insertions(+)
 create mode 100644 gnu/packages/patches/ghc-wai-cors-skip-phantomjs-tests.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e49029a379..56ff1d0f7b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -889,6 +889,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/ghc-monad-par-fix-tests.patch		\
   %D%/packages/patches/ghc-pandoc-fix-html-tests.patch		\
   %D%/packages/patches/ghc-pandoc-fix-latex-test.patch		\
+  %D%/packages/patches/ghc-wai-cors-skip-phantomjs-tests.patch	\
   %D%/packages/patches/ghostscript-no-header-id.patch		\
   %D%/packages/patches/ghostscript-no-header-uuid.patch		\
   %D%/packages/patches/ghostscript-no-header-creationdate.patch \
diff --git a/gnu/packages/haskell-web.scm b/gnu/packages/haskell-web.scm
index e337d33e18..7f54568399 100644
--- a/gnu/packages/haskell-web.scm
+++ b/gnu/packages/haskell-web.scm
@@ -1599,3 +1599,45 @@  requirements of downstream users (e.g. Debian).")
     (description
      "Provide a bridge between WAI and the websockets package.")
     (license license:expat)))
+
+(define-public ghc-wai-cors
+  (package
+    (name "ghc-wai-cors")
+    (version "0.2.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://hackage.haskell.org/package/wai-cors/wai-cors-"
+             version
+             ".tar.gz"))
+       (sha256
+        (base32
+         "11m9d8hn9pb9brprz0kglldmcqj83kjkjdwdpxdbl12430ii1ina"))
+       (patches (search-patches "ghc-wai-cors-skip-phantomjs-tests.patch"))))
+    (build-system haskell-build-system)
+    (arguments
+     ;; required for unclear reasons; those flags should default to false
+     `(#:configure-flags '("--flags=-wai-2" "--flags=-wai-1")))
+    (inputs
+     `(("ghc-attoparsec" ,ghc-attoparsec)
+       ("ghc-base-unicode-symbols"
+        ,ghc-base-unicode-symbols)
+       ("ghc-case-insensitive" ,ghc-case-insensitive)
+       ("ghc-http-types" ,ghc-http-types)
+       ("ghc-wai" ,ghc-wai)))
+    (native-inputs
+     `(("ghc-tasty" ,ghc-tasty)
+       ("ghc-tasty-hunit" ,ghc-tasty-hunit)
+       ("ghc-transformers-compat" ,ghc-transformers-compat)
+       ("ghc-wai-extra" ,ghc-wai-extra)
+       ("ghc-wai-websockets" ,ghc-wai-websockets)
+       ("ghc-warp" ,ghc-warp)
+       ("ghc-websockets" ,ghc-websockets)))
+    (home-page
+     "https://github.com/larskuhtz/wai-cors")
+    (synopsis "CORS for WAI")
+    (description
+     "This package provides an implemenation of Cross-Origin resource sharing
+(CORS) for Wai that aims to be compliant with http://www.w3.org/TR/cors.")
+    (license license:expat)))
diff --git a/gnu/packages/patches/ghc-wai-cors-skip-phantomjs-tests.patch b/gnu/packages/patches/ghc-wai-cors-skip-phantomjs-tests.patch
new file mode 100644
index 0000000000..ffb1929a03
--- /dev/null
+++ b/gnu/packages/patches/ghc-wai-cors-skip-phantomjs-tests.patch
@@ -0,0 +1,13 @@ 
+Skip phantomjs tests.
+
+--- a/wai-cors.cabal	2017-12-02 19:58:59.000000000 +0100
++++ b/wai-cors.cabal	2019-06-03 22:02:32.792000000 +0200
+@@ -102,6 +102,8 @@
+     ghc-options: -Wall
+ 
+ Test-Suite phantomjs
++    buildable: False
++
+     type: exitcode-stdio-1.0
+     default-language: Haskell2010
+     main-is: PhantomJS.hs