--- /dev/null
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=meson
+PKG_VERSION:=0.52.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION)/
+PKG_HASH:=d60f75f0dedcc4fd249dbc7519d6f3ce6df490033d276ef1cf27453ef4938d32
+
+PKG_MAINTAINER:=Andre Heider <a.heider@gmail.com>
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=COPYING
+
+HOST_BUILD_DEPENDS:=ninja/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/python/python3-package.mk
+
+define Host/Configure
+endef
+
+define Host/Compile
+endef
+
+define Host/Install
+ $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/meson
+ $(CP) $(HOST_BUILD_DIR)/* $(STAGING_DIR_HOSTPKG)/lib/meson/
+endef
+
+define Host/Clean
+ $(call Host/Clean/Default)
+ rm -rf $(STAGING_DIR_HOSTPKG)/lib/meson
+endef
+
+define Package/meson
+ SECTION:=devel
+ CATEGORY:=Development
+ TITLE:=meson
+ URL:=https://mesonbuild.com/
+ DEPENDS:=+ninja +python3-pkg-resources
+ VARIANT:=python3
+endef
+
+define Package/meson/description
+ Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible.
+endef
+
+define Package/meson/install
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call Py3Package,meson))
+$(eval $(call BuildPackage,meson))
+$(eval $(call BuildPackage,meson-src))
--- /dev/null
+# To build your package using meson:
+#
+# PKG_BUILD_DEPENDS:=meson/host
+# include ../../devel/meson/meson.mk
+# MESON_ARGS+=-Dfoo -Dbar=baz
+#
+# To pass additional environment variables to meson:
+#
+# MESON_VARS+=FOO=bar
+#
+# Default configure/compile/install targets are provided, but can be
+# overwritten if required:
+#
+# define Build/Configure
+# $(call Build/Configure/Meson)
+# ...
+# endef
+#
+# same for Build/Compile and Build/Install
+#
+# Host packages are built in the same fashion, just use these vars instead:
+#
+# HOST_BUILD_DEPENDS:=meson/host
+# MESON_HOST_ARGS+=-Dfoo -Dbar=baz
+# MESON_HOST_VARS+=FOO=bar
+
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../devel/ninja/ninja.mk
+
+MESON_DIR:=$(STAGING_DIR_HOSTPKG)/lib/meson
+
+MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/openwrt-build
+MESON_HOST_VARS:=
+MESON_HOST_ARGS:=
+
+MESON_BUILD_DIR:=$(PKG_BUILD_DIR)/openwrt-build
+MESON_VARS:=
+MESON_ARGS:=
+
+define Meson
+ $(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1)
+endef
+
+define Meson/CreateNativeFile
+ $(STAGING_DIR_HOST)/bin/sed \
+ -e "s|@CC@|$(HOSTCC)|" \
+ -e "s|@CXX@|$(HOSTCXX)|" \
+ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
+ -e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
+ -e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
+ -e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
+ -e "s|@PREFIX@|$(STAGING_DIR_HOSTPKG)|" \
+ < $(MESON_DIR)/openwrt-native.txt.in \
+ > $(1)
+endef
+
+define Meson/CreateCrossFile
+ $(STAGING_DIR_HOST)/bin/sed \
+ -e "s|@CC@|$(TARGET_CC)|" \
+ -e "s|@CXX@|$(TARGET_CXX)|" \
+ -e "s|@AR@|$(TARGET_AR)|" \
+ -e "s|@STRIP@|$(TARGET_CROSS)strip|" \
+ -e "s|@NM@|$(TARGET_NM)|" \
+ -e "s|@LD@|$(TARGET_CROSS)ld|" \
+ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
+ -e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
+ -e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
+ -e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
+ -e "s|@ARCH@|$(ARCH)|" \
+ -e "s|@CPU@|$(CONFIG_TARGET_SUBTARGET)|" \
+ -e "s|@ENDIAN@|$(if $(CONFIG_BIG_ENDIAN),big,little)|" \
+ < $(MESON_DIR)/openwrt-cross.txt.in \
+ > $(1)
+endef
+
+define Host/Configure/Meson
+ $(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt)
+ $(call Meson, \
+ --native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
+ $(MESON_HOST_ARGS) \
+ $(MESON_HOST_BUILD_DIR) \
+ $(HOST_BUILD_DIR), \
+ $(MESON_HOST_VARS))
+endef
+
+define Host/Compile/Meson
+ $(call Ninja,-C $(MESON_HOST_BUILD_DIR),)
+endef
+
+define Host/Install/Meson
+ $(call Ninja,-C $(MESON_HOST_BUILD_DIR) install,)
+endef
+
+define Host/Uninstall/Meson
+ -$(call Ninja,-C $(MESON_HOST_BUILD_DIR) uninstall,)
+endef
+
+define Build/Configure/Meson
+ $(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt)
+ $(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
+ $(call Meson, \
+ --buildtype plain \
+ --native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
+ --cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
+ $(MESON_ARGS) \
+ $(MESON_BUILD_DIR) \
+ $(PKG_BUILD_DIR), \
+ $(MESON_VARS))
+endef
+
+define Build/Compile/Meson
+ $(call Ninja,-C $(MESON_BUILD_DIR),)
+endef
+
+define Build/Install/Meson
+ $(call Ninja,-C $(MESON_BUILD_DIR) install,DESTDIR="$(PKG_INSTALL_DIR)")
+endef
+
+Host/Configure=$(call Host/Configure/Meson)
+Host/Compile=$(call Host/Compile/Meson)
+Host/Install=$(call Host/Install/Meson)
+Host/Uninstall=$(call Host/Uninstall/Meson)
+Build/Configure=$(call Build/Configure/Meson)
+Build/Compile=$(call Build/Compile/Meson)
+Build/Install=$(call Build/Install/Meson)