package/linux-tools/linux-tool-perf.mk.in: fix doc build issue
PATCH v2 1/1 package/linux-tools/linux-tool-perf.mk.in: fix doc build issue
Address potential document build issue when BR2_PER_PACKAGE_DIRECTORIES is enabled.
The perf package wants to prevent the documentation from being built, since it won't be installed anyway. The trick is to create an empty GNUmakefile in the proper place. It did this by using a POST_PATCH hook.
The reason this approach works when BR2_PER_PACKAGE_DIRECTORIES is off is that the build system ensures only one package builds at a time, so Linux's "extract" stage and Linux Tool's "patch" stage can never execute in parallel.
However, with per-package builds enabled, there is no guarantee that Linux has finished extracting by the time the linux-tool's POST_PATCH hook runs. This means the creation of GNUmakefile could silently be skipped if that portion of the source code hadn't been extracted yet. If, in addition to this, asciidoc happened to be installed on the build host (/usr/bin/asciidoc), perf would detect this and enable the doc build stage. At actual build time, it would use host-python3 (not the host's system Python), which does NOT have asciidoc, and the build would fail.
INSTALL libperf_headers
SYSHDR /local/users/jenkins/workspace/[...]/libperf/arch/[...]/unistd_64.h INSTALL libbpf_headers
fatal: not a git repository: '.'
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-amd-ibs.xml
fatal: not a git repository: '.'
[...]
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-data.xml
/local/users/jenkins/workspace/buildroot/[...]/host/bin/python3:
No module named asciidoc
make[5]: *** [Makefile:275: [...]/perf-data.xml] Error 1
Turning the POST_PATCH hook into a PRE_CONFIGURE hook solves this timing problem and guarantees that the "fake" GNUmakefile can be injected into $(LINUX_DIR)/tools/perf/Documentation as intended.
--- package/linux-tools/linux-tool-perf.mk.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
The primary reason for v2 is the updated email address. While I was at it, I made the comment a little clearer. The actual code change is identical to before.
https://lists.buildroot.org/pipermail/buildroot/2026-September/810498.html
package/linux-tools/linux-tool-perf.mk.in +6 -1
@@ -141,12 +141,17 @@ endif # distributions. # We name it 'GNUmakefile' so that GNU make will use it instead of # the existing 'Makefile'. +# +# This must be a PRE_CONFIGURE hook, not a POST_PATCH hook. Only the +# configure step is ordered after "linux" (via LINUX_TOOLS_DEPENDENCIES). +# For a POST_PATCH hook, tools/perf/Documentation/Makefile is not +# guaranteed to exist yet. define PERF_DISABLE_DOCUMENTATION if [ -f $(LINUX_DIR)/tools/perf/Documentation/Makefile ]; then \ printf "%%:\n\t@:\n" >$(LINUX_DIR)/tools/perf/Documentation/GNUmakefile; \ fi endef -LINUX_TOOLS_POST_PATCH_HOOKS += PERF_DISABLE_DOCUMENTATION +LINUX_TOOLS_PRE_CONFIGURE_HOOKS += PERF_DISABLE_DOCUMENTATION # O must be redefined here to overwrite the one used by Buildroot for # out of tree build. We build perf in $(LINUX_DIR)/tools/perf/ and not just
Signature · 6 lines
2.55.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 34 lines · Markus Mayer via buildroot
Address potential document build issue when
BR2_PER_PACKAGE_DIRECTORIESis enabled.The perf package wants to prevent the documentation from being built, since it won't be installed anyway. The trick is to create an empty GNUmakefile in the proper place. It did this by using a
POST_PATCHhook.The reason this approach works when
BR2_PER_PACKAGE_DIRECTORIESis off is that the build system ensures only one package builds at a time, so Linux's "extract" stage and Linux Tool's "patch" stage can never execute in parallel.However, with per-package builds enabled, there is no guarantee that Linux has finished extracting by the time the linux-tool's
POST_PATCHhook runs. This means the creation of GNUmakefile could silently be skipped if that portion of the source code hadn't been extracted yet. If, in addition to this, asciidoc happened to be installed on the build host (/usr/bin/asciidoc), perf would detect this and enable the doc build stage. At actual build time, it would use host-python3 (not the host's system Python), which does NOT have asciidoc, and the build would fail.INSTALL libperf_headers SYSHDR /local/users/jenkins/workspace/[...]/libperf/arch/[...]/unistd_64.h INSTALL libbpf_headersfatal: not a git repository: '.'
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-amd-ibs.xml
fatal: not a git repository: '.'
[...]
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-data.xml
/local/users/jenkins/workspace/buildroot/[...]/host/bin/python3:
No module named asciidoc
make[5]: *** [Makefile:275: [...]/perf-data.xml] Error 1
Quoted 5 lines
Turning the
POST_PATCHhook into aPRE_CONFIGUREhook solves this timing problem and guarantees that the "fake" GNUmakefile can be injected into $(LINUX_DIR)/tools/perf/Documentation as intended.Signed-off-by Markus Mayer <[email protected]>
Signature · 6 lines
Florian _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 34 lines · Markus Mayer via buildroot
Address potential document build issue when
BR2_PER_PACKAGE_DIRECTORIESis enabled.The perf package wants to prevent the documentation from being built, since it won't be installed anyway. The trick is to create an empty GNUmakefile in the proper place. It did this by using a
POST_PATCHhook.The reason this approach works when
BR2_PER_PACKAGE_DIRECTORIESis off is that the build system ensures only one package builds at a time, so Linux's "extract" stage and Linux Tool's "patch" stage can never execute in parallel.However, with per-package builds enabled, there is no guarantee that Linux has finished extracting by the time the linux-tool's
POST_PATCHhook runs. This means the creation of GNUmakefile could silently be skipped if that portion of the source code hadn't been extracted yet. If, in addition to this, asciidoc happened to be installed on the build host (/usr/bin/asciidoc), perf would detect this and enable the doc build stage. At actual build time, it would use host-python3 (not the host's system Python), which does NOT have asciidoc, and the build would fail.INSTALL
libperf_headers
SYSHDR /local/users/jenkins/workspace/[...]/libperf/arch/[...]/unistd_64.h INSTALLlibbpf_headers
fatal: not a git repository: '.'
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-amd-ibs.xml
fatal: not a git repository: '.'
[...]
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-data.xml
/local/users/jenkins/workspace/buildroot/[...]/host/bin/python3:
No module named asciidoc
make[5]: *** [Makefile:275: [...]/perf-data.xml] Error 1
Quoted 5 lines
Turning the
POST_PATCHhook into aPRE_CONFIGUREhook solves this timing problem and guarantees that the "fake" GNUmakefile can be injected into $(LINUX_DIR)/tools/perf/Documentation as intended.Signed-off-by Markus Mayer <[email protected]>
Applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 34 lines
Address potential document build issue when
BR2_PER_PACKAGE_DIRECTORIESis enabled.The perf package wants to prevent the documentation from being built, since it won't be installed anyway. The trick is to create an empty GNUmakefile in the proper place. It did this by using a
POST_PATCHhook.The reason this approach works when
BR2_PER_PACKAGE_DIRECTORIESis off is that the build system ensures only one package builds at a time, so Linux's "extract" stage and Linux Tool's "patch" stage can never execute in parallel.However, with per-package builds enabled, there is no guarantee that Linux has finished extracting by the time the linux-tool's
POST_PATCHhook runs. This means the creation of GNUmakefile could silently be skipped if that portion of the source code hadn't been extracted yet. If, in addition to this, asciidoc happened to be installed on the build host (/usr/bin/asciidoc), perf would detect this and enable the doc build stage. At actual build time, it would use host-python3 (not the host's system Python), which does NOT have asciidoc, and the build would fail.INSTALL
libperf_headers
SYSHDR /local/users/jenkins/workspace/[...]/libperf/arch/[...]/unistd_64.h INSTALLlibbpf_headers
fatal: not a git repository: '.'
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-amd-ibs.xml
fatal: not a git repository: '.'
[...]
ASCIIDOC /local/users/jenkins/workspace/[...]/tools/perf/perf-data.xml
/local/users/jenkins/workspace/buildroot/[...]/host/bin/python3:
No module named asciidoc
make[5]: *** [Makefile:275: [...]/perf-data.xml] Error 1
Quoted 7 lines
Turning the
POST_PATCHhook into aPRE_CONFIGUREhook solves this timing problem and guarantees that the "fake" GNUmakefile can be injected into $(LINUX_DIR)/tools/perf/Documentation as intended.Signed-off-by Markus Mayer <[email protected]>Tested-by Florian Fainelli <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 23 lines
--- package/linux-tools/linux-tool-perf.mk.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)The primary reason for v2 is the updated email address. While I was at it, I made the comment a little clearer. The actual code change is identical to before.
https://lists.buildroot.org/pipermail/buildroot/2026-September/810498.html
package/linux-tools/linux-tool-perf.mk.in +5
-0@@ -141,12 +141,17 @@ endif # distributions. # We name it 'GNUmakefile' so that GNU make will use it instead of # the existing 'Makefile'. +# +# This must be a PRE_CONFIGURE hook, not a POST_PATCH hook. Only the +# configure step is ordered after "linux" (via LINUX_TOOLS_DEPENDENCIES). +# For a POST_PATCH hook, tools/perf/Documentation/Makefile is not +# guaranteed to exist yet.
package/linux-tools/linux-tool-perf.mk.in endif · line 157
Quoted 10 lines
package/linux-tools/linux-tool-perf.mk.in +1
-1define PERF_DISABLE_DOCUMENTATION if [ -f $(LINUX_DIR)/tools/perf/Documentation/Makefile ]; then \ printf "%%:\n\t@:\n" >$(LINUX_DIR)/tools/perf/Documentation/GNUmakefile; \ fi endef -LINUX_TOOLS_POST_PATCH_HOOKS += PERF_DISABLE_DOCUMENTATION +LINUX_TOOLS_PRE_CONFIGURE_HOOKS += PERF_DISABLE_DOCUMENTATION # O must be redefined here to overwrite the one used by Buildroot for # out of tree build. We build perf in $(LINUX_DIR)/tools/perf/ and not just
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot