diff options
author | Foo Chuan Wei <chuanwei.foo@hotmail.com> | 2021-11-21 10:40:50 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-12-18 22:51:54 +0100 |
commit | 59362e928e3b84bdfbe433acabb06bb53688bd17 (patch) | |
tree | 8d93f86bd49d8193a11e888291a9e465877543a5 /gnu/packages/engineering.scm | |
parent | 8da63c2c23e90eba0893b19185de17b54ab79136 (diff) | |
download | guix-59362e928e3b84bdfbe433acabb06bb53688bd17.tar guix-59362e928e3b84bdfbe433acabb06bb53688bd17.tar.gz |
gnu: Add xfoil.
* gnu/packages/engineering.scm (xfoil): New variable.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/engineering.scm')
-rw-r--r-- | gnu/packages/engineering.scm | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index edc0f51d8d..e0fe0f354f 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -26,6 +26,7 @@ ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru> ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com> +;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -2898,6 +2899,107 @@ hot-patching the machine code of the standard C library in the memory of a process.") (license license:bsd-2)))) +(define-public xfoil + (package + (name "xfoil") + (version "6.99") + (source + (origin + (method url-fetch) + (uri (string-append "https://web.mit.edu/drela/Public/web/xfoil/xfoil" + version ".tgz")) + (sha256 + (base32 + "0h5y5v0qlyvi4qc943x394npz4779i8f52iksxshxkjj7xj500jw")))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'edit-files + (lambda* (#:key outputs #:allow-other-keys) + ;; The instructions in orrs/README say that orrs/bin/osmap.f + ;; should be edited, but that file is never used by XFOIL. + ;; Instead, it is osrc/osmap.f that is used. + (substitute* "osrc/osmap.f" + (("^[ ]{6}DATA OSFILE / '/var/local/codes/orrs/osmap.dat' /") + (let ((replacement (string-append (make-string 6 #\space) + "DATA OSFILE / '" + (assoc-ref outputs "out") + "/share/xfoil/osmap.dat' /"))) + ;; In fixed form Fortran, lines cannot exceed 72 columns. + ;; The Guix store path exceeds this limit. + (string-append + (substring replacement 0 72) "\n" + (make-string 5 #\space) "&" (substring replacement 72))))) + (substitute* "orrs/bin/Makefile_DP" + (("^FC = ifort") + "FC = gfortran") + (("^FLG = -O -r8") + "FLG = -O2 -fdefault-real-8")) + (substitute* "plotlib/Makefile" + (("^include ./config.make") + "include ./config.make.gfortranDP")) + (substitute* "bin/Makefile_gfortran" + (("^BINDIR = /home/codes/bin/") + (string-append "BINDIR = " (assoc-ref outputs "out") "/bin")) + (("^CC = cc") + "CC = gcc") + (("^CFLAGS = -O -DUNDERSCORE") + "CFLAGS = -O2 -DUNDERSCORE") + (("^FFLAGS = -O \\$\\(CHK\\) \\$\\(DBL\\)") + "FFLAGS = -O2 $(CHK) $(DBL)") + (("^FFLOPT = -O \\$\\(CHK\\) \\$\\(DBL\\)") + "FFLOPT = -O2 $(CHK) $(DBL)") + ;; Separate the build stage from the install stage. + (("\\$\\(INSTALLCMD\\) xfoil \\$\\(BINDIR\\)") "") + (("\\$\\(INSTALLCMD\\) pxplot \\$\\(BINDIR\\)") "") + (("\\$\\(INSTALLCMD\\) pplot \\$\\(BINDIR\\)") "")))) + (replace 'build + (lambda _ + (invoke "make" "-C" "orrs/bin" "-f" "Makefile_DP" "osgen") + (with-directory-excursion "orrs" + (invoke "bin/osgen" "osmaps_ns.lst")) + (invoke "make" "-C" "plotlib") + (substitute* "bin/Makefile_gfortran" + (("^FFLAGS =(.*)$" _ suffix) + (string-append "FFLAGS = -fallow-argument-mismatch " + suffix "\n"))) + (invoke "make" "-C" "bin" "-f" "Makefile_gfortran"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin-dir (string-append out "/bin")) + (data-dir (string-append out "/share/xfoil")) + (doc-dir (string-append out "/share/doc/xfoil"))) + (mkdir-p bin-dir) + (invoke "make" "-C" "bin" "-f" "Makefile_gfortran" "install") + (mkdir-p data-dir) + (install-file "orrs/osmap.dat" data-dir) + (mkdir-p doc-dir) + (install-file "xfoil_doc.txt" doc-dir))))) + #:tests? #f)) + (inputs + (list libx11)) + (native-inputs + (list gfortran)) + (home-page "https://web.mit.edu/drela/Public/web/xfoil/") + (synopsis "Program for the design and analysis of subsonic airfoils") + (description + "XFOIL is an interactive program for the design and analysis of subsonic +isolated airfoils. It consists of a collection of menu-driven routines which +perform various useful functions such as: +@itemize +@item Viscous (or inviscid) analysis of an existing airfoil +@item Airfoil design and redesign by interactive modification of surface speed + distributions +@item Airfoil redesign by interactive modification of geometric parameters +@item Blending of airfoils +@item Writing and reading of airfoil coordinates and polar save files +@item Plotting of geometry, pressure distributions, and multiple polars +@end itemize") + (license license:gpl2+))) + (define-public libigl (package (name "libigl") |