guix-commits
[Top][All Lists]
Advanced

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

01/01: gnu: picprog: Fix non-Intel support.


From: Efraim Flashner
Subject: 01/01: gnu: picprog: Fix non-Intel support.
Date: Sun, 10 Dec 2017 05:39:02 -0500 (EST)

efraim pushed a commit to branch master
in repository guix.

commit 316fd29f9b6b0941367f54f431ef99695b16a9e5
Author: Efraim Flashner <address@hidden>
Date:   Sun Dec 10 12:38:26 2017 +0200

    gnu: picprog: Fix non-Intel support.
    
    * gnu/packages/patches/picprog-non-intel-support.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/embedded.scm (picprog)[source]: Add patch.
    [arguments]: Skip building the 'testport' binary.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/embedded.scm                          |  7 +-
 .../patches/picprog-non-intel-support.patch        | 74 ++++++++++++++++++++++
 3 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index a0e3f6e..75065b0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -968,6 +968,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/perl-module-pluggable-search.patch      \
   %D%/packages/patches/perl-reproducible-build-date.patch      \
   %D%/packages/patches/perl-www-curl-remove-symbol.patch       \
+  %D%/packages/patches/picprog-non-intel-support.patch         \
   %D%/packages/patches/pidgin-add-search-path.patch            \
   %D%/packages/patches/pinball-const-fix.patch                 \
   %D%/packages/patches/pinball-cstddef.patch                   \
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 82080d8..029b5a5 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016, 2017 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2016, 2017 Theodoros Foradis <address@hidden>
 ;;; Copyright © 2016 David Craven <address@hidden>
+;;; Copyright © 2017 Efraim Flashner <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -944,7 +945,8 @@ SPI, I2C, JTAG.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))))
+                "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
+              (patches (search-patches "picprog-non-intel-support.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; No tests exist.
@@ -954,7 +956,8 @@ SPI, I2C, JTAG.")
            (lambda* (#:key outputs #:allow-other-keys)
              (substitute* "Makefile"
                (("/usr/local") (assoc-ref outputs "out"))
-               ((" -o 0 -g 0 ") " "))
+               ((" -o 0 -g 0 ") " ")
+               (("testport") ""))
              #t))
          (add-before 'install 'mkdir
            (lambda* (#:key outputs #:allow-other-keys)
diff --git a/gnu/packages/patches/picprog-non-intel-support.patch 
b/gnu/packages/patches/picprog-non-intel-support.patch
new file mode 100644
index 0000000..8908207
--- /dev/null
+++ b/gnu/packages/patches/picprog-non-intel-support.patch
@@ -0,0 +1,74 @@
+https://sources.debian.org/data/main/p/picprog/1.9.1-3/debian/patches/20_iopl.patch
+
+Description: Avoid some functions in some architectures
+ Upstream uses iopl() function and other architecture-dependent
+ codes. This patch adds building switches to avoid them in
+ some architectures.
+Author: Koichi Akabe <address@hidden>
+Last-Update: 2011-11-30
+
+--- picprog-1.9.1.orig/picport.cc
++++ picprog-1.9.1/picport.cc
+@@ -38,7 +38,12 @@
+ #include <ctime>
+ 
+ #include <sys/ioctl.h>
+-#include <sys/io.h>
++
++#if defined(__i386__) || defined(__x86_64__)
++  #include <sys/io.h>
++  #define HAVE_IOPL
++#endif
++
+ #include <fcntl.h>
+ #include <sys/time.h>
+ #include <unistd.h>
+@@ -160,8 +165,12 @@
+     // Not root.  Cannot use realtime scheduling.
+     use_nanosleep = 0;
+   }
++#ifdef HAVE_IOPL
+   if (iopl (3))
+     disable_interrupts = 0;
++#else
++  disable_interrupts = 0;
++#endif
+ 
+ #ifdef CPU_SETSIZE
+   // When computing the delay loops, we do not want the cpu's to change.
+@@ -403,13 +412,17 @@
+ {
+   struct timeval tv1, tv2;
+   gettimeofday (&tv1, 0);
++#if defined(__i386__) or defined(__x86_64__)
+   if (tsc_1000ns > 1 && disable_interrupts)
+     asm volatile("pushf; cli");
++#endif
+   set_clock_data (1, b); // set data, clock up
+   delay (cable_delay);
+   set_clock_data (0, b); // clock down
++#if defined(__i386__) or defined(__x86_64__)
+   if (tsc_1000ns > 1 && disable_interrupts)
+     asm volatile("popf");
++#endif
+   gettimeofday (&tv2, 0);
+ 
+   // We may have spent a long time in an interrupt or in another task
+@@ -428,13 +441,17 @@
+ {
+   struct timeval tv1, tv2;
+   gettimeofday (&tv1, 0);
++#if defined(__i386__) or defined(__x86_64__)
+   if (tsc_1000ns > 1 && disable_interrupts)
+     asm volatile("pushf; cli");
++#endif
+   set_clock_data (1, 1); // clock up
+   delay (cable_delay);
+   set_clock_data (0, 1); // set data up, clock down
++#if defined(__i386__) or defined(__x86_64__)
+   if (tsc_1000ns > 1 && disable_interrupts)
+     asm volatile("popf");
++#endif
+   gettimeofday (&tv2, 0);
+ 
+   // We may have spent a long time in an interrupt or in another task



reply via email to

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