Since the part in question uses CMake, I suggest trying the
cmake plugin. Less you need to do manually. I actually suggest trying it without any hackery first-- maybe it has install rules I missed! So try this, and see how it works:
If it errors out saying something that effectively means “what the heck, no install rules” try this (assuming the lib gets built in
<build dir>/lib and the includes get placed into
artifacts: ['lib', 'include']
If that still doesn’t work, you can try the more manual shell hackery outlined above, or use the nil plugin as you’re doing and do EVERYTHING by hand. Yucky, but doable.
Bingo. Every part goes through a lifecycle of steps:
pull: Pull the source code for this part
build: Build/install this part (place things into
stage: Place the installed stuff into the common staging area (i.e. migrate everything in
$SNAPCRAFT_PART_INSTALL into staging area)
prime: Place the final stuff into the priming area (which after all parts are complete, ends up being the snap)
So if you need to build part A that depends on part B, you need to make sure part B is already in the staging area before part A is built. That’s exactly what the
after keyword does. By saying
after: [B] you’re saying “please stage part B before building this part” which means you can use the
$SNAPCRAFT_STAGE variable to access its libs, includes, etc. That’s what this post is covering.