Subject: Best way to handle git submodules in APKBUILDs?

From: Camelia Lavender <[email-masked]>
Date: Fri, 29 Aug 2025 18:26:04 +0200

Hi everyone!

I'm relatively new to Alpine Linux packaging, but I'm trying to learn 
more about it by packaging a few pieces of software that aren't yet 
included in Alpine repositories. I really hope I ask my question in the 
correct place (I tried looking on the Wiki but didn't find any 
information about this) :)

I was wondering what the best way to package projects that rely on git 
submodules was. The problem with submodules is that they usually aren't 
included in release tarballs. Also, since the "primary" source of the 
package is a tarball, it is not possible to use git to automatically 
pull submodules from their upstream repositories, which, in the end, 
makes it (I guess) necessary to add many different sources in the APKBUILD.

What I've been thinking about doing is this:

- For each submodule, I add a source in the APKBUILD, which points to 
the source tarball of the specific commit that is checked out in the 
repository.
- Then, I move the content of the tarball to the place where the content 
of the submodule should be.

Is this a correct way to do what I'm trying to achieve, or is there a 
better way to do so?

Thanks in advance! :)
-- 
Sincerely,

Camelia Lavender (she/they)
PGP: 0xDBCC70EFBC360E97

---

From: Naomi Rennie-Waldock <[email-masked]>
Date: Fri, 29 Aug 2025 17:35:00 +0100

On 29 August 2025 17:26:04 BST, Camelia Lavender <[email-masked]> wrote:
>Hi everyone!
>
>I'm relatively new to Alpine Linux packaging, but I'm trying to learn more about it by packaging a few pieces of software that aren't yet included in Alpine repositories. I really hope I ask my question in the correct place (I tried looking on the Wiki but didn't find any information about this) :)
>
>I was wondering what the best way to package projects that rely on git submodules was. The problem with submodules is that they usually aren't included in release tarballs. Also, since the "primary" source of the package is a tarball, it is not possible to use git to automatically pull submodules from their upstream repositories, which, in the end, makes it (I guess) necessary to add many different sources in the APKBUILD.
>
>- For each submodule, I add a source in the APKBUILD, which points to the source tarball of the specific commit that is checked out in the repository.
>- Then, I move the content of the tarball to the place where the content of the submodule should be.
>
>Is this a correct way to do what I'm trying to achieve, or is there a better way to do so?
>
>Thanks in advance! :)
>-- 
>Sincerely,
>

That approach is what we've been doing for other packages where upstream doesn't provide a full source archive.

---

From: "Achill Gilgenast" <[email-masked]>
Date: Fri, 29 Aug 2025 18:47:50 +0200

> Hi everyone!

Hey!

> submodules was. The problem with submodules is that they usually aren't 

*usually* they are. For example, `meson dist` pacakges all the
sub*projects* into the tarball. But of course, there are exceptions, e.g.
GitHub-generated tarballs.

> Is this a correct way to do what I'm trying to achieve, or is there a 

This is usually done, yeah. See https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/chatterino2/APKBUILD
as a random example.

But note, that it might depend on the kind of submodule, since Alpine
package are preferred as dependencies and not the vendored ones. For
assets and stuff, or forks of packages (as in the chatterino2 example),
that should be fine tho.

> Thanks in advance! :)

Thank you so much for being interested in Alpine packaging! If you have
any other questions, dont hesitate to ask me :)