Nat! bio photo

Nat!

Senior Mull.

Twitter RSS

Github

mulle-bootstrap: Understanding mulle-bootstrap (II), Recursion

Continued from mulle_bootstrap: Understanding mulle-bootstrap mulle-bootstrap is able to resolve nested dependencies. Here is an example, that shows how.

foo went out of fashion. Your project bar needs the new library powerfoo. Interestingly powerfoo depends on foo. Otherwise functionally it's just more of the same - it knows its version number - but it's more modern.

So you modify your code to look like this:

main.c

#include <stdio.h>
#include <powerfoo/powerfoo.h>

main()
{
   printf( "%d\n", powerfoo_version());
}

Since powerfoo depends on foo, you need to get both libraries. Fortunately powerfoo is mulle-bootstrap enabled, so things are really simple.

Observing mulle-bootstrap in recursive action

Since you have .bootstrap/repositories setup already, you just edit it to contain the URL of powerfoo now, which is https://github.com/mulle-nat/powerfoo.git. You remove the URL of foo (important!)

mkdir .bootstrap 2> /dev/null
echo "https://github.com/mulle-nat/powerfoo.git" > .bootstrap/repositories

mulle-bootstrap fetch

mulle-bootstrap fetch will now clone powerfoo from Github into the .repos folder. I will then detect, that there is a .bootstrap folder inside powerfoo and fetch the dependency foo indicated in it's repositories file:

mulle-bootstrap fetch
# Cloning https://github.com/mulle-nat/powerfoo.git ...
# Cloning into '.repos/powerfoo'...
# remote: Counting objects: 17, done.
# remote: Compressing objects: 100% (10/10), done.
# remote: Total 17 (delta 1), reused 13 (delta 1), pack-reused 0
# Unpacking objects: 100% (17/17), done.
# Checking connectivity... done.
# Cloning https://github.com/mulle-nat/foo.git ...
# Cloning into '.repos/foo'...
# remote: Counting objects: 12, done.
# remote: Compressing objects: 100% (8/8), done.
# remote: Total 12 (delta 1), reused 8 (delta 1), pack-reused 0
# Unpacking objects: 100% (12/12), done.
# Checking connectivity... done.

mulle-bootstrap build

mulle-boostrap build knows, that powerfoo depends on foo therefore it will build , install and dispense foo first.

Now powerfoo can be built and the header and library will show up in dependencies.

mulle-bootstrap build
# Let cmake do a Release build of foo for SDK Default in "build/.repos/Release/foo" ...
# CMake Warning:
#  Manually-specified variables were not used by the project:
#
#    DEPENDENCIES_DIR
#
#
# Let cmake do a Release build of powerfoo for SDK Default in "build/.repos/Release/powerfoo" ...
# CMake Warning:
#  Manually-specified variables were not used by the project:
#
#    DEPENDENCIES_DIR
#
#
# Write-protecting dependencies to avoid spurious header edits

Now bar is ready to be built:

cc -c -Idependencies/include main.c
cc -o bar -Ldependencies/lib main.o -lpowerfoo -lfoo

Post a comment

All comments are held for moderation; basic HTML formatting accepted.

Name:
E-mail: (not published)
Website: