R-macos / recipes

System for building static dependent libraries for CRAN packages
43 stars 15 forks source link

How to set up the dependence on external headers? #6

Closed shrektan closed 5 years ago

shrektan commented 5 years ago

Hi,

I'm trying to make a recipe to build the QuantLib library so that RQuantLib can link against it... However, QuantLib requires the boost headers.

From my limited understandings, at present, there's no native way to download the external dependence files. Correct? So there're three workarounds I can imagine:

  1. Compile the boost library and make QuantLib library depending on it. Since the boost source file doesn't contain a 'configure' file, it means I need to create a configure file for boost. So I can't simply use the boost official release. Instead, I need to download the release, plugin the configure file into the source and use the modified bundle?

  2. Similiar to the first point: bundle the boost header files into the QuantLib source tarball and use the modified tarball.

  3. As suggest by @eddelbuettel , the VM machine can install the R package BH and we may be able to use the boost header files of BH.

The whole point is I try to avoid modifying the source tarball. It feels like I'm polluting the source files... But it seems that I have to in this case? If so, I incline to the 2nd method, which is simpler...

Any suggestions?

Thanks.

eddelbuettel commented 5 years ago

In my experience, Boost does not require configuration a la configure or CMake. You should be able to just down Boost, or a subset, and drop it into place. The various -DBOOST-xyz defines do the rest.

That does of course still require two downloads including maybe a partial one, or one from a prepared source. I hope @s-u can advise what works best here.

s-u commented 5 years ago

The issue has nothing to do with headers but rather non-standard sources - recipes assume autoconf-compliant packages. It is in principle possible to "abuse" the configure directive to run arbitrary scripts, but it would make much more sense to either provide a patch functionality (which may be potentially needed for other cases as well) this allowing for the creation of a simple configure script by the recipe, or have non-autoconf mode where a Makefile is provided to essentially go straight to make DESTDIR=... install. I think the former probably makes more sense as it can be used for patching release sources in general.

shrektan commented 5 years ago

The problem is I’m not able to change the configure or the Makefile inside of the QuantLib source bundle.

So what’s the suggestion here? File a PR to QuantLib?

s-u commented 5 years ago

See the comment above - the suggestion was for recipes to support non-standard installs that don't use autoconf.

s-u commented 5 years ago

I have added the above feature and also added the boost-header recipe illustrating how it can now be done (https://github.com/s-u/recipes/commit/74cc1e61c47c366fdccb6b4d319d94ba7c4f9d14). Comments are welcome. Thanks.