From f03ffef29925e8e04f5ec37b0a9eb6921157e563 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Thu, 30 Oct 2025 23:45:22 +0100 Subject: gnu: meson: Use a custom build-system. This allows us to decouple meson and all its dependents from the pyproject-build-system, and avoid a lot of rebuilds (rusts, llvm...). * gnu/packages/build-tools.scm (meson) [build-system]: Replace pyproject-build-system with a patched gnu-build-system. [arguments]<#:phases>: Adapt accordindly. [native-inputs]: Replace python-setuptools by python-setuptools-bootstrap. Change-Id: Ieb4b007847d567aad04734a62cfc6c07e2bb2f96 Signed-off-by: Sharlatan Hellseher --- gnu/packages/build-tools.scm | 47 ++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'gnu') diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm index 660bef2651..81c52bc17c 100644 --- a/gnu/packages/build-tools.scm +++ b/gnu/packages/build-tools.scm @@ -378,24 +378,37 @@ files and generates build instructions for the Ninja build system.") (sha256 (base32 "13a9pj7d2mxgv5gbd78di4pb4w722vjis0vmk38m1vdm95v2f9yd")))) - (build-system pyproject-build-system) + (build-system gnu-build-system) (arguments - (list #:tests? #f ;disabled to avoid extra dependencies - #:phases - #~(modify-phases %standard-phases - ;; Meson calls the various executables in out/bin through the - ;; Python interpreter, so we cannot use the shell wrapper. - (replace 'wrap - (lambda* (#:key inputs outputs #:allow-other-keys) - (substitute* (search-input-file outputs "bin/meson") - (("import sys" all) - (string-append - all "\n" - "sys.path.insert(0, '" - (site-packages inputs outputs) - "')")))))))) - (native-inputs (list python-setuptools)) - (inputs (list python ninja)) + (list + #:tests? #f ;disabled to avoid extra dependencies + ;; Essentially a lighter copy of the former python-build-system. + ;; Using it rather than pyproject-build-system allows to edit the latter + ;; without a C++ world rebuild. + #:phases + #~(modify-phases %standard-phases + (delete 'bootstrap) + (delete 'configure) + (replace 'build + (lambda _ + (invoke "python" "./setup.py" "build"))) + (replace 'install + (lambda _ + (invoke "python" "./setup.py" "install" + (string-append "--prefix=" #$output) "--no-compile") + (invoke "python" "-m" "compileall" + "--invalidation-mode=unchecked-hash" #$output))) + ;; Meson calls the various executables in out/bin through the + ;; Python interpreter, so we cannot use the shell wrapper. + (add-after 'install 'wrap + (lambda _ + (let* ((mdist (car (find-files #$output "^mdist\\.py$"))) + (site (dirname (dirname mdist)))) + (substitute* (string-append #$output "/bin/meson") + (("import sys" all) + (format #f "~a~%sys.path.insert(0, ~s)" all site))))))))) + (native-inputs (list python-setuptools-bootstrap)) + (inputs (list python-wrapper ninja)) (home-page "https://mesonbuild.com/") (synopsis "Build system designed to be fast and user-friendly") (description -- cgit v1.3