stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.02k stars 264 forks source link

Generated JS inside CRAN StanHeaders is lacking source #1079

Closed tillea closed 8 months ago

tillea commented 1 year ago

Summary:

For the Debian packaging of StanHeaders we need the human editable source but there is a file inst/stanc.js included into the CRAN download tarball (not really sure whether this is the correct issue tracker for this kind of issues - please be so kind to guide me to the right place if not).

Description:

At the CRAN page of StanHeaders the latest tarball contains the file inst/stanc.js which contains the first line

// Generated by js_of_ocaml 3.4.0

For the Debian packaging human readable / editable code is needed. Thus we need the original source that was used for this generation process.

RStan Version:

StanHeaders 2.26.27

Operating System:

Debian

bob-carpenter commented 1 year ago

The javascript is cross-compiled from OCaml. The OCaml source is in this repo:

https://github.com/stan-dev/stanc3

The specific code for generating the javascript is in directory src/stancjs

tillea commented 8 months ago

Sorry for the duplicated issue issue #1102. I wonder if someone who understands ocaml and this build project could create some uncompressed version of stanc.js. The point is that Debian policy forbids uploading the recent version of rstan due to this file. I would need to package the whole stanc3 project which takes a lot of time - not even sure whether I might manage at all since I don't speak ocaml. This means rstan and all its versioned dependencies will lag behind your upstream version more and more. Kind regards, Andreas.

WardBrian commented 8 months ago

I can see what I can provide. The JavaScript contains at least parts of the OCaml bytecode runtime, so it will probably look non-human-written no matter what

WardBrian commented 8 months ago

Hi @tillea -

Here is a version of the file which was built asking the js_of_ocaml compiler to produce a more human-readable output: https://gist.github.com/WardBrian/c48eebb39df4d049998080f997a237f9

I believe it could be made even more so at the cost of disabling certain optimizations, if the Debian maintainers still object to this new file

tillea commented 8 months ago

Am Fri, Oct 27, 2023 at 07:39:13AM -0700 schrieb Brian Ward:

Here is a version of the file which was built asking the js_of_ocaml compiler to produce a more human-readable output: https://gist.github.com/WardBrian/c48eebb39df4d049998080f997a237f9 Thanks a lot - this is extremely helpful!

I believe it could be made even more so at the cost of disabling certain optimizations, if the Debian maintainers still object to this new file It is perfectly fine as it is. Thanks again, Andreas.

WardBrian commented 8 months ago

Happy to help!

Feel free to open an issue on https://github.com/stan-dev/stanc3 if there are more concerns packaging that portion of RStan