PerlAlien / Alien-Build

Build external dependencies for use in CPAN
16 stars 25 forks source link

Probe::CommandLine and Probe::CBuilder plugins: add atleast_version arg #299

Closed shawnlaffan closed 2 years ago

shawnlaffan commented 2 years ago

It would be useful if the Probe::CommandLine and Probe::CBuilder plugins had an atleast_version arg, similar to the PkgConfig plugins.

atleast_version would only make sense if version is also passed, so it could be applied only if the version argument is also passed, warning if not.

It is not difficult to implement a bespoke probe to achieve the same result, but the plugin model is cleaner.

plicease commented 2 years ago

Sounds reasonable. Would appreciate a PR!

shawnlaffan commented 2 years ago

I think I see where it would go. Will work something up for review.

shawnlaffan commented 2 years ago

Work in progress is at https://github.com/shawnlaffan/Alien-Build/tree/more_atleast_versions

I am currently using Sort::Versions::versioncmp to compare versions but that would require an additional dependency. Alien::Base has a version_cmp method but ~that seems not to work when comparing cases like '1.00' with '1.5.0'. In this case it only compares the first two numbers. Maybe it's a case of "alienfile writer must use the same version format as the system", in which case Alien::Base::version_cmp can be used.~

Edit - My error. Calling Alien::Base->version_cmp works.