Building darktable master+branch for Windows

I did get MSYS2 installed, I believe correctly, by rerunning commands until all updates were successfully installed. I think I am ready to create darktable exe with MINGW64. but I don’t know how to add jenshannoschwalm’s branch.

git clone https://github.com/jenshannoschwalm/darktable.git         # creates a 'darktable' folder. Delete it first if it already exists
cd darktable                                                        # go into the newly created 'darktable' folder
git checkout gl_recovery_v4                                         # switch to the 'gl_recovery_v4' branch

You download (clone) the entire repository.
Then you select which branch you want to be active (or work on, or use, …).

So a branch sits inside a repository, of many branches / changes / etc…

How it works in the Github world (often, not always), is that if you work on something, you make your own copy of the repository (called a ‘fork’), on which you are free to change and do as you want.

Then, when you have a branch with changes that you think ‘should be in the main one’, you create a pull request, where you say ‘I think this branch on my repository, should be merged in your repository’.

That’s the stage we are currently in. So the code you are looking for, sits in a branch (gl_recovery_v4) on jenshannoschwalm’s Github copy. Not on the real Darktable one, but on jenshannoschwalm’s copy.

To get started, I don’t think you need git pull anywhere. That is used to get updates when you already cloned it before. To keep things simple, I would advise using ‘git clone’ to clone an entire repository, and if you want to start over again, just delete the darktable folder it created and start again.

So, to start building, start mingw64 environment.
Then directly start typing:

rm -rf darktable
git clone https://github.com/jenshannoschwalm/darktable.git
cd darktable
git checkout gl_recovery_v4
pwd

This deletes any darktable folder that is around, download’s jenshannoschwalm’s repository, switch to the branch containing this latest code.
Then, it displays the current directory you are in. Please take note of it and/or write it somewhere, so you know it for later!.

Now, you follow the build instructions that probably start with something like:

git submodule init
git submodule update
rm -rf build
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/darktable ../.
cmake --build .
cmake --install .
cmake --build . --target package

Notice that these steps delete and (re)create a ‘build’ directory, and do the building in that. So that’s also the final location where the installer will be if everything worked.

Note that this assumes you did all the ‘pacman’ commands in mingw64 environment before, and you created / modified the .bash_profile as stated in the build docs.

Msys2/mingw64 changes all the time, so you might also just run into unlucky timing where something breaks or is in an incompatible state. But I don’t think that’s your problem at the moment.

I am running Windows.

Right now there is no darktable folder. Don’t I want to cd to get to home first? And then proceed with

Bill Martz@DESKTOP-U6S1FBL MINGW64 /home
git clone https://github.com/jenshannoschwalm/darktable.git
cd darktable
git checkout gl_recovery_v4

and then

cd home
git clone https://github.com/darktable-org/darktable.git
cd darktable
git submodule init

and proceed with the rest?

To keep it simple, I thought I wouldn’t give more commands than needed. Just see where you end up, do it, and do the pwd command to see where you just created something.

If I ‘start’ a mingw64 session through the icon, I always end up in a certain folder, my ‘home’ folder, so I don’t see a need to change it.

I would never do it the above way. There is a constant flow of fixes in dt master. You would miss them and stay on my code and would not get those fixes (only if I rebased to master)

You should never do that, you will end up pretty soon with a total mess in your git repo.

Correct ways have been described above…

second line should have been

git pull GitHub - jenshannoschwalm/darktable: darktable is an open source photography workflow application and raw developer gl_recovery_v4

1 Like

mingw64 starts in mingw64 folder. That’s why I switch to home folder.

I’m running Windows and I don’t have Ninja.

You should have it…

@hannoschwalm
If I do the above, I’ll be starting in mingw64 folder.

I think you will be in your user folder which is where you want to be … no??

It starts here

Bill Martz@DESKTOP-U6S1FBL MINGW64 ~

Is that command

pacman -S base-devel intltool git

you do the pacman stuff in msys2. THe rest in mingw64…did you follow all the steps when you set up your build environment for the packaging folder for Windows on the DT git?? It would be included by the second line in the screenshot…

My build environment was set up based on method. A here seems to work as advertised for me…

I thought you were referring to when I run mingw64.
If so, what is my user folder?

Do you mean in msys2

pacman -S base-devel
pacman -S base-devel iniltool git
pacman -S mingw-w64-x86_64-{toolchain,cmake,ninja,nsis}
pacman -S git

pacman -S mingw-w64-x86_64-{exiv2,lcms2,lensfun,dbus-glib,openexr,sqlite3,libxslt,libsoup,libavif,libwebp,libsecret,lua,graphicsmagick,openjpeg2,gtk3,pugixml,libexif,osm-gps-map,libgphoto2,flickcurl,drmingw,gettext,python3,iso-codes,python3-jsonschema,python3-setuptools}

pacman -S mingw-w64-x86_64-gmic
lensfun-update-data

And also update .bash_profile with

# Added as per http://wiki.gimp.org/wiki/Hacking:Building/Windows
export PREFIX="/mingw64"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
export PATH="$PREFIX/bin:$PATH"
	
# This would use 6 cores.
export CMAKE_BUILD_PARALLEL_LEVEL="6"

# gphoto2 
export CAMLIBS="/mingw64/lib/libgphoto2/2.5.30/"
export IOLIBS="/mingw64/lib/libgphoto2_port/0.12.1/"

We are circling the bowl here… So as for your comment you don’t have ninja…you should if you followed all the pacman steps and you do that in msys2. Do this from the opening prompt. The user folder I mentioned is home but its under the “home” directory structure so I was trying to clarify the actual directory… So if you do cd ~ it will go to home aka /home/Bill Martz this is where your darktable folder should be or at least by default…

I have

image

Lot of topics going through each other now.

You are building a version from the current gl_version_v4 branch, which isn’t in main darktable yet.
So as I see it, you are temporarily making a custom build for one certain feature. The moment that feature gets accepted into Darktable, you should switch to using normal Darktable builds again (otherwise you would miss stuff as pointed out).

Maybe also good to point out that there are builds around for Windows with this code alreadyt in it. You don’t have to build yourself. Maybe safes you the hassle. If you want to learn, then bite through it :wink: .

Now, as you start a mingw64 session, you end up in your homefolder.
If you do the commands as I said

rm -rf darktable
git clone https://github.com/jenshannoschwalm/darktable.git
cd darktable
git checkout gl_recovery_v4
pwd

you get a ‘darktable’ folder in that home folder, and you ‘cd’ into the new darktable folder.
The ‘pwd’ command will show you what the current directory is.

You can then start doing the build commands (starting with a git submodule init), since you are already in the darktable folder.

If you want to stop and continue later, you need to go back to the darktable folder. That is why I gave pwd and told you to note the directory you are in at that moment.

The moment the highlight-recovery code is accepted and in the main darktable repository, you should change the git clone command to make a clone from the official darktable repo, and you then can forget about the git checkout command to switch branches, it’s not needed at that point.

But for now, the most simple way to get up and running from scratch is to install msys2, do all the pacman commands as stated in the build instructions, change the .bash_profile file as stated in the build instructions… now close the mingw64 session, start it again, and start typing the commands I listed.

Since your level of git understanding, this seems to be a perfectly valid and simple way to get the highlight recovery code locally and build it. Since you are just building it a few times, this is fine. In my opinion.

I have been using the windows insider updates to update to the latest version each week, but that won’t have the hl recovery. So I wanted to build my own until it does or until the master branch has it.

Once I start building, I work until it is completed.

@priort said:

second line should have been

git pull https://github.com/jenshannoschwalm/darktable.git gl_recovery_v4

You split it. Who’s right?

Hi all, please do not give advice to mess with ~/.bash_profile. It’s properly set up by the MSYS2 installer and everything works OOTB.

1 Like

We have also established last year when Bill tried this once already that he should not have and should not use a user folder with a space in it. Let’s avoid the deja vu please and try to actually learn something and not just blindly repeat shell commands ad infinitum.