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: gettext issues on NetBSD
44: ------------------------
45:
46: NetBSD includes an (old, pre-GPLv3?) version of msgfmt. This doesn't
47: have the new --desktop or --xml flags, so you'll get a build error
48: if a package attempts to use these.
49:
50: There's an easy workaround:
51:
52: .include "../../mk/bsd.prefs.mk"
53:
54: # msgfmt: unknown option -- desktop
55: .if ${OPSYS} == "NetBSD"
56: TOOLS_PLATFORM.msgfmt=
57: .endif
58:
59: Python
60: ------
61:
62: Every Meson project uses Python to build, but many don't install
63: Python scripts and don't need it to run, so you should add the following:
64:
65: PYTHON_FOR_BUILD_ONLY= tool
66:
67: If the build process needs a `python3`, `python2`, or `python` binary to
68: execute scripts during the build, you should also include the following:
69:
70: .include "../../lang/python/tool.mk"
71:
72: This will automatically create a python executable with the appropriate
73: suffix (or lack of suffix) for the duration of the build.
74:
75: Flags
76: -----
77:
78: Flags of the following form:
79:
80: CONFIGURE_ARGS+= --enable-opengl
81:
82: Generally now take the following form:
83:
84: MESON_ARGS+= -Dopengl=true
85:
86: pkgconfig overrides
87: -------------------
88:
89: Libraries that use meson generally generate .pc files for use
90: by pkg-config. This happens during the build, while previously
91: they would have been pregenerated.
92:
93: You should search for .pc files after the build is complete
94: and set the appropriate flags:
95:
96: PKGCONFIG_OVERRIDE_STAGE= pre-install
97: PKGCONFIG_OVERRIDE+= output/meson-private/glesv2.pc
98:
99: This is necessary so that pkgsrc sets the correct runtime
100: path for libraries.
101:
102: Remove any old references to nonexistent .pc files from the old
103: build system in the PKGCONFIG_OVERRIDE.
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb