How to handle git sources with submodules?

  • HI again apologize if this is a stupid question, I am still learning and I haven't found an answer to this in the forum.

    How can I gracefully handle git sources that depend on sub modules?

    say per example this:

    GitHub - GStreamer/gst-plugins-base: 'Base' GStreamer plugins and helper libraries

    It has a submodule called "common" if I create a simple package.mk that pulls the latest hash the compilation fails complaining that I need the sub module.

    I have been dealing with it like this:

    Code
    post_unpack() {
      rm -rf $BUILD/$PKG_NAME-*/
      git clone https://github.com/GStreamer/gst-plugins-base $BUILD/$PKG_NAME-$PKG_VERSION/
      cd $BUILD/$PKG_NAME-$PKG_VERSION/
      git checkout $PKG_VERSION
      git submodule update --init
      cd $ROOT
    }

    But I am not sure if this is the right way to do it since every time I have to recompile because of any change, it clones the repo again, instead of just getting it from the source folder.

    also I am not 100% positive but it seems this also breaks compilation on some libraries.

  • Make another package as dependency which doesn't build anything. It just unpack sources. And you can use them from original package.

    Thanks for the reply, unfortunately I don't think I follow.

    What I understand is, create a package that points to the "commom" sub module and then add it as a dependency? do this for all required sub modules?

    Is there an example anywhere I could check ?