cabal-version: 3.0
name: jsaddle-wkwebview
version: 0.9.10.0
build-type: Simple
license: MIT
license-file: LICENSE
maintainer: Hamish Mackenzie <Hamish.K.Mackenzie@googlemail.com>
synopsis: Interface for JavaScript that works with GHCJS and GHC
description:
This package provides an EDSL for calling JavaScript that
can be used both from GHCJS and GHC. When using GHC
the application is run using Warp and WebSockets to
drive a small JavaScipt helper.
category: Web, Javascript
author: Hamish Mackenzie
tested-with: GHC==9.14.1, GHC==9.12.4, GHC==9.10.3, GHC==9.8.4, GHC==9.6.7
-- #included by cbits-cocoa/WKWebView-AppDelegate.m (the single Cocoa
-- translation unit) rather than compiled directly, so they must be
-- shipped explicitly. (WKWebView-callbacks.h is #included everywhere.)
extra-source-files:
cbits/WKWebView-cbits.m
cbits/WKWebView-callbacks.h
cbits-cocoa/AppDelegate.m
flag include-app-delegate
description: Include default AppDelegate C sources.
default: True
flag objc-in-library
description:
Compile the Objective-C into the Haskell library (the default).
Disable for GHCi sessions on toolchains where the RTS linker loads
this library's archive: Objective-C classes are only registered with
the runtime when their image is loaded by dyld, so such a session
must instead preload the ObjC compiled as a dylib (e.g.
cc -dynamiclib cbits-cocoa/WKWebView-AppDelegate.m -DUSE_COCOA
-Icbits ... and ghci -L<dir> -l<name>); the Haskell side then
reaches it through dyld, and it calls back in through the FunPtrs
registered by registerJSaddleCallbacks.
default: True
manual: True
source-repository head
type: git
location: https://github.com/ghcjs/jsaddle
library
exposed-modules:
Language.Javascript.JSaddle.WKWebView
build-depends:
base <5
default-language: Haskell2010
hs-source-dirs: src
ghc-options: -ferror-spans -Wall
-- Native builds need the Foundation/WebKit frameworks: macOS and iOS
-- only. (The ghcjs/javascript branch below builds anywhere.)
if !os(osx) && !os(ios) && !impl(ghcjs) && !arch(javascript)
buildable: False
if impl(ghcjs) || arch(javascript)
hs-source-dirs: src-ghcjs
else
frameworks: Foundation, WebKit
build-depends:
aeson >=0.8.0.2 && <2.4,
bytestring >=0.10.6.0 && <0.13,
directory,
jsaddle >= 0.9.10.0 && <0.10,
text,
data-default,
containers
exposed-modules:
Language.Javascript.JSaddle.WKWebView.Internal
hs-source-dirs: src-ghc
-- The cbits file is named -cbits so its object's archive-member
-- basename can't collide with the
-- Language.Javascript.JSaddle.WKWebView module object (Cabal
-- 3.12+ places Haskell and foreign objects in one object tree;
-- ar stores members by basename, and GHC 9.14's in-process TH
-- loader mis-resolves duplicate member names).
cc-options: -Wno-everything
if os(ios)
frameworks: UIKit, UserNotifications
if flag(include-app-delegate)
if flag(objc-in-library)
cxx-sources:
cbits/WKWebView-cbits.m
cbits-uikit/AppDelegate.m
cbits-uikit/ViewController.m
cpp-options: -DUSE_UIKIT
else
if flag(objc-in-library)
cxx-sources:
cbits/WKWebView-cbits.m
else
frameworks: Cocoa
if flag(include-app-delegate)
-- A SINGLE Objective-C translation unit (it #includes
-- WKWebView-cbits.m and AppDelegate.m): GHC's runtime
-- linker — used for TH under a statically linked GHC —
-- rejects the duplicate ObjC protocol metadata every ObjC
-- object emits, so the package's ObjC code must form one
-- archive member for dependents' TH splices to load it.
if flag(objc-in-library)
cxx-sources:
cbits-cocoa/WKWebView-AppDelegate.m
cpp-options: -DUSE_COCOA
else
if flag(objc-in-library)
cxx-sources:
cbits/WKWebView-cbits.m