I am using the cmake plugin and am getting stuck at at the install section. I believe it is because the git I am trying to snap uses a python script to complete the build. I have successfully followed many tutorials and this is my first go at packing something outside of a tutorial.
I am sure there is more information I can/need to share but not sure what will help or how to get it posted.
If the python script is called as part of the cmake build then should work correctly, unless it’s using any hardcoded paths that require changing. Otherwise if the build instructions tell you as the builder to execute the python script you might find that you can do so with an override-build script:
parts:
your-part:
...
override-build: |
snapcraftctl build # do the normal cmake plugin's build stuff
python3 some-install-script.py
You will need to check the some-install-script.py to see if it is using hard coded paths or if you can override the install location - you can use $SNAPCRAFT_PART_INSTALL environment variable to access the dynamic installation path from snapcraft.
If you’re still stuck and can share your work in progress and the app’s source, the experts can try to have a poke for you to see what’s up.
If it helps, the Package.py is only used to copy resource files and folders along with the binary all in to the same folder.
The app seems to build fine but just gets stuck in the build folder and nothing gets moved to the install folder when trying to create the snap.
Some but not all of the folders could be packed with the snap while others will be used for user content.
I watched most of the Snapcraft Live videos and I believe I do not need to run the Package.py as I know what folders are needed, but I have not been successful following the guide lines because the install process has not completed.
I also have no problem building and running the app and may need to take a different snap build method such as dump but I am not sure I understand that method any better.
That suggests that the CmakeLists.txt doesn’t supply the installation instructions. I think for this project you might need to use override-build but do not call snapcraftctl build in the script; instead, you need to replicate the plugin’s behaviour yourself. This is not normally required but it seems that the project you’re snapping is unusual.
Something like this might work:
parts:
your-part:
...
override-build: |
cmake -DCMAKE_INSTALL_PREFIX=/usr -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0 $SNAPCRAFT_PART_SRC
cmake --build .
... # your installation steps here