Paste number 325007: praat Guix package (unfinished) 9

Paste number 325007: praat Guix package (unfinished) 9
Pasted by: Brendan
When:5 years, 3 months ago
Share:Tweet this! | http://paste.lisp.org/+6YRZ
Channel:None
Paste contents:
Raw Source | XML | Display As
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Brendan Tildesley <brendan.tildesley@openmailbox.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages linguistics)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (gnu packages)
  #:use-module (gnu packages linux) ; for alsa-lib
  #:use-module (gnu packages gtk)
#  #:use-module (gnu packages gtk)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages python)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages image)
  #:use-module (gnu packages gcc))
;;    gcc -std=gnu99 -o sendpraat -DUNIX `pkg-config --cflags --libs gtk+-2.0` sendpraat.c
;;  -DSTAND_ALONE 
(define-public praat
  (package
    (name "praat")
    (version "6.0.19")
    (synopsis "Phonetics analysis program for linguists")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/praat/praat/archive/v" version ".tar.gz"))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "1fhzqzygx5h6xkjaxwgzvnby393q7c3lby0fq3bnhscfdhzkm0a0"))
              (modules '((guix build utils)))
              ;; Remote timestamp to make the build reproducible 
              (snippet
               '(substitute* "external/portaudio/pa_front.c"
                  ((" \\(built \" __DATE__  \" \" __TIME__ \"\\)") "")))))
    (build-system gnu-build-system)
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("libicns" ,libicns)
       ("gcc", gcc)))
    (inputs
     `(("gtk2" ,gtk+2)
       ("gtk3" ,gtk+)
       ("alsa-lib" ,alsa-lib)
       ("pulseaudio" ,pulseaudio)
       ("python" ,python-2)))           ; optional scripts
    (arguments
     ;; No make check. The GUI seems to have some tests in test/ though.
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-after 'unpack 'copy-makefile
           (lambda _
             (copy-file "makefiles/makefile.defs.linux.pulse"
                        "makefile.defs")
             #t))
         ;; Temporary solution until I can see if upstream will accept this.
         (add-before 'build 'build-desktop
           (lambda _
             (let* ((out (assoc-ref %outputs "out"))
                    (app (string-append out "/usr/share/applications")))
               (mkdir-p app)
               (call-with-output-file
                   (string-append app "/praat.desktop")
                 (lambda (port)
                   (format port "~
                    [Desktop Entry]~@
                    Name=~a~@
                    Comment=~a~@
                    Exec=~a/bin/praat~@
                    Type=Application
                    Categories=Education;Science;
                    Keywords=audio;sound;speech;phonetics~%" ,name ,synopsis  %output))))
             (chdir "sys")
             (display (system "pkg-config --list-all | grep gtk"))
             (system (string-append
                      "gcc -std=gnu99 -o sendpraat -DSTAND_ALONE -DUNIX"
                      (system "pkg-config --silence-errors --cflags --libs gtk+-2.0")
                              "sendpraat.c"))
             (zero? (system* "icns2png" "-x" "-o" "main/" "main/Praat.icns"))
             ))

        ;; [Desktop Entry]
         ;; Version=1.0
         ;; Name=Praat Speech Analyzer
         ;; Name[en_GB]=Praat Speech Analyser
         ;; GenericName=Speech Analyzer
         ;; GenericName[en_GB]=Speech Analyser
         ;; Comment=Analyze, synthesize and manipulate speech
         ;; Comment[en_GB]=Analyse, synthesise and manipulate speech
         ;; Type=Application
         ;; Exec=praat
         ;; Icon=praat
         ;; Categories=Education;Science;
         ;; Keywords=audio;sound;speech;phonetics
         (delete 'build)
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (install-file*
                     (lambda (source target)
                       (let ((dir (dirname target)))
                         (mkdir-p dir)
                         (copy-file source (string-append out target)))
                       (install-file* "main/Praat_128x128x32.png"
                                      "/usr/share/icons/hicolor/128x128/praat.png")
                       (install-file* "main/Praat_48x48x32.png"
                                      "/usr/share/icons/hicolor/48x48/praat.png")
                       (install-file* "main/Praat_32x32x32.png"
                                      "/usr/share/icons/hicolor/32x32/praat.png")
                       (install-file* "main/Praat_16x16x32.png"
                                      "/usr/share/icons/hicolor/16x16/praat.png"))))
               (display "hi")
               (system* "touch" "praat") ;
               (install-file "praat" bin)
                                        ;     (install-file "sendpraat" bin)
               )
             #t))))) 
    (home-page "http://www.praat.org")
    
    (description
     "According to its authors, praat is \"doing phonetics by computer\".
Through its graphical interface, several speech analysis functionalities are
available: spectrograms, cochleograms, and pitch and formant
extraction.  Articulatory synthesis, as well as synthesis from pitch, formant,
and intensity are also available.  Other features are segmentation, labelling
using the phonetic alphabet, and computation of statistics.  Praat is
configurable and extensible through its own scripting language and has
provisions for communicating with other programs.")
    (license (list
              ;; Praat itself (no version stated => gpl2+ by gpl terms)
              ;; EEG/*, FFNet/*, LPC/* external/mp3/*
              ;; external/espeak/espeakdata_FileInMemory.*
              ;; contrib/ola/* , kar/ipaSerifRegularPS.cpp
              ;; dwsys/regularExp.h , dwsys/NUMmathlib.cpp
              license:gpl2+
              ;; external/gsl/* , external/glpk/* , external/espeak/*
              license:gpl3+
              license:bsd-3             ; external/flac/*
              license:expat             ; external/portaudio/*
              license:public-domain     ; num/NUMrandom.cpp
              ;; external/flac/flac_share_alloc.h , external/glpk/colamd.c
              license:lgpl2.1+))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.