Giter VIP home page Giter VIP logo

Comments (5)

hhugo avatar hhugo commented on June 30, 2024

@gerdstolpmann may have suggestions on this.

from eliom.

gerdstolpmann avatar gerdstolpmann commented on June 30, 2024

The js file should not go into archive - which is reserved for files that are really passed to ocamlc/ocamlopt. You could e.g. use

archive(byte,javascript) = "library_jsofocaml.cma"

to select a special version of a library that is prepared for jsofocaml (say, if you have a library that should work for both the standard runtime and for javascript, and you need different ocaml code depending on the runtime).

I think linkopts looks like the right choice for this. linkopts is nowadays rarely used, but initially this META variable contained additionally parameters for the linker. And this is what you are doing here - you have a special form of linking where extra js file need to be loaded. What I'm suggesting is: Put this into META:

linkopts(javascript) = "library.js"

and use this type of query to get all js files for some packages:

ocamlfind query -o-format -r -predicates "javascript" eliom.client

Note that we use here only "javascript" and not "byte,javascript" as predicates so the standard linker is unaffected by this.

from eliom.

hhugo avatar hhugo commented on June 30, 2024

I've been trying the following (in js_of_ocaml META file)

linkopts(javascript) = "runtime.js"
linkopts(javascript,pkg_unix) += "unix.js"

I was expected the command:

ocamlfind query -o-format -r -predicates "javascript" js_of_ocaml unix

to output unix.js as well. It doesn't .

I may have misunderstund the doc (http://projects.camlcity.org/projects/dl/findlib-1.4/doc/ref-html/r681.html).
I was expecting pkg_unix to be true.

Is it possible to get this behavior ?

from eliom.

gerdstolpmann avatar gerdstolpmann commented on June 30, 2024

Hmmm, ocamlfind query doesn't do this. This is probably just an oversight, as the other subcommands like ocamlc actually set the pkg_* predicates automatically.

I could add this to the next version of ocamlfind. Ok?

from eliom.

hhugo avatar hhugo commented on June 30, 2024

Ok. meanwhile, one can set pkg_* predicates manually
ocamlfind query -r -format "pkg_%p" eliom.client

from eliom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.