File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / how_to_convert_autotools_to_meson.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Tue Nov 10 19:32:35 2020 UTC (12 months, 3 weeks ago) by nia
Branches: MAIN
CVS tags: HEAD
say where to look for flags

    1: How to convert autotools to meson
    2: =================================
    3: 
    4: GNU's build system ("autotools", ./configure, etc) was previously the
    5: main one used by most of the open source world. However, lots of high
    6: profile projects (GNOME, etc) have been switching from it to a new
    7: python-based one, called meson.
    8: 
    9: Many things in pkgsrc have needed to be updated to use meson, so
   10: here's a guide on doing it properly.
   11: 
   12: Basics
   13: ------
   14: 
   15: You won't need the following, so delete them:
   16: 
   17: 	GNU_CONFIUGRE=	yes
   18: 	USE_LIBTOOL=	yes
   19: 
   20: Neither meson or cmake (another increasingly popular alternative) uses
   21: libtool to make shared libraries.
   22: 
   23: You will need the following:
   24: 
   25: 	.include "../../devel/meson/build.mk"
   26: 
   27: Tools
   28: -----
   29: 
   30: Only the following tools are generally needed:
   31: 
   32: 	USE_TOOLS+=	pkg-config msgfmt xgettext
   33: 
   34: Nearly every meson package needs pkg-config, since it's the main way it
   35: resolves dependencies. This also means that dependencies where the
   36: buildlink isn't included won't be detected.
   37: 
   38: meson does not use intltool or other gettext tools than xgettext
   39: and msgfmt. If your package uses `i18n.gettext` in a `meson.build` file
   40: it needs xgettext, and if it uses `i18n.merge_file` it needs msgfmt.
   41: It's easy to check this with grep.
   42: 
   43: Python
   44: ------
   45: 
   46: Every Meson project uses Python to build, but many don't install
   47: Python scripts and don't need it to run, so you should add the following:
   48: 
   49: 	PYTHON_FOR_BUILD_ONLY=	tool
   50: 
   51: If the build process needs a `python3`, `python2`, or `python` binary to
   52: execute scripts during the build, you should also include the following:
   53: 
   54: 	.include "../../lang/python/tool.mk"
   55: 
   56: This will automatically create a python executable with the appropriate
   57: suffix (or lack of suffix) for the duration of the build.
   58: 
   59: pkgconfig overrides
   60: -------------------
   61: 
   62: Libraries that use meson generally generate .pc files for use
   63: by pkg-config. This happens during the build, while previously
   64: they would have been pregenerated.
   65: 
   66: You should search for .pc files after the build is complete
   67: and set the appropriate flags:
   68: 
   69: 	PKGCONFIG_OVERRIDE_STAGE=	pre-install
   70: 	PKGCONFIG_OVERRIDE+=		output/meson-private/glesv2.pc
   71: 
   72: This is necessary so that pkgsrc sets the correct runtime
   73: path for libraries.
   74: 
   75: Remove any old references to nonexistent .pc files from the old
   76: build system in the PKGCONFIG_OVERRIDE.
   77: 
   78: gettext issues on NetBSD
   79: ------------------------
   80: 
   81: NetBSD includes an (old, pre-GPLv3?) version of msgfmt. This doesn't
   82: have the new --desktop or --xml flags, so you'll get a build error
   83: if a package attempts to use these.
   84: 
   85: There's an easy workaround:
   86: 
   87: 	.include "../../mk/bsd.prefs.mk"
   88: 
   89: 	# msgfmt: unknown option -- desktop
   90: 	.if ${OPSYS} == "NetBSD"
   91: 	TOOLS_PLATFORM.msgfmt=
   92: 	.endif
   93: 
   94: Flags
   95: -----
   96: 
   97: Flags of the following form:
   98: 
   99: 	CONFIGURE_ARGS+=	--enable-opengl
  100: 
  101: Generally now take the following form:
  102: 
  103: 	MESON_ARGS+=		-Dopengl=true
  104: 
  105: Check the `meson_options.txt` file.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb