Subject: [bug#54396] [PATCH v2] [WIP] gnu: python-notmuch2: Fix build.

From: Tanguy LE CARROUR <[email-masked]>
Date: Wed, 16 Mar 2022 14:46:55 +0100

Hi Liliana,

Quoting Liliana Marie Prikler (2022-03-16 12:28:49)
> Am Mittwoch, dem 16.03.2022 um 12:16 +0100 schrieb Tanguy Le Carrour:
> > The generated contains the expected paths:
> > […]
> > 
> > … but they **always** reference `drv-0`, even if it's not the first
> > build!?
> > For instance:
> > 
> > ```
> > $ cat /tmp/guix-build-python-notmuch2-0.35.drv-6/notmuch-
> > 0.35/bindings/python-
> > cffi/_notmuch_config.py
> > NOTMUCH_VERSION_FILE='/tmp/guix-build-python-notmuch2-0.35.drv-
> > 0/notmuch-0.35/version.txt'
> > NOTMUCH_INCLUDE_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-
> > 0/notmuch-0.35/lib'
> > NOTMUCH_LIB_DIR='/tmp/guix-build-python-notmuch2-0.35.drv-0/notmuch-
> > 0.35/lib'
> > ```
> > 
> > Does it matter?!
> Yes, it does matter.  The cwd you reference will no longer exist when
> the bindings are installed.  The purpose of generating the file is to
> fill it with useful, persisting data,

Oh, I thought it was only used at build time! Sorry, my mistake!

> i.e. (dirname (search-input-file inputs "notmuch.h")) and
> (dirname (search-input-file inputs "libnotmuch.so")).

Unfortunately, I couldn't make those work. :-(

So I ended up with a less "sexy" version:

```
"NOTMUCH_INCLUDE_DIR='" (assoc-ref inputs "notmuch") "/include/notmuch.h" "'\n"
"NOTMUCH_LIB_DIR='" (assoc-ref inputs "notmuch") "/lib/libnotmuch.so" "'"
```

> As for the version file, that should probably be
> set to an error value such as None or NotImplemented or even unset.  It
> does not appear to be currently used and we don't install any such file
> for notmuch.

If I set `NOTMUCH_VERSION_FILE=''`, I get a "file does not exist" error
at build time. So I decided to set it to `/dev/null` instead. Or would
it be better if I patched `notmuch` to create the actual version file?!

Thanks again for your precious help!

-- 
Tanguy