master build help

The simplest way to get the source (and keep it updated) is by first doing a git clone.
You use the command git clone <URL of the remote repository>, where the URL is on the github page, you can copy it into your clipboard (you can use either the SSH or the HTTPS version):

If you don’t specify a directory, the default is the name of the repo:

git clone git@github.com:darktable-org/darktable.git

will check it out to a directory called darktable, a new subdirectory of whatever directory you issued the command in. So, if you issue it in your home, your source will end up in ~/darktable; if you run it in ~/my-git-projects, it will be in ~/my-git-projects/darktable, and if you specify a directory name:

git clone git@github.com:darktable-org/darktable.git my-darktable-source-directory

then it will be in ~/my-darktable-source-directory or ~/my-git-projects/my-darktable-source-directory, depending on where you run it.

You only need to clone once; then you just update it.

To answer your question, the .git subdirectory is in the directory where you cloned the repo. In my case, the path to .git is ~/darktable/.git. It’s not a directory you’ll ever need to enter, it’s where git keeps its admin stuff.

My current build script, based on suggestions from kmilos (you can save this in a build-dt file and make that executable (chmod +x build-dt), and either put it on you path, or reference it by name.

The important part is the rm command and whatever comes after it; the first two (renice, ionice) are only for my convenience to reduce the load on the machine while building.

First, the compiled OpenCL kernels are removed to avoid version problems: rm -rf ~/.cache/darktable/*kernel*.

Then we switch to the repo’s directory (see above): cd ~/darktable.

Since I sometimes build not from the master branch, but some PR’s branch, this script always returns to master: git checkout master.

Then, all local modifications and the output files from the previous build are discarded: git clean -d -f -x.

The next two git commands refresh the sources: git pull --rebase the main ones, git submodule update --init --recursive the submodules.

As the last step before the actual build, the target directory, in my case ~/darktable-master, is removed: rm -rf /home/kofa/darktable-master.

And then we run the build, putting the result in: ./build.sh --prefix /home/kofa/darktable-master --build-type Release --install.

To run darktable: ~/darktable-master/bin/darktable -d common (I put that in a shell script called dt). Change your logging settings (replace -d common) with whatever you prefer.

#!/bin/bash
renice -n 19 -p $$
ionice -c 3 -p $$

rm -rf ~/.cache/darktable/*kernel*

cd ~/darktable
git checkout master
git clean -d -f -x
git pull --rebase
git submodule update --init --recursive
rm -rf /home/kofa/darktable-master
./build.sh --prefix /home/kofa/darktable-master --build-type Release --install

Hope this helps. I’ll be off for a week.