git.iko.soy/typeable/cabal2nix
on master help sign in
webkitgtk packages: Fix name mappings and simplify overrides

With a little careful remapping of names (and the removal of the obligation to include `gobjectIntrospection`) we can eliminate *all* overrides for packages using the current webkitgtk package, and use just a single hook overriding the webkit binding for packages using the older webkitgtk version.

commitddc9ac278c8fd26a12883ba301e0d3ff201ee71a authorMichael Alan Dorman <mdorman@ironicdesign.com> dateThu 9 Mar 2017, 07:56 (10 years ago) parent51161db
2 files changed+17−18
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs+8−4 src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+9−14
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs+8−4
@@ -141,10 +141,14 @@ libNixName "wayland-client" = return "wayland"
141141libNixName "wayland-cursor" = return "wayland"
142142libNixName "wayland-egl" = return "mesa"
143143libNixName "wayland-server" = return "wayland"
144−libNixName "webkit2gtk-4.0" = return "webkit2gtk"
145−libNixName "webkit2gtk-web-extension-4.0" = return "webkit2gtk-web-extension"
146−libNixName "webkitgtk" = return "webkit"
147−libNixName "webkitgtk-3.0" = return "webkit"
144+-- These are the old APIs, of which 2.4 is the last provider, so map directly to that
145+libNixName "javascriptcoregtk-3.0" = return "webkitgtk24x"
146+libNixName "webkitgtk-3.0" = return "webkitgtk24x"
147+-- This is the current API, so let it reference an alias for the latest version
148+libNixName "javascriptcoregtk-4.0" = return "webkitgtk"
149+libNixName "webkit2gtk-4.0" = return "webkitgtk"
150+-- This package doesn't actually exist in nixpkgs at present
151+libNixName "webkit2gtk-web-extension-4.0" = return "webkitgtk-web-extension"
148152libNixName "X11" = return "libX11"
149153libNixName "xau" = return "libXau"
150154libNixName "Xcursor" = return "libXcursor"
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs+9−14
@@ -56,16 +56,15 @@ hooks =
5656 , ("gi-gio", giPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
5757 , ("gi-glib", giPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
5858 , ("gi-gobject", giPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
59− , ("gi-gtk", giGtkPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
60− , ("gi-javascriptcore", giJavascriptCorePhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
6159 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
6260 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
6361 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
6462 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
63+ , ("gi-gtk", giGtkPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
64+ , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
6565 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
6666 , ("gi-pangocairo", giPangoCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
67− , ("gi-webkit2", giWebkit2PhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
68− , ("gi-webkit2webextension", giWebkit2PhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
67+ , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
6968 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
7069 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
7170 , ("git-annex", gitAnnexHook)
@@ -120,6 +119,8 @@ hooks =
120119 , ("thyme", set (libraryDepends . tool . contains (bind "self.cpphs")) True) -- required on Darwin
121120 , ("twilio", set doCheck False) -- attempts to access the network
122121 , ("tz", set phaseOverrides "preConfigure = \"export TZDIR=${pkgs.tzdata}/share/zoneinfo\";")
122+ , ("webkitgtk3", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
123+ , ("webkitgtk3-javascriptcore", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
123124 , ("websockets", set doCheck False) -- https://github.com/jaspervdj/websockets/issues/104
124125 , ("Win32", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Windows)))
125126 , ("Win32-shortcut", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Windows)))
@@ -294,11 +295,6 @@ giGtkPhaseOverrides :: Derivation -> Derivation
294295giGtkPhaseOverrides
295296 = set phaseOverrides ("preConfigure = ''" ++ exportGirSearchPath ["gtk3.dev"] ++ "'';")
296297
297−giJavascriptCorePhaseOverrides :: Derivation -> Derivation
298−giJavascriptCorePhaseOverrides
299− = set phaseOverrides ("preConfigure = ''" ++ exportGirSearchPath ["webkitgtk"] ++ "'';")
300− . set (libraryDepends . pkgconfig . contains (pkg "webkitgtk")) True
301−
302298giCairoPhaseOverrides :: Derivation -> Derivation
303299giCairoPhaseOverrides = over phaseOverrides (++'\n':txt)
304300 . set (libraryDepends . pkgconfig . contains (pkg "cairo")) True
@@ -325,11 +321,6 @@ giPangoCairoPhaseOverrides = set phaseOverrides txt
325321 , "'';"
326322 ]
327323
328−giWebkit2PhaseOverrides :: Derivation -> Derivation
329−giWebkit2PhaseOverrides
330− = set phaseOverrides ("preConfigure = ''" ++ exportGirSearchPath ["webkitgtk"] ++ "'';")
331− . set (libraryDepends . pkgconfig . contains (pkg "webkitgtk")) True
332−
333324hfseventsOverrides :: Derivation -> Derivation
334325hfseventsOverrides
335326 = set isLibrary True
@@ -337,3 +328,7 @@ hfseventsOverrides
337328 . set (libraryDepends . tool . contains (bind "pkgs.darwin.apple_sdk.frameworks.CoreServices")) True
338329 . set (libraryDepends . system . contains (bind "pkgs.darwin.apple_sdk.frameworks.Cocoa")) True
339330 . over (libraryDepends . haskell) (Set.union (Set.fromList (map bind ["self.base", "self.cereal", "self.mtl", "self.text", "self.bytestring"])))
331+
332+webkitgtk24xHook :: Derivation -> Derivation -- https://github.com/NixOS/cabal2nix/issues/145
333+webkitgtk24xHook = set (libraryDepends . pkgconfig . contains (pkg "webkitgtk24x")) True
334+ . over (libraryDepends . pkgconfig) (Set.filter (\b -> view localName b /= "webkitgtk24x"))