diff --git a/Makefile b/Makefile
index 1cc945bb..31a00d3f 100644
--- a/Makefile
+++ b/Makefile
@@ -5,3 +5,16 @@ build:
 
 html: build
 	make -C docs html
+
+meson:
+	rm builddir -rf
+	meson setup builddir
+	cd builddir && meson compile
+
+meson_build:
+	python -m build
+
+meson_install:
+	python -m venv venv
+	./venv/bin/pip install -U pip
+	./venv/bin/pip install build
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..032749dd
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,65 @@
+project('pygit2', 'c', version: '1.13.2')
+
+py = import('python').find_installation(pure: false)
+
+#includes = include_directories('src')
+
+# If some files (such as .py files) need to be copied to site-packages,
+# this is where they get specified. Files get copied to
+# <python directory>/site-packages/<subdir>
+sources = [
+  'pygit2/__init__.py',
+  'pygit2/_build.py',
+  'pygit2/_run.py',
+  'pygit2/blame.py',
+  'pygit2/blob.py',
+  'pygit2/callbacks.py',
+  'pygit2/config.py',
+  'pygit2/credentials.py',
+  'pygit2/errors.py',
+  'pygit2/ffi.py',
+  'pygit2/filter.py',
+  'pygit2/index.py',
+  'pygit2/packbuilder.py',
+  'pygit2/refspec.py',
+  'pygit2/remote.py',
+  'pygit2/repository.py',
+  'pygit2/settings.py',
+  'pygit2/submodule.py',
+  'pygit2/utils.py',
+]
+py.install_sources(sources, subdir: 'pygit2', pure: false)
+
+sources = [
+  'src/blob.c',
+  'src/branch.c',
+  'src/commit.c',
+  'src/diff.c',
+  'src/error.c',
+  'src/filter.c',
+  'src/mailmap.c',
+  'src/note.c',
+  'src/object.c',
+  'src/odb_backend.c',
+  'src/odb.c',
+  'src/oid.c',
+  'src/options.c',
+  'src/patch.c',
+  'src/pygit2.c',
+  'src/refdb_backend.c',
+  'src/refdb.c',
+  'src/reference.c',
+  'src/repository.c',
+  'src/revspec.c',
+  'src/signature.c',
+  'src/stash.c',
+  'src/tag.c',
+  'src/treebuilder.c',
+  'src/tree.c',
+  'src/utils.c',
+  'src/walker.c',
+  'src/wildmatch.c',
+  'src/worktree.c',
+]
+
+py.extension_module('_pygit2', sources, install: true)
diff --git a/pyproject.toml b/pyproject.toml
index 37457308..81fa86dd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,36 @@
 [build-system]
-requires = ["setuptools", "wheel"]
+build-backend = 'mesonpy'
+requires = ['meson-python']
+
+[project]
+name = 'pygit2'
+version = '1.13.3'
+description = 'Python bindings for libgit2.'
+classifiers = [
+    'Development Status :: 5 - Production/Stable',
+    'Intended Audience :: Developers',
+    'Programming Language :: Python',
+    'Programming Language :: Python :: 3',
+    'Programming Language :: Python :: 3.9',
+    'Programming Language :: Python :: 3.10',
+    'Programming Language :: Python :: 3.11',
+    'Programming Language :: Python :: 3.12',
+    'Programming Language :: Python :: Implementation :: PyPy',
+    'Programming Language :: Python :: Implementation :: CPython',
+    'Topic :: Software Development :: Version Control',
+]
+dependencies = ['cffi>=1.16.0']
+keywords = ['git']
+license = {text = 'GPLv2 with linking exception'}
+maintainers = [{name = 'J. David Ibáñez', email = 'jdavid.ibp@gmail.com'}]
+readme = 'README.rst'
+requires-python = '>=3.9'
+
+[project.urls]
+Homepage = 'https://github.com/libgit2/pygit2'
+Documentation = 'https://www.pygit2.org/'
+Changelog = 'https://github.com/libgit2/pygit2/blob/master/CHANGELOG.rst'
+Funding = 'https://github.com/sponsors/jdavid'
 
 [tool.cibuildwheel]
 enable = ["pypy"]
diff --git a/src/repository.h b/src/repository.h
old mode 100755
new mode 100644