unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Need some help to remove non-free documentation
@ 2018-10-22 12:32 Nicolas Goaziou
  2018-10-24 14:24 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2018-10-22 12:32 UTC (permalink / raw)
  To: help-guix

Hello,

I'm trying to remove non-free documentation from "giac-xcas" package. 

It involves removing some files from "doc/" subdirectory in source and
updating "Makefile.am". As a consequence, "Makefile.in" has to be
updated accordingly. Pain ensues.

I tried to first remove "configure" script, so as to let GNU build
system call "autoreconf -vfi". It fails due to a missing "libtoolize",
even though "libtool" is in the native inputs. I then used the
workaround implemented in "gnome-keyring" package, which consists in
calling various reconfigure steps manually. The "invoke" command still
fails, though the error is not obvious.

Not updating "Makefile.am" prevents the package from building properly,
too.

Here is the current modified package, in all its glory. I'm not sure
about what to try next, so feedback welcome.

--8<---------------cut here---------------start------------->8---
(define-public giac-xcas
  (package
    (name "giac-xcas")
    (version "1.5.0-3")
    (source (origin
              (method url-fetch)
              ;; "~parisse/giac" is not used because the maintainer regularly
              ;; overwrites the release tarball there, introducing a checksum
              ;; mismatch every time.  See
              ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
              (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
                                  "~parisse/debian/dists/stable/main/"
                                  "source/giac_" version ".tar.gz"))
              (sha256
               (base32
                "02c2x4bkjffp9c5qz3npbnvhpqhqq253nbb61wg3l6ch61r71g9x"))
              (modules '((guix build utils)
                         (ice-9 ftw)))
              (snippet
               ;; With the exception of "algo.tex", French documentation is
               ;; released under a license that prohibits distribution for
               ;; commercial purposes, making it non-free.  Remove it.
               '(begin
                  (with-directory-excursion "doc/fr"
                    (for-each
                     (lambda (f)
                       (unless (member f '("." ".."
                                           "algo.tex" "ellipse.png" "keywords"
                                           "Makefile.am" "Makefile.in"))
                         (delete-file-recursively f)))
                     (scandir "."))
                    ;; Create new Makefile.  See
                    ;; <https://salsa.debian.org/science-team/giac/blob/master/debian/upstream-doc-fr/Makefile.am.Debian>
                    (call-with-output-file "Makefile.am"
                      (lambda (port)
                        (display "
TEX_LOCAL = algo.tex
PDF_LOCAL = algo.pdf
HTML_LOCAL = algo.html
FIGURES = ellipse*
EXTRA_DIST = $(TEX_LOCAL) $(HTML_LOCAL) $(FIGURES) $(PDF_LOCAL)

the_LANG = fr
thelangdocdir = $(docdir)/$(the_LANG)
dist_thelangdoc_DATA = keywords

all-local: $(PDF_LOCAL) $(HTML_LOCAL)

install-data-local: all-local
	$(install_sh) -d $(DESTDIR)$(prefix)/share/giac/doc/$(the_LANG)
	$(INSTALL_DATA) $(PDF_LOCAL) $(DESTDIR)$(prefix)/share/giac/doc/$(the_LANG)
	$(INSTALL_DATA) $(HTML_LOCAL) $(DESTDIR)$(prefix)/share/giac/doc/$(the_LANG)
	$(INSTALL_DATA) $(dist_thelangdoc_DATA) $(DESTDIR)$(prefix)/share/giac/doc/$(the_LANG)

install-exec-hook:
	mkdir -p $(DESTDIR)$(prefix)/share/giac/doc/fr/
	ln -sf ../giac.js $(DESTDIR)$(prefix)/share/giac/doc/fr/giac.js

giacfr.tex: ../giacfr.tex
	cp \"$<\" \"$@\"

%.pdf %.html: %.tex giacfr.tex
	xvfb-run -a env XCAS_ROOT=../../ ../../src/icas \"$<\"
	set -e; for i in $@; do test -e $$i; done"
                                 port))))
                  ;; Re-generate "Makefile.in".  Due to missing "libtoolize",
                  ;; "autoreconf -vfi" refuses to proceed.  FIXME: the
                  ;; following doesn't work either.
                  (invoke "autoconf")
                  (invoke "aclocal")
                  (invoke "automake" "-ac")))))
    (build-system gnu-build-system)
    (outputs '("out" "doc"))            ;77MiB of documentation
    (arguments
     `(#:modules ((ice-9 ftw)
                  (guix build utils)
                  (guix build gnu-build-system))
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-bin-cp
           ;; Some Makefiles contain hard-coded "/bin/cp".
           (lambda _
             (substitute* (find-files "doc" "^Makefile")
               (("/bin/cp") (which "cp")))
             #t))
         (add-after 'unpack 'disable-failing-test
           ;; FIXME: Test failing.  Not sure why.
           (lambda _
             (substitute* "check/Makefile.in"
               (("chk_fhan11") ""))
             #t))
         (add-after 'install 'install-doc
           ;; Setting --docdir to "doc" output isn't sufficient as
           ;; documentation and examples are scattered throughout the source.
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (doc (assoc-ref outputs "doc"))
                    (docdir (string-append doc
                                           "/share/doc/"
                                           (string-append ,name "-" ,version))))
               ;; For some reason, the install process moves
               ;; "share/giac/examples" instead of "share/giac/doc" to
               ;; "$(docdir)".  Clean up the mess and start over.
               (delete-file-recursively (string-append doc "/share"))
               (mkdir-p docdir)
               (with-directory-excursion out
                 (for-each (lambda (f)
                             (unless (member f '("." ".."))
                               (copy-recursively (string-append "share/giac/" f)
                                                 (string-append docdir "/" f))))
                           (scandir "share/giac"))
                 (delete-file-recursively "share/giac")))
             #t)))))
    (inputs
     `(("fltk" ,fltk)
       ("gmp" ,gmp)
       ("gsl" ,gsl)
       ("lapack" ,lapack)
       ("libao" ,ao)
       ("libjpeg" ,libjpeg)
       ("libpng" ,libpng)
       ("libx11" ,libx11)
       ("libxinerama" ,libxinerama)
       ("libxft" ,libxft)
       ("libxt" ,libxt)
       ("mesa" ,mesa)
       ("mpfi" ,mpfi)
       ("mpfr" ,mpfr)
       ("ntl" ,ntl)
       ("perl" ,perl)
       ("pari-gp" ,pari-gp)
       ("tcsh" ,tcsh)
       ("texlive" ,texlive-tiny)))
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)
       ("readline" ,readline)))
    (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
    (synopsis "Computer algebra system")
    (description
     "Giac/Xcas is a computer algebra system.  It has a compatibility mode for
maple, mupad and the TI89.  It is available as a standalone program (graphic
or text interfaces) or as a C++ library.")
    (license license:gpl3+)))
--8<---------------cut here---------------end--------------->8---

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2018-10-25  7:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-22 12:32 Need some help to remove non-free documentation Nicolas Goaziou
2018-10-24 14:24 ` Ludovic Courtès
2018-10-25  7:28   ` Nicolas Goaziou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).