From 0f6c28345a51e20004bc16b73bda1c0e5ccb7f4c Mon Sep 17 00:00:00 2001 From: Mitchell Schmeisser Date: Mon, 13 Mar 2023 09:36:36 -0400 Subject: [PATCH 1/2] website: custom-toolchains-with-guix: Code fix * website/drafts/custom-toolchains-with-guix.md: Removed unnecessary native-inputs from gcc-arm-zephyr-eabi-toolchain code block. --- website/drafts/custom-toolchains-with-guix.md | 176 +++++++++--------- 1 file changed, 84 insertions(+), 92 deletions(-) diff --git a/website/drafts/custom-toolchains-with-guix.md b/website/drafts/custom-toolchains-with-guix.md index cbc491f..fb491c6 100644 --- a/website/drafts/custom-toolchains-with-guix.md +++ b/website/drafts/custom-toolchains-with-guix.md @@ -195,98 +195,90 @@ commits to use for each of the tools). ```scheme (define-public gcc-arm-zephyr-eabi-12 (let ((xgcc (cross-gcc "arm-zephyr-eabi" - #:xbinutils zephyr-binutils))) - (package - (inherit xgcc) - (version "12.1.0") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/zephyrproject-rtos/gcc") - (commit "0218469df050c33479a1d5be3e5239ac0eb351bf"))) - (file-name (git-file-name (package-name xgcc) version)) - (sha256 - (base32 - "1s409qmidlvzaw1ns6jaanigh3azcxisjplzwn7j2n3s33b76zjk")) - (patches (search-patches - "gcc-12-cross-environment-variables.patch" - "gcc-cross-gxx-include-dir.patch")))) - (native-inputs (modify-inputs (package-native-inputs xgcc) - ;; Get rid of stock ISL - (delete "isl") - ;; Add additional dependencies that xgcc doesn't have - ;; including our special ISL - (prepend flex - perl - python-3 - gmp - isl-0.15 - texinfo - python - mpc - mpfr - zlib))) - (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'fix-genmultilib - (lambda _ - (patch-shebang "gcc/genmultilib"))) - - (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH - (lambda* (#:key inputs #:allow-other-keys) - (let ((gcc (assoc-ref inputs "gcc"))) - ;; Remove the default compiler from CPLUS_INCLUDE_PATH to - ;; prevent header conflict with the GCC from native-inputs. - (setenv "CPLUS_INCLUDE_PATH" - (string-join (delete (string-append gcc - "/include/c++") - (string-split (getenv - "CPLUS_INCLUDE_PATH") - #\:)) ":")) - (format #t - "environment variable `CPLUS_INCLUDE_PATH' changed to `a`%" - (getenv "CPLUS_INCLUDE_PATH"))))))) - - ((#:configure-flags flags) - ;; The configure flags are largely identical to the flags used by the - ;; "GCC ARM embedded" project. - `(append (list - "--enable-multilib" - "--with-newlib" - "--with-multilib-list=rmprofile" - "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" - "--enable-plugins" - "--disable-decimal-float" - "--disable-libffi" - "--disable-libgomp" - "--disable-libmudflap" - "--disable-libquadmath" - "--disable-libssp" - "--disable-libstdcxx-pch" - "--disable-nls" - "--disable-shared" - "--disable-threads" - "--disable-tls" - "--with-gnu-ld" - "--with-gnu-as" - "--enable-initfini-array") - (delete "--disable-multilib" - ,flags))))) - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("arm-zephyr-eabi/include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-zephyr-eabi/include" "arm-zephyr-eabi/c++" - "arm-zephyr-eabi/c++/arm-zephyr-eabi"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("arm-zephyr-eabi/lib"))))) - (home-page "https://zephyrproject.org") - (synopsis "GCC for the Zephyr RTOS")))) + #:xbinutils zephyr-binutils))) + (package + (inherit xgcc) + (version "12.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zephyrproject-rtos/gcc") + (commit "0218469df050c33479a1d5be3e5239ac0eb351bf"))) + (file-name (git-file-name (package-name xgcc) version)) + (sha256 + (base32 + "1s409qmidlvzaw1ns6jaanigh3azcxisjplzwn7j2n3s33b76zjk")) + (patches (search-patches + "gcc-12-cross-environment-variables.patch" + "gcc-cross-gxx-include-dir.patch")))) + (native-inputs (modify-inputs (package-native-inputs xgcc) + ;; Get rid of stock ISL + (delete "isl") + ;; Add additional dependencies that xgcc doesn't have + ;; including our special ISL + (prepend flex + isl-0.15))) + (arguments + (substitute-keyword-arguments (package-arguments xgcc) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'fix-genmultilib + (lambda _ + (patch-shebang "gcc/genmultilib"))) + + (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH + (lambda* (#:key inputs #:allow-other-keys) + (let ((gcc (assoc-ref inputs "gcc"))) + ;; Remove the default compiler from CPLUS_INCLUDE_PATH to + ;; prevent header conflict with the GCC from native-inputs. + (setenv "CPLUS_INCLUDE_PATH" + (string-join (delete (string-append gcc + "/include/c++") + (string-split (getenv + "CPLUS_INCLUDE_PATH") + #\:)) ":")) + (format #t + "environment variable `CPLUS_INCLUDE_PATH' changed to `a`%" + (getenv "CPLUS_INCLUDE_PATH"))))))) + + ((#:configure-flags flags) + ;; The configure flags are largely identical to the flags used by the + ;; "GCC ARM embedded" project. + `(append (list + "--enable-multilib" + "--with-newlib" + "--with-multilib-list=rmprofile" + "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" + "--enable-plugins" + "--disable-decimal-float" + "--disable-libffi" + "--disable-libgomp" + "--disable-libmudflap" + "--disable-libquadmath" + "--disable-libssp" + "--disable-libstdcxx-pch" + "--disable-nls" + "--disable-shared" + "--disable-threads" + "--disable-tls" + "--with-gnu-ld" + "--with-gnu-as" + "--enable-initfini-array") + (delete "--disable-multilib" + ,flags))))) + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("arm-zephyr-eabi/include"))) + (search-path-specification + (variable "CROSS_CPLUS_INCLUDE_PATH") + (files '("arm-zephyr-eabi/include" "arm-zephyr-eabi/c++" + "arm-zephyr-eabi/c++/arm-zephyr-eabi"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("arm-zephyr-eabi/lib"))))) + (home-page "https://zephyrproject.org") + (synopsis "GCC for the Zephyr RTOS")))) ``` This GCC can be built like so. -- 2.39.1