Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling Crystal code in postinstall #124

Closed
ysbaddaden opened this issue Sep 23, 2016 · 1 comment · Fixed by #256
Closed

Compiling Crystal code in postinstall #124

ysbaddaden opened this issue Sep 23, 2016 · 1 comment · Fixed by #256
Milestone

Comments

@ysbaddaden
Copy link
Contributor

ysbaddaden commented Sep 23, 2016

The postinstall script was added to allow the compilation of external C libraries when a Shard is installed as a dependency. But, it may be used to build Crystal binaries that the library (or the project that installed the dependency) could leverage. This may happen more often when #95 is implemented.

The issue is for transitive dependencies, that is when a dependency requires other dependencies to build the executables: they must be 1. installed and 2. accessible.

Shards currently installs dependencies in no specific order —they're actually installed in the order they are found— and immediately runs the postinstall script. It's thus likely that the dependencies of a dependency won't be available when a Shard tries to build Crystal code. Furthermore, dependencies are installed inside a single lib folder, thus even though they are accessible when building the main project, they aren't made accessible when building inside the dependency (i.e. there is no lib folder inside the dependency).

Possible solutions to the availability of transitive dependencies:

  • install all shards and postpone the postinstall script (and executables installation) until they are all installed (basic, can fail if a shard requires a dependency binary);
  • sort dependencies, install them in a manner that when installing a library, it's dependencies have already been installed (complex, beware of recursive dependencies).

Possible solution to the accessibility of transitive dependencies:

  • manipulate the CRYSTAL_PATH environment variable when running the postinstall script, so it includes the main project's lib folder.
@Sija
Copy link
Contributor

Sija commented Apr 14, 2018

install all shards and postpone the postinstall script (and executables installation) until they are all installed;

That sounds like a sensible interim solution. Especially useful now, when #126 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants