Install directory after build?

I am building my first snap application osvr-nofc. Its based off of a script that I wrote to build the software. I have created a part called ‘linux-build’ which runs the script that compiles and builds the many components of the application.

In parts/linux-build/build, I would like the dist directory to be copied into the snap. How do I do this?

linux-build        :
    prepare        : ./prepare.bash
    plugin         : nil 
    stage     : 
        - dist

The stage section tries to copy from parts/linux-build/install/dist

Thank you for your help!

Something like this:

    source: .
    plugin: nil 
    prepare: ./prepare.bash
    install: |
       cp dist/* $SNAPCRAFT_PART_INSTALL 

Don’t forget to state source: . as not specifying it might end up in unpredictable behavior.

install doesn’t do anything. I don’t get any errors either. I can put rubbish in that line and I still don’t get any output. Is there a reason that install doesn’t do anything?

I think I may have figured out the issue … rebuilding now and will report back. I think install is the right scriptlet to use. Thank you.

It seems to have worked. Except now I am getting a symlink error.

package contains external symlinks: lib/

In my build scripts, I do this:

ln -s ${INSTALL_DIR}/lib/x86_64-linux-gnu/ ${INSTALL_DIR}/lib/.

Where INSTALL_DIR is set by the build script which is set by a prepare script in my snapcraft.yaml

-i $(pwd)/build-script/bash_lib

Any ideas of how to fix this? Should I not be using pwd and instead a different environment variable for snaps?

Its weird - 2 out of 3 architctures built. Can someone explain why amd64 failed but the others passed???

you can fix that symlink by using a relative symlink rather than fully-qualified:

ln -s x86_64-linux-gnu/ ${INSTALL_DIR}/lib/

Thank you. Trying that now.

Thank you that worked!