all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 01/12] gnu: Add fastcap.
@ 2015-07-24 14:17 Federico Beffa
  2015-07-26 10:42 ` Andreas Enge
  0 siblings, 1 reply; 3+ messages in thread
From: Federico Beffa @ 2015-07-24 14:17 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

The function 'broken-tarball-fetch' was provided by Ludovic on IRC.

I'm not 100% sure about the license.

Fede

[-- Attachment #2: 0001-gnu-Add-fastcap.patch --]
[-- Type: text/x-diff, Size: 10210 bytes --]

From b00cb9dace65ba18b61072b970cff20b6b413205 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Tue, 21 Jul 2015 21:51:29 +0200
Subject: [PATCH 01/12] gnu: Add fastcap.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/engineering.scm (fastcap): New variable.
  (broken-tarball-fetch): New function.  Suggested by Ludovic Courtès
  <ludo@gnu.org>.
* gnu/packages/patches/fastcap-mulGlobal.patch,
  gnu/packages/patches/fastcap-mulSetup.patch: New files.
* gnu-system.am (dist_patch_DATA): Add them.
---
 gnu-system.am                                |   2 +
 gnu/packages/engineering.scm                 | 118 +++++++++++++++++++++++++++
 gnu/packages/patches/fastcap-mulGlobal.patch |  13 +++
 gnu/packages/patches/fastcap-mulSetup.patch  |  19 +++++
 4 files changed, 152 insertions(+)
 create mode 100644 gnu/packages/patches/fastcap-mulGlobal.patch
 create mode 100644 gnu/packages/patches/fastcap-mulSetup.patch

diff --git a/gnu-system.am b/gnu-system.am
index 128e64f..2ea6fb3 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -429,6 +429,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/elfutils-tests-ptrace.patch		\
   gnu/packages/patches/emacs-exec-path.patch			\
   gnu/packages/patches/eudev-rules-directory.patch		\
+  gnu/packages/patches/fastcap-mulGlobal.patch			\
+  gnu/packages/patches/fastcap-mulSetup.patch			\
   gnu/packages/patches/findutils-absolute-paths.patch		\
   gnu/packages/patches/findutils-localstatedir.patch		\
   gnu/packages/patches/flashrom-use-libftdi1.patch		\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index b0e37f7..c57d44b 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,7 +20,10 @@
 (define-module (gnu packages engineering)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
+  #:use-module (guix monads)
+  #:use-module (guix store)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
@@ -27,9 +31,11 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gd)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -41,6 +47,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages tcl)
+  #:use-module (gnu packages texlive)
   #:use-module (srfi srfi-1))
 
 (define-public librecad
@@ -196,3 +203,114 @@ layouts.  It features a rats-nest implementation, schematic/netlist import,
 and design rule checking.  It also includes an autorouter and a trace
 optimizer; and it can produce photorealistic and design review images.")
     (license license:gpl2+)))
+
+(define* (broken-tarball-fetch url hash-algo hash
+                               #:optional name
+                               #:key (system (%current-system))
+                               (guile (default-guile)))
+  (mlet %store-monad ((drv (url-fetch url hash-algo hash
+                                      (string-append "tarbomb-" name)
+                                      #:system system
+                                      #:guile guile)))
+    ;; Take the tar bomb, and simply unpack it as a directory.
+    (gexp->derivation name
+                      #~(begin
+                          (mkdir #$output)
+                          (setenv "PATH"
+                                  (string-append #$gzip "/bin"))
+                          (chdir #$output)
+                          (zero? (system* (string-append #$tar "/bin/tar")
+                                          "xf" #$drv))))))
+
+
+(define-public fastcap
+  (package
+    (name "fastcap")
+    (version "2.0-18Sep92")
+    (source (origin
+              (method broken-tarball-fetch)
+              (file-name (string-append name "-" version ".tar.gz"))
+              (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
+                                  name "-" version ".tgz"))
+              (sha256
+               (base32
+                "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
+              (modules '((guix build utils)
+                         (guix build download)
+                         (guix ftp-client)))
+              (patches (list (search-patch "fastcap-mulSetup.patch")
+                             (search-patch "fastcap-mulGlobal.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("texlive" ,texlive)
+       ("ghostscript" ,ghostscript)))
+    (arguments
+     `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
+       #:parallel-build? #f
+       #:tests? #f ;; no tests-suite
+       #:modules ((srfi srfi-1)
+                  ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'make-doc
+                    (lambda _
+                      (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
+                                      "manual"))))
+         (add-before 'make-doc 'fix-doc
+                     (lambda _
+                       (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
+                       (substitute* (find-files "doc" "\\.tex")
+                         (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
+                           all file scale)
+                          (string-append "\\includegraphics[scale=" scale "]{"
+                                         file "}")))
+                       (substitute* '("doc/mtt.tex" "doc/tcad.tex")
+                         (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
+                           all options class)
+                          (string-append "\\documentclass[" options "]{"
+                                         class "}\n"
+                                         "\\usepackage{graphicx}\n"
+                                         "\\usepackage{robinspace}"))
+                         (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
+                          (string-append "%" all))
+                         (("\\\\setstretch\\{.*\\}" all)
+                          (string-append "%" all)))
+                       #t))
+         (delete 'configure)
+         (add-before 'install 'clean-bin
+                     (lambda _
+                       (delete-file (string-append (getcwd) "/bin/README"))
+                       #t))
+         (add-before 'install 'make-pdf
+                     (lambda _
+                       (with-directory-excursion "doc"
+                         (and
+                          (every (lambda (file)
+                                   (zero? (system* "dvips" file "-o")))
+                                 (find-files "." "\\.dvi"))
+                          (every (lambda (file)
+                                   (zero? (system* "ps2pdf" file)))
+                                 '("mtt.ps" "ug.ps" "tcad.ps"))
+                          (zero? (system* "make" "clean"))))))
+         (replace 'install
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let* ((out (assoc-ref outputs "out"))
+                           (data (string-append out "/share"))
+                           (bin (string-append out "/bin"))
+                           (doc (string-append data "/doc/" ,name "-" ,version))
+                           (examples (string-append doc "/examples")))
+                      (with-directory-excursion "bin"
+                        (mkdir-p bin)
+                        (for-each
+                         (lambda (f)
+                           (copy-file f (string-append bin "/" (basename f))))
+                         (find-files "." ".*")))
+                      (copy-recursively "doc" doc)
+                      (copy-recursively "examples" examples)
+                      #t))))))
+    (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
+    (synopsis "Multipole-accelerated capacitance extraction program")
+    (description
+     "A capacitance extraction program based on a multipole-accelerated
+algorithm.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/fastcap-mulGlobal.patch b/gnu/packages/patches/fastcap-mulGlobal.patch
new file mode 100644
index 0000000..efb3b57
--- /dev/null
+++ b/gnu/packages/patches/fastcap-mulGlobal.patch
@@ -0,0 +1,13 @@
+Don't use timing as there is a type conflict.
+
+--- nix-build-fastcap-2.0-18Sep92.drv-1/src/mulGlobal.h.orig	2015-07-21 15:58:49.199101566 +0200
++++ nix-build-fastcap-2.0-18Sep92.drv-1/src/mulGlobal.h	2015-07-21 16:18:39.456751313 +0200
+@@ -57,7 +57,7 @@
+ /* time variables/structs */
+ #ifndef _TIME_                  /* if not on a Sun4 */
+ #ifndef NEWS                    /* if not on a NWS-38XX */
+-#include <time.h>
++//#include <time.h>
+ #endif
+ #endif
+ 
diff --git a/gnu/packages/patches/fastcap-mulSetup.patch b/gnu/packages/patches/fastcap-mulSetup.patch
new file mode 100644
index 0000000..00eb7e9
--- /dev/null
+++ b/gnu/packages/patches/fastcap-mulSetup.patch
@@ -0,0 +1,19 @@
+Add forward declarations.
+
+--- fastcap/src/mulSetup.c.orig	2015-07-22 13:55:21.592119775 +0200
++++ fastcap/src/mulSetup.c	2015-07-22 14:08:50.157688209 +0200
+@@ -35,6 +35,14 @@
+ 
+ #include "mulGlobal.h"
+ 
++static getnbrs(ssystem*);
++static linkcubes(ssystem*);
++static setMaxq(ssystem*);
++static getAllInter(ssystem*);
++static set_vector_masks(ssystem*);
++static indexkid(ssystem*, cube*, int*, int*);
++static int placeq(int, ssystem*, charge*);
++
+ cube *cstack[1024];		/* Stack used in several routines. */
+ 
+ /*
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/12] gnu: Add fastcap.
  2015-07-24 14:17 [PATCH 01/12] gnu: Add fastcap Federico Beffa
@ 2015-07-26 10:42 ` Andreas Enge
  2015-07-27 20:11   ` Federico Beffa
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Enge @ 2015-07-26 10:42 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

On Fri, Jul 24, 2015 at 04:17:39PM +0200, Federico Beffa wrote:
> The function 'broken-tarball-fetch' was provided by Ludovic on IRC.
> I'm not 100% sure about the license.
> +    (license license:bsd-3)))

If you compare the license texts, it is not bsd-3, but inspired from it;
I would use "non-copyleft".

Andreas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/12] gnu: Add fastcap.
  2015-07-26 10:42 ` Andreas Enge
@ 2015-07-27 20:11   ` Federico Beffa
  0 siblings, 0 replies; 3+ messages in thread
From: Federico Beffa @ 2015-07-27 20:11 UTC (permalink / raw)
  To: Andreas Enge; +Cc: Guix-devel

On Sun, Jul 26, 2015 at 12:42 PM, Andreas Enge <andreas@enge.fr> wrote:
> On Fri, Jul 24, 2015 at 04:17:39PM +0200, Federico Beffa wrote:
>> The function 'broken-tarball-fetch' was provided by Ludovic on IRC.
>> I'm not 100% sure about the license.
>> +    (license license:bsd-3)))
>
> If you compare the license texts, it is not bsd-3, but inspired from it;
> I would use "non-copyleft".

Thanks for the suggestion. I will use non-copyleft then.
Fede

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-27 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 14:17 [PATCH 01/12] gnu: Add fastcap Federico Beffa
2015-07-26 10:42 ` Andreas Enge
2015-07-27 20:11   ` Federico Beffa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.