diff --git a/ChangeLog.md b/ChangeLog.md
new file mode 100644
--- /dev/null
+++ b/ChangeLog.md
@@ -0,0 +1,3 @@
+### 5.0.0
+
++ Initial support of GtkSourceView 5.x for GTK 4.0
diff --git a/GtkSource.overrides b/GtkSource.overrides
new file mode 100644
--- /dev/null
+++ b/GtkSource.overrides
@@ -0,0 +1,16 @@
+namespace GtkSource
+set-attr GtkSource/Buffer/iter_backward_to_context_class_toggle/@parameters/iter transfer-ownership none
+set-attr GtkSource/Buffer/iter_backward_to_context_class_toggle/@parameters/iter direction inout
+set-attr GtkSource/Buffer/iter_backward_to_context_class_toggle/@parameters/iter caller-allocates 1
+
+set-attr GtkSource/Buffer/iter_forward_to_context_class_toggle/@parameters/iter transfer-ownership none
+set-attr GtkSource/Buffer/iter_forward_to_context_class_toggle/@parameters/iter direction inout
+set-attr GtkSource/Buffer/iter_forward_to_context_class_toggle/@parameters/iter caller-allocates 1
+
+set-attr GtkSource/Buffer/backward_iter_to_source_mark/@parameters/iter transfer-ownership none
+set-attr GtkSource/Buffer/backward_iter_to_source_mark/@parameters/iter caller-allocates 1
+set-attr GtkSource/Buffer/forward_iter_to_source_mark/@parameters/iter transfer-ownership none
+set-attr GtkSource/Buffer/forward_iter_to_source_mark/@parameters/iter caller-allocates 1
+
+set-attr GtkSource/Indenter/indent/@parameters/iter transfer-ownership none
+set-attr GtkSource/Indenter/indent/@parameters/iter caller-allocates 1
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,13 +1,13 @@
-The gi-gtksource3 library and included works are provided under the terms of the
+The gi-gtksource library and included works are provided under the terms of the
 GNU Library General Public License (LGPL) version 2.1 with the following
 exception:
 
-Static linking of applications or any other source to the gi-gtksource3 library
+Static linking of applications or any other source to the gi-gtksource library
 does not constitute a modified or derivative work and does not require
 the author(s) to provide source code for said work, to link against the
-shared gi-gtksource3 libraries, or to link their applications against a
-user-supplied version of gi-gtksource3. If you link applications to a modified
-version of gi-gtksource3, then the changes to gi-gtksource3 must be provided under the
+shared gi-gtksource libraries, or to link their applications against a
+user-supplied version of gi-gtksource. If you link applications to a modified
+version of gi-gtksource, then the changes to gi-gtksource must be provided under the
 terms of the LGPL.
 
 ----------------------------------------------------------------------------
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,2 +1,6 @@
-# Information
-This is a compatibility package. For newer projects we recommend that you use [gi-gtksource3](/package/gi-gtksource3) instead.
+# Documentation
+Autogenerated documentation for this package can be found at
+
+[https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource.html](https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource.html)
+
+For general documentation on using [haskell-gi](https://github.com/haskell-gi/haskell-gi) based bindings, see [the project page](https://github.com/haskell-gi/haskell-gi) or [the Wiki](https://github.com/haskell-gi/haskell-gi/wiki).
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,5 +1,23 @@
-import Data.GI.CodeGen.CabalHooks (setupCompatWrapper)
-import qualified GI.GtkSource.Config as Cfg
+{-# LANGUAGE OverloadedStrings #-}
 
+import Data.GI.CodeGen.CabalHooks (setupBinding, TaggedOverride(..))
+
+import qualified GI.GLib.Config as GLib
+import qualified GI.GObject.Config as GObject
+import qualified GI.Gdk.Config as Gdk
+import qualified GI.GdkPixbuf.Config as GdkPixbuf
+import qualified GI.Gio.Config as Gio
+import qualified GI.Gtk.Config as Gtk
+import qualified GI.Pango.Config as Pango
+
+
 main :: IO ()
-main = setupCompatWrapper "gi-gtksource3" Cfg.modules
+main = setupBinding name version pkgName pkgVersion verbose overridesFile inheritedOverrides outputDir
+  where name = "GtkSource"
+        version = "5"
+        pkgName = "gi-gtksource"
+        pkgVersion = "5.0.0"
+        overridesFile = Just "GtkSource.overrides"
+        verbose = False
+        outputDir = Nothing
+        inheritedOverrides = [TaggedOverride "inherited:GLib" GLib.overrides, TaggedOverride "inherited:GObject" GObject.overrides, TaggedOverride "inherited:Gdk" Gdk.overrides, TaggedOverride "inherited:GdkPixbuf" GdkPixbuf.overrides, TaggedOverride "inherited:Gio" Gio.overrides, TaggedOverride "inherited:Gtk" Gtk.overrides, TaggedOverride "inherited:Pango" Pango.overrides]
diff --git a/gi-gtksource.cabal b/gi-gtksource.cabal
--- a/gi-gtksource.cabal
+++ b/gi-gtksource.cabal
@@ -1,29 +1,180 @@
-name:           gi-gtksource
-version:        3.0.30
-synopsis:       GtkSource 3.x bindings (compatibility layer)
-description:    This package re-exports (for backward compatibility)
-                the haskell-gi generated bindings in the gi-gtksource3 package.
-homepage:       https://github.com/haskell-gi/haskell-gi
-license:        LGPL-2.1
-license-file:   LICENSE
-author:         Iñaki García Etxebarria
-maintainer:     Iñaki García Etxebarria
-category:       Bindings
-build-type:     Custom
-cabal-version:  2.0
+name:                 gi-gtksource
+version:              5.0.0
+synopsis:             GtkSource bindings
+description:          Bindings for GtkSource, autogenerated by haskell-gi.
+homepage:             https://github.com/haskell-gi/haskell-gi
+license:              LGPL-2.1
+license-file:         LICENSE
+author:               Iñaki García Etxebarria
+maintainer:           Iñaki García Etxebarria
+category:             Bindings
+build-type:           Custom
+cabal-version:        2.0
 
-extra-source-files: README.md
+extra-source-files: README.md ChangeLog.md stack.yaml GtkSource.overrides
 
 custom-setup
- setup-depends:
-   base >= 4.11 && <5,
-   haskell-gi ^>= 0.26.14,
-   gi-gtksource3 ^>= 3.0.30
+      setup-depends: base >= 4.11 && < 5,
+                     Cabal >= 1.24 && < 4,
+                     haskell-gi >= 0.26 && < 0.27,
+                     gi-cairo == 1.0.*,
+                     gi-pango == 1.0.*,
+                     gi-gtk == 4.0.*,
+                     gi-gio == 2.0.*,
+                     gi-gdkpixbuf == 2.0.*,
+                     gi-gdk == 4.0.*,
+                     gi-gobject == 2.0.*,
+                     gi-glib == 2.0.*,
+                     gi-atk == 2.0.*
 
 library
-    ghc-options: -Wall
+      default-language: Haskell2010
+      default-extensions: NoImplicitPrelude, ScopedTypeVariables, CPP, OverloadedStrings, NegativeLiterals, ConstraintKinds, TypeFamilies, MultiParamTypeClasses, KindSignatures, FlexibleInstances, UndecidableInstances, DataKinds, FlexibleContexts, UndecidableSuperClasses, TypeOperators
+      other-extensions: PatternSynonyms, ViewPatterns, TypeApplications
+      ghc-options: -fno-warn-unused-imports -fno-warn-warnings-deprecations
 
-    build-depends: base >= 4.11 && <5,
-                   gi-gtksource3 ^>= 3.0.30
+      pkgconfig-depends: gtksourceview-5
+      build-depends: base >= 4.9 && <5,
+                     haskell-gi-base >= 0.26 && < 0.27,
+                     haskell-gi >= 0.26 && < 0.27,
+                     haskell-gi-overloading < 1.1,
+                     gi-cairo == 1.0.*,
+                     gi-pango == 1.0.*,
+                     gi-gtk == 4.0.*,
+                     gi-gio == 2.0.*,
+                     gi-gdkpixbuf == 2.0.*,
+                     gi-gdk == 4.0.*,
+                     gi-gobject == 2.0.*,
+                     gi-glib == 2.0.*,
+                     gi-atk == 2.0.*,
+                     bytestring >= 0.10 && < 1,
+                     containers >= 0.5 && < 1,
+                     text >= 1.0 && < 3,
+                     transformers >= 0.4 && < 1
 
-    default-language: Haskell2010
+      -- Disable overloading when compiling under GHC 8.2.x
+      -- see https://ghc.haskell.org/trac/ghc/ticket/14382
+      if impl(ghc == 8.2.*)
+              build-depends: haskell-gi-overloading == 0.0
+
+      -- Note that the following list of exposed modules and autogen
+      -- modules is for documentation purposes only, so that some
+      -- documentation appears in hackage. The actual list of modules
+      -- to be built will be built at configure time, based on the
+      -- available introspection data.
+
+      exposed-modules: GI.GtkSource.Config,
+                       GI.GtkSource,
+                       GI.GtkSource.Callbacks,
+                       GI.GtkSource.Constants,
+                       GI.GtkSource.Enums,
+                       GI.GtkSource.Flags,
+                       GI.GtkSource.Functions,
+                       GI.GtkSource.Interfaces,
+                       GI.GtkSource.Interfaces.CompletionProposal,
+                       GI.GtkSource.Interfaces.CompletionProvider,
+                       GI.GtkSource.Interfaces.HoverProvider,
+                       GI.GtkSource.Interfaces.Indenter,
+                       GI.GtkSource.Interfaces.StyleSchemeChooser,
+                       GI.GtkSource.Objects,
+                       GI.GtkSource.Objects.Buffer,
+                       GI.GtkSource.Objects.Completion,
+                       GI.GtkSource.Objects.CompletionCell,
+                       GI.GtkSource.Objects.CompletionContext,
+                       GI.GtkSource.Objects.CompletionSnippets,
+                       GI.GtkSource.Objects.CompletionWords,
+                       GI.GtkSource.Objects.File,
+                       GI.GtkSource.Objects.FileLoader,
+                       GI.GtkSource.Objects.FileSaver,
+                       GI.GtkSource.Objects.Gutter,
+                       GI.GtkSource.Objects.GutterLines,
+                       GI.GtkSource.Objects.GutterRenderer,
+                       GI.GtkSource.Objects.GutterRendererPixbuf,
+                       GI.GtkSource.Objects.GutterRendererText,
+                       GI.GtkSource.Objects.Hover,
+                       GI.GtkSource.Objects.HoverContext,
+                       GI.GtkSource.Objects.HoverDisplay,
+                       GI.GtkSource.Objects.Language,
+                       GI.GtkSource.Objects.LanguageManager,
+                       GI.GtkSource.Objects.Map,
+                       GI.GtkSource.Objects.Mark,
+                       GI.GtkSource.Objects.MarkAttributes,
+                       GI.GtkSource.Objects.PrintCompositor,
+                       GI.GtkSource.Objects.Region,
+                       GI.GtkSource.Objects.SearchContext,
+                       GI.GtkSource.Objects.SearchSettings,
+                       GI.GtkSource.Objects.Snippet,
+                       GI.GtkSource.Objects.SnippetChunk,
+                       GI.GtkSource.Objects.SnippetContext,
+                       GI.GtkSource.Objects.SnippetManager,
+                       GI.GtkSource.Objects.SpaceDrawer,
+                       GI.GtkSource.Objects.Style,
+                       GI.GtkSource.Objects.StyleScheme,
+                       GI.GtkSource.Objects.StyleSchemeChooserButton,
+                       GI.GtkSource.Objects.StyleSchemeChooserWidget,
+                       GI.GtkSource.Objects.StyleSchemeManager,
+                       GI.GtkSource.Objects.StyleSchemePreview,
+                       GI.GtkSource.Objects.Tag,
+                       GI.GtkSource.Objects.View,
+                       GI.GtkSource.Objects.VimIMContext,
+                       GI.GtkSource.Structs,
+                       GI.GtkSource.Structs.Encoding,
+                       GI.GtkSource.Structs.RegionIter
+
+      autogen-modules: GI.GtkSource.Config,
+                       GI.GtkSource,
+                       GI.GtkSource.Callbacks,
+                       GI.GtkSource.Constants,
+                       GI.GtkSource.Enums,
+                       GI.GtkSource.Flags,
+                       GI.GtkSource.Functions,
+                       GI.GtkSource.Interfaces,
+                       GI.GtkSource.Interfaces.CompletionProposal,
+                       GI.GtkSource.Interfaces.CompletionProvider,
+                       GI.GtkSource.Interfaces.HoverProvider,
+                       GI.GtkSource.Interfaces.Indenter,
+                       GI.GtkSource.Interfaces.StyleSchemeChooser,
+                       GI.GtkSource.Objects,
+                       GI.GtkSource.Objects.Buffer,
+                       GI.GtkSource.Objects.Completion,
+                       GI.GtkSource.Objects.CompletionCell,
+                       GI.GtkSource.Objects.CompletionContext,
+                       GI.GtkSource.Objects.CompletionSnippets,
+                       GI.GtkSource.Objects.CompletionWords,
+                       GI.GtkSource.Objects.File,
+                       GI.GtkSource.Objects.FileLoader,
+                       GI.GtkSource.Objects.FileSaver,
+                       GI.GtkSource.Objects.Gutter,
+                       GI.GtkSource.Objects.GutterLines,
+                       GI.GtkSource.Objects.GutterRenderer,
+                       GI.GtkSource.Objects.GutterRendererPixbuf,
+                       GI.GtkSource.Objects.GutterRendererText,
+                       GI.GtkSource.Objects.Hover,
+                       GI.GtkSource.Objects.HoverContext,
+                       GI.GtkSource.Objects.HoverDisplay,
+                       GI.GtkSource.Objects.Language,
+                       GI.GtkSource.Objects.LanguageManager,
+                       GI.GtkSource.Objects.Map,
+                       GI.GtkSource.Objects.Mark,
+                       GI.GtkSource.Objects.MarkAttributes,
+                       GI.GtkSource.Objects.PrintCompositor,
+                       GI.GtkSource.Objects.Region,
+                       GI.GtkSource.Objects.SearchContext,
+                       GI.GtkSource.Objects.SearchSettings,
+                       GI.GtkSource.Objects.Snippet,
+                       GI.GtkSource.Objects.SnippetChunk,
+                       GI.GtkSource.Objects.SnippetContext,
+                       GI.GtkSource.Objects.SnippetManager,
+                       GI.GtkSource.Objects.SpaceDrawer,
+                       GI.GtkSource.Objects.Style,
+                       GI.GtkSource.Objects.StyleScheme,
+                       GI.GtkSource.Objects.StyleSchemeChooserButton,
+                       GI.GtkSource.Objects.StyleSchemeChooserWidget,
+                       GI.GtkSource.Objects.StyleSchemeManager,
+                       GI.GtkSource.Objects.StyleSchemePreview,
+                       GI.GtkSource.Objects.Tag,
+                       GI.GtkSource.Objects.View,
+                       GI.GtkSource.Objects.VimIMContext,
+                       GI.GtkSource.Structs,
+                       GI.GtkSource.Structs.Encoding,
+                       GI.GtkSource.Structs.RegionIter
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,3 @@
+packages:
+- '.'
+resolver: lts-13.7
