newbie question about the autools configflags
Kyle Fazzari
kyle.fazzari at canonical.com
Sun Feb 7 16:52:55 UTC 2016
Hey Nicola,
On 02/06/2016 04:11 PM, Nicola Manica wrote:
> I am newbie about ubuntu snappy. I read the doc, but I was not able to
> find an answer for my problem.
You're in the right place!
> I am trying to create a snap for nginx.
> The relevant parts of the snapcraft.yaml is
>
> parts:
> nginx:
> type: autotools-project
> plugin: autotools
> source: http://nginx.org/download/nginx-1.9.7.tar.gz
> source-type: tar
> configflags:
> - --with-ld-opt="-Wl,-rpath,/usr/local/lib/"
> - --add-module=ngx_devel_kit
> - --add-module=lua-nginx-module
> ...
> after:
> - lua-nginx-module
> - ngx-devel-kit
>
> Without the modules it compiles fine.
> My question is about the add-module configflags. The add-module
> directive expects the filesystem path of the module, what is the right
> way to manage it?
Alright, so from the YAML I'm assuming that lua-nginx-module and
ngx-devel-kit are separate "parts" in the YAML. The problem you're
having is that there's no way to know ahead of time where they will be,
so you can't provide paths to --add-module. The solution to this problem
depends on which version of Snapcraft you're running. If you're running
Snapcraft 2.1 or later, check this out:
https://github.com/ubuntu-core/snapcraft/blob/master/docs/snapcraft-advanced-features.md#putting-your-parts-in-order
Specifically, note that you can use the $SNAPCRAFT_STAGE variable which
will give you a path into the staging directory, where both the
lua-nginx-module and ngx-devel-kit parts will exist before the nginx
part is built thanks to your use of the "after" keyword. So your YAML
will have something like this:
# ...
configflags:
- --with-ld-opt="-Wl,-rpath,/usr/local/lib/"
- --add-module=$SNAPCRAFT_STAGE/ngx_devel_kit
- --add-module=$SNAPCRAFT_STAGE/lua-nginx-module
# ...
If, however, you're on Snapcraft 1, the only solution I know of is to
hard-code a path into the staging directory. It doesn't lead to the most
portable YAML, but it works:
# ...
configflags:
- --with-ld-opt="-Wl,-rpath,/usr/local/lib/"
- --add-module=/path/to/snapcraft.yaml/stage/ngx_devel_kit
- --add-module=/path/to/snapcraft.yaml/stage/lua-nginx-module
# ...
I hope that helps!
--
Kyle Fazzari (kyrofa)
Software Engineer
Canonical Ltd.
kyle at canonical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/snappy-app-devel/attachments/20160207/77fe9986/attachment.pgp>
More information about the snappy-app-devel
mailing list