Message ID | 20220806225743.422102-1-antero@mailbox.org |
---|---|
State | New |
Headers | show |
Series | [bug#56576,1/2] gnu: Add stddoc. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git-branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
On 07-08-2022 00:57, Antero Mejr via Guix-patches via wrote: > + (invoke "gcc" "-O2" "-g" "-o" "stddoc" "stddoc.c") For cross-compilation, you need to use #$(cc-for-target) instead of "gcc", otherwise it will be compiled for the wrong architecture. > + (with-input-from-file "stddoc.c" > + (lambda _ > + (with-output-to-file "stddoc.c.html" > + (lambda _ > + (invoke "./stddoc"))))))) Except when emulation is used, cross-compiled binaries cannot be run. However, you can add 'this-package' to native-inputs (conditional on cross-compilation, otherwise you get a loop) and run that stddoc: (native-inputs (if (%current-target-system) (list this-package) '())) [...] (invoke #$(if (%current-target-system) "stddoc" "./stddoc")) (untested!). It includes Javascript and CSS from external sources: > static void stddoc( FILE *in, FILE *out ) { > fprintf(out, "%s\n", "<meta charset='utf-8' emacsmode='-*- > markdown -*-'>"); > fprintf(out, "%s\n", "<link rel='stylesheet' > href='https://casual-effects.com/m""arkdeep/latest/apidoc.css?'>"); > I don't think this is good, privacy-wise, could you substitute them with a local copy? Also, on <https://github.com/r-lyeh/stddoc.c/blob/6eef9deaf2e36bae812f50e448a8012b3e5efb14/stddoc.c#L111>, it looks like it forgets to quote things like &. I don't know if that's important in this particular case but often forgetting to quote things can be pretty bad. (Ignoring the return value of printf also isn't ideal, but less important) > + (description "@code{stddoc.c} is a tiny documentation generator for 60 > +programming languages. Markdeep code comments are extracted from stdin and > +printed into stdout as a HTML file.") This seems misleading to me, the Markdown->HTML happens at runtime, via the Javascript. Also, instead of mentioning the number 60, you could refer to the Javascript package; that way, the user can check if their language is in the list. I also don't think that the generator 'https://morgan3d.github.io/markdeep/latest/markdeep.js' counts as tiny. stdout -> output, stdin -> input Greetings, Maxime
diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm index 6f24149b5d..9b98db4d40 100644 --- a/gnu/packages/documentation.scm +++ b/gnu/packages/documentation.scm @@ -393,3 +393,45 @@ (define-public zeal (description "Zeal is a simple offline documentation browser inspired by Dash.") (license gpl3+)))) + +(define-public stddoc + (let ((commit "6eef9deaf2e36bae812f50e448a8012b3e5efb14")) + (package + (name "stddoc") + (version "1.0.2") + (home-page "https://github.com/r-lyeh/stddoc.c") + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "06phjp7wbf4x1sagxwfapgv6iyiixmijxxbg2clb48kyvjg5mlwn")) + (snippet #~(delete-file "stddoc.c.html")))) + (build-system gnu-build-system) + (arguments + (list #:tests? #f ;no tests + #:phases #~(modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda _ + (invoke "gcc" "-O2" "-g" "-o" "stddoc" "stddoc.c") + (with-input-from-file "stddoc.c" + (lambda _ + (with-output-to-file "stddoc.c.html" + (lambda _ + (invoke "./stddoc"))))))) + (replace 'install + (lambda _ + (install-file "stddoc" + (string-append #$output "/bin")) + (install-file "stddoc.c.html" + (string-append #$output + "/share/doc"))))))) + (synopsis "Documentation generator for 60 programming languages") + (description "@code{stddoc.c} is a tiny documentation generator for 60 +programming languages. Markdeep code comments are extracted from stdin and +printed into stdout as a HTML file.") + (license unlicense))))