guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using cross-compiler and host compiler in the same package


From: Danny Milosavljevic
Subject: Using cross-compiler and host compiler in the same package
Date: Tue, 7 Mar 2017 22:08:10 +0100

Hi,

I wanted to make sunxi-tools also compile the target tools.

If one is on a non-armhf architecture some of the programs need to be compiled 
with an armhf cross compiler and some (almost all) need to be compiled using 
the host compiler.  Since the cross compiler is called 
"arm-linux-gnueabihf-gcc" and not "gcc" (like the host compiler) that part is 
no problem.  However, I also require armhf libc (to be linked statically) and 
that doesn't work since one of the gccs always seems to pick up the wrong libc.

How can I fix it?

(define-module (wip admin)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (guix build-system trivial)
  #:use-module (gnu packages cross-base)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages pkg-config))

(define-public sunxi-tools
  (package
    (name "sunxi-toolsx")
    (version "1.4.2")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://github.com/linux-sunxi/";
                           "sunxi-tools/archive/v" version ".tar.gz"))
       (sha256
        (base32 "08iqwj95qw2s7ilhrdi2lkbc8dx64zk5lzz1qk587jr0lla81x41"))
       (modules '((guix build utils)))
       (snippet
        ;; Remove binaries contained in the tarball which are only for the
        ;; target and can be regenerated anyway.
        '(delete-file-recursively "bin"))
       (file-name (string-append name "-" version ".tar.gz"))))
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf"))))
    (inputs
     `(("libusb" ,libusb)))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ; no tests exist
       #:make-flags (list (string-append "PREFIX="
                                         (assoc-ref %outputs "out"))
                          (string-append "CROSS_COMPILE="
                                         "arm-linux-gnueabihf-")
                          "CC=gcc"
                          "all")
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (replace 'install
           (lambda* (#:key make-flags #:allow-other-keys)
             (zero? (apply system* "make" "install-all" "install-misc"
                           make-flags)))))))
    (home-page "https://github.com/linux-sunxi/sunxi-tools";)
    (synopsis "Hardware management tools for Allwinner computers")
    (description "This package contains tools for Allwinner devices:
@enumerate
@item @command{sunxi-fexc}, @command{bin2fex}, @command{fex2bin}: Compile
a textual description of a board (.fex) to a binary representation (.bin).
@item @command{sunxi-fel}: Puts an Allwinner device into FEL mode which
makes it register as a special USB device (rather than USB host).
You can then connect it to another computer and flash it from there.
@item @command{sunxi-nand-part}: Partitions NAND flash.
@item @command{sunxi-bootinfo}: Reads out boot0 and boot1 (Allwinner
bootloader) parameters.
@item @command{sunxi-pio}: Sets GPIO parameters and oscillates a GPIO
@item @command{sunxi-meminfo}: Prints memory bus settings.
@item @command{sunxi-nand-image-builder}: Prepares raw NAND images.
@end enumerate")
    (license license:gpl2+)))

(Also, if I try to put that into gnu/packages/admin.scm , I get some circular 
module dependency problem again... sigh)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]