From 691b97aed909d381009c13106e219f909dbda4bd Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 19 Jun 2023 16:47:58 +0300 Subject: transformations: Allow tuning go packages. * guix/transformations.scm (build-system-with-tuning-compiler): When checking if a microarchitecture is supported by the compiler, also check if it is a go compiler which supports that psabi. Add a phase after 'setup-go-environment to set the go microarchitecture. --- guix/transformations.scm | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/guix/transformations.scm b/guix/transformations.scm index a289f81219..92d9c89c0e 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016-2023 Ludovic Courtès ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2023 Sarthak Shah +;;; Copyright © 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,7 +33,9 @@ #:autoload (guix upstream) (package-latest-release upstream-source-version upstream-source-signature-urls) - #:autoload (guix cpu) (current-cpu cpu->gcc-architecture) + #:autoload (guix cpu) (current-cpu + cpu->gcc-architecture + gcc-architecture->micro-architecture-level) #:use-module (guix utils) #:use-module (guix memoization) #:use-module (guix gexp) @@ -516,7 +519,9 @@ system that builds code for MICRO-ARCHITECTURE; otherwise raise an error." 'compiler-cpu-architectures) p)) (_ #f)) - (bag-build-inputs lowered)))) + (bag-build-inputs lowered))) + (psabi (gcc-architecture->micro-architecture-level + micro-architecture))) (unless compiler (raise (formatted-message (G_ "failed to determine which compiler is used")))) @@ -528,8 +533,11 @@ system that builds code for MICRO-ARCHITECTURE; otherwise raise an error." (G_ "failed to determine whether ~a supports ~a") (package-full-name compiler) micro-architecture))) - (unless (member micro-architecture - (or (assoc-ref lst architecture) '())) + (unless (or (member micro-architecture + (or (assoc-ref lst architecture) '())) + (and (string=? (package-name compiler) "go") + (member psabi + (or (assoc-ref lst architecture) '())))) (raise (make-compound-condition (formatted-message @@ -556,6 +564,27 @@ micro-architectures: (bag (inherit lowered) + (arguments + (substitute-keyword-arguments (bag-arguments lowered) + ;; We add the tuning parameter after the default GO flags are set. + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'setup-go-environment 'set-microarchitecture + (lambda _ + (cond + ((string-prefix? "arm" #$psabi) + (setenv "GOARM" (string-take-right #$psabi 1)) + (format #t "Setting GOARM to ~s." + (getenv "GOARM"))) + ((string-prefix? "powerpc" #$psabi) + (setenv "GOPPC64" #$psabi) + (format #t "Setting GOPPC64 to ~s." + (getenv "GOPPC64"))) + ((string-prefix? "x86_64" #$psabi) + (setenv "GOAMD" (string-take-right #$psabi 2)) + (format #t "Setting GOAMD to ~s.\n" + (getenv "GOAMD"))) + (else #t)))))))) (build-inputs ;; Arrange so that the compiler wrapper comes first in $PATH. `(("tuning-compiler" ,(tuning-compiler micro-architecture)) -- cgit v1.2.3 ges/emulators.scm, gnu/packages/finance.scm, gnu/packages/image.scm, gnu/packages/libffi.scm, gnu/packages/mail.scm, gnu/packages/mpd.scm, gnu/packages/openstack.scm, gnu/packages/pdf.scm, gnu/packages/python-web.scm, gnu/packages/search.scm, gnu/packages/statistics.scm, gnu/packages/storage.scm, gnu/packages/sync.scm, gnu/packages/terminals.scm, gnu/packages/tls.scm, gnu/packages/web.scm: Adjust module imports. Marius Bakke 2019-05-04gnu: python-cffi: Fix tests....Fixes issue #35371 (see: https://bugs.gnu.org/35371). * gnu/packages/libffi.scm (python-cffi)[phases] {patch-paths-of-dynamically-loaded-libraries}: Add phase. [home-page]: Update URL. Maxim Cournoyer 2019-03-01gnu: python-cffi: Build HTML documentation in separate derivation....This is necessary to solve a dependency cycle between Sphinx and Requests. * gnu/packages/libffi.scm (python-cffi)[outputs]: Remove. [native-inputs]: Remove PYTHON-SPHINX. [arguments]: Remove 'install-doc' phase. * gnu/packages/libffi.scm (python-cffi-documentation): New public variable. Marius Bakke 2019-02-18gnu: ruby-ffi: Update to 1.10.0....* gnu/packages/libffi.scm (ruby-ffi): Update to 1.10.0. Ricardo Wurmus 2019-01-15gnu: Separate Python core packages from the rest....* gnu/packages/python.scm: Move hundreds of package definitions from here... * gnu/packages/python-xyz.scm: ...to this new module. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/ada.scm, gnu/packages/admin.scm, gnu/packages/android.scm, gnu/packages/audio.scm, gnu/packages/backup.scm, gnu/packages/benchmark.scm, gnu/packages/bioinformatics.scm, gnu/packages/bittorrent.scm, gnu/packages/calendar.scm, gnu/packages/check.scm, gnu/packages/chemistry.scm, gnu/packages/cluster.scm, gnu/packages/compression.scm, gnu/packages/connman.scm, gnu/packages/crypto.scm, gnu/packages/cups.scm, gnu/packages/databases.scm, gnu/packages/dav.scm, gnu/packages/direct-connect.scm, gnu/packages/disk.scm, gnu/packages/django.scm, gnu/packages/dlang.scm, gnu/packages/docker.scm, gnu/packages/ebook.scm, gnu/packages/elf.scm, gnu/packages/emacs.scm, gnu/packages/emulators.scm, gnu/packages/engineering.scm, gnu/packages/enlightenment.scm, gnu/packages/finance.scm, gnu/packages/fltk.scm, gnu/packages/fontutils.scm, gnu/packages/freedesktop.scm, gnu/packages/game-development.scm, gnu/packages/games.scm, gnu/packages/geo.scm, gnu/packages/gl.scm, gnu/packages/glib.scm, gnu/packages/gnome.scm, gnu/packages/gnupg.scm, gnu/packages/gnuzilla.scm, gnu/packages/graph.scm, gnu/packages/graphics.scm, gnu/packages/graphviz.scm, gnu/packages/gtk.scm, gnu/packages/ham-radio.scm, gnu/packages/image-processing.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/jrnl.scm, gnu/packages/julia.scm, gnu/packages/kde-frameworks.scm, gnu/packages/key-mon.scm, gnu/packages/libffi.scm, gnu/packages/libreoffice.scm, gnu/packages/libusb.scm, gnu/packages/lirc.scm, gnu/packages/logging.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/mate.scm, gnu/packages/maths.scm, gnu/packages/medical.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mp3.scm, gnu/packages/mpd.scm, gnu/packages/music.scm, gnu/packages/networking.scm, gnu/packages/nutrition.scm, gnu/packages/openldap.scm, gnu/packages/openstack.scm, gnu/packages/package-management.scm, gnu/packages/password-utils.scm, gnu/packages/patchutils.scm, gnu/packages/pdf.scm, gnu/packages/photo.scm, gnu/packages/polkit.scm, gnu/packages/protobuf.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/qt.scm, gnu/packages/rdf.scm, gnu/packages/ruby.scm, gnu/packages/search.scm, gnu/packages/selinux.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/simulation.scm, gnu/packages/ssh.scm, gnu/packages/statistics.scm, gnu/packages/storage.scm, gnu/packages/sync.scm, gnu/packages/terminals.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm, gnu/packages/tor.scm, gnu/packages/tryton.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/virtualization.scm, gnu/packages/vpn.scm, gnu/packages/web-browsers.scm, gnu/packages/web.scm, gnu/packages/wicd.scm, gnu/packages/xdisorg.scm, gnu/packages/xorg.scm: Update module references. Ricardo Wurmus 2018-11-11gnu: python-cffi: Fix test failure on i686....* gnu/packages/patches/python-cffi-x87-stack-clean.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/libffi.scm (python-cffi)[source](patches): Add it. Marius Bakke 2018-08-22gnu: python-cffi: Update to 1.11.5....* gnu/packages/libffi.scm (python-cffi): Update to 1.11.5. Marius Bakke 2018-08-21gnu: libffi: Don't optimize for the build machine CPU....* gnu/packages/libffi.scm (libffi)[arguments]: Add #:configure-flags. Marius Bakke 2018-03-29Merge branch 'master' into core-updatesMarius Bakke 2018-03-25gnu: ruby-ffi: Update to 1.9.23....* gnu/packages/libffi.scm (ruby-ffi): Update to 1.9.23. Tobias Geerinckx-Rice 2018-03-14Merge branch 'master' into core-updatesRicardo Wurmus 2018-02-26gnu: python-cffi: Update phase style....* gnu/packages/libffi.scm (python-cffi)[arguments]: Substitute INVOKE for SYSTEM*, end phases with #t, and remove unneeded bits from the ‘install-doc’ phase. Tobias Geerinckx-Rice 2018-02-26gnu: python-cffi: Update to 1.11.4....* gnu/packages/libffi.scm (python-cffi): Update to 1.11.4. Tobias Geerinckx-Rice 2018-02-26gnu: ruby-ffi: Update to 1.9.22....* gnu/packages/libffi.scm (ruby-ffi): Update to 1.9.22. Tobias Geerinckx-Rice 2018-02-20gnu: libffi: Update phase style....* gnu/packages/libffi.scm (libffi): Move let-bound POST-INSTALL-PHASE to... [arguments]: ...here, use MODIFY-PHASES syntax, and end phase with #t. Tobias Geerinckx-Rice 2017-11-17gnu: Move testing packages from python.scm to check.scm....* gnu/packages/python.scm (python-behave-web-api, python2-behave-web-api, python-mock, python2-mock, python-mock-2, python-nose, python2-nose, python-nose2, python2-nose2, python-unittest2, python2-unittest2, python-pytest, python2-pytest, python-pytest-3.0, python2-pytest-3.0, python-pytest-cov, python2-pytest-cov, python-pytest-runner, python2-pytest-runner, python-pytest-mock, python2-pytest-mock, python-pytest-xdist, python2-pytest-xdist, python-scripttest, python2-scripttest, python-testtools, python2-testtools, python-testscenarios, python2-testscenarios, python-testresources, python2-testresources, python-subunit, python2-subunit, python-fixtures, python2-fixtures, python-testrepository, python2-testrepository, python-coverage, python2-coverage, python-cov-core, python2-cov-core, python-testpath, python2-testpath, python-testlib, python2-testlib, python-pytest-cache, python2-pytest-cache, python-pytest-localserver, python-pytest-xprocess, python-pytest-subtesthack, python2-pytest-subtesthack, python-hypothesis, python2-hypothesis, python-lit, python2-lit, python-pytest-pep8, python2-pytest-pep8, python-pytest-flakes, python2-pytest-flakes, python2-coverage-test-runner, python-pylint, python2-pylint, python-paramunittest, python2-python-paramunittest, python-pytest-warnings, python2-pytest-warnings, python-pytest-capturelog, python2-pytest-capturelog, python-pytest-catchlog, python2-pytest-catchlog, python-nosexcover, python2-nosexcover, python-discover, python2-discover, behave, python-rednose, python2-rednose, python-nose-randomly, python2-nose-randomly, python-nose-timer, python2-nose-timer): Move from here... * gnu/packages/check.scm: ...to here. * gnu/packages/admin.scm, gnu/packages/android.scm, gnu/packages/backup.scm, gnu/packages/bioinformatics.scm, gnu/packages/calendar.scm, gnu/packages/dav.scm, gnu/packages/django.scm, gnu/packages/freedesktop.scm, gnu/packages/haskell.scm, gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/jrnl.scm, gnu/packages/ldc.scm, gnu/packages/libffi.scm, gnu/packages/mail.scm, gnu/packages/mpd.scm, gnu/packages/openstack.scm, gnu/packages/package-management.scm, gnu/packages/password-utils.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/rdf.scm, gnu/packages/statistics.scm, gnu/packages/storage.scm, gnu/packages/time.scm, gnu/packages/tls.scm, gnu/packages/tor.scm, gnu/packages/tryton.scm: Adjust accordingly. Ricardo Wurmus 2017-10-15gnu: ruby-ffi: Move to libffi.scm....* gnu/packages/ruby.scm (ruby-ffi): Move from here ... * gnu/packages/libffi.scm: ... to here. Efraim Flashner 2017-10-15gnu: python-cffi: Move to libffi.scm...* gnu/packages/python.scm (python-cffi): Move from here ... * gnu/packages/libffi.scm: ... to here. * gnu/packages/crypto.scm, gnu/packages/password-utils.scm: Adjust module imports. Efraim Flashner