<div dir="ltr">Thank you very much, now it works!</div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-07 17:52 GMT+01:00 Kyle Fazzari <span dir="ltr"><<a href="mailto:kyle.fazzari@canonical.com" target="_blank">kyle.fazzari@canonical.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Nicola,<br>
<span class=""><br>
On 02/06/2016 04:11 PM, Nicola Manica wrote:<br>
> I am newbie about ubuntu snappy. I read the doc, but I was not able to<br>
> find an answer for my problem.<br>
<br>
</span>You're in the right place!<br>
<span class=""><br>
> I am trying to create a snap for nginx.<br>
> The relevant parts of the snapcraft.yaml is<br>
><br>
> parts:<br>
>   nginx:<br>
>     type: autotools-project<br>
>     plugin: autotools<br>
>     source: <a href="http://nginx.org/download/nginx-1.9.7.tar.gz" rel="noreferrer" target="_blank">http://nginx.org/download/nginx-1.9.7.tar.gz</a><br>
>     source-type: tar<br>
>     configflags:<br>
>       - --with-ld-opt="-Wl,-rpath,/usr/local/lib/"<br>
>       - --add-module=ngx_devel_kit<br>
>       - --add-module=lua-nginx-module<br>
>       ...<br>
>      after:<br>
>       - lua-nginx-module<br>
>       - ngx-devel-kit<br>
><br>
> Without the modules it compiles fine.<br>
> My question is about the add-module configflags. The add-module<br>
> directive expects the filesystem path of the module, what is the right<br>
> way to manage it?<br>
<br>
</span>Alright, so from the YAML I'm assuming that lua-nginx-module and<br>
ngx-devel-kit are separate "parts" in the YAML. The problem you're<br>
having is that there's no way to know ahead of time where they will be,<br>
so you can't provide paths to --add-module. The solution to this problem<br>
depends on which version of Snapcraft you're running. If you're running<br>
Snapcraft 2.1 or later, check this out:<br>
<br>
<br>
<a href="https://github.com/ubuntu-core/snapcraft/blob/master/docs/snapcraft-advanced-features.md#putting-your-parts-in-order" rel="noreferrer" target="_blank">https://github.com/ubuntu-core/snapcraft/blob/master/docs/snapcraft-advanced-features.md#putting-your-parts-in-order</a><br>
<br>
Specifically, note that you can use the $SNAPCRAFT_STAGE variable which<br>
will give you a path into the staging directory, where both the<br>
lua-nginx-module and ngx-devel-kit parts will exist before the nginx<br>
part is built thanks to your use of the "after" keyword. So your YAML<br>
will have something like this:<br>
<br>
    # ...<br>
    configflags:<br>
        - --with-ld-opt="-Wl,-rpath,/usr/local/lib/"<br>
        - --add-module=$SNAPCRAFT_STAGE/ngx_devel_kit<br>
        - --add-module=$SNAPCRAFT_STAGE/lua-nginx-module<br>
    # ...<br>
<br>
If, however, you're on Snapcraft 1, the only solution I know of is to<br>
hard-code a path into the staging directory. It doesn't lead to the most<br>
portable YAML, but it works:<br>
<br>
    # ...<br>
    configflags:<br>
        - --with-ld-opt="-Wl,-rpath,/usr/local/lib/"<br>
        - --add-module=/path/to/snapcraft.yaml/stage/ngx_devel_kit<br>
        - --add-module=/path/to/snapcraft.yaml/stage/lua-nginx-module<br>
    # ...<br>
<br>
I hope that helps!<br>
<br>
--<br>
Kyle Fazzari (kyrofa)<br>
Software Engineer<br>
Canonical Ltd.<br>
<a href="mailto:kyle@canonical.com">kyle@canonical.com</a><br>
<br>
<br>--<br>
snappy-app-devel mailing list<br>
<a href="mailto:snappy-app-devel@lists.ubuntu.com">snappy-app-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snappy-app-devel" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/snappy-app-devel</a><br>
<br></blockquote></div><br></div>