ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.25k stars 362 forks source link

Feature request: self-extracting extra-source #5914

Open kit-ty-kate opened 7 months ago

kit-ty-kate commented 7 months ago

It is sometimes needed to download an extra tarball and extract it somewhere during the build process (e.g. when the tarball doesn't contain the source of a git submodule) However currently extra-source doesn't allow to extract tarballs contrary to url. An option could be added like:

extra-source "tarball.tar.gz" {
  src: "path-to-tarball.tar.gz"
  checksum: "xzy"
  extract-to: "vendor/my-vendored-package"
}

The only way to do this currently is to call tar, mv and so manually which is often not very portable and not very user-friendly.

Examples include at least:

dra27 commented 7 months ago

This approach would be more elegant, but note that both the flexdll and winpthreads already do this slightly more portably by installing the sources instead: e.g. winpthreads.20240209-1.opam uses this .install file.

The downside is that the sources live in the switch, so it's only really viable if the submodule is very small.