# Best way to patch absolute symlink path in Makefile.am



## tuaris (Jul 12, 2020)

I'm having trouble figuring out how to patch some Makefile.am files to fix the symlink paths during staging, `make stage-qa` displays these warnings:


```
====> Running Q/A tests (stage-qa)
Warning: Bad symlink '/var/db/glusterd/hooks/1/delete/post/S57glusterfind-delete-post' pointing to an absolute pathname '/usr/local/libexec/glusterfs/glusterfind/S57glusterfind-delete-post.py'
Warning: Bad symlink '/usr/local/sbin/gfind_missing_files' pointing to an absolute pathname '/usr/local/libexec/glusterfs/gfind_missing_files/gfind_missing_files.sh'
Warning: Bad symlink '/usr/local/sbin/glustereventsd' pointing to an absolute pathname '/usr/local/libexec/glusterfs/gfevents/glustereventsd.py'
Warning: Bad symlink '/usr/local/sbin/gluster-eventsapi' pointing to an absolute pathname '/usr/local/libexec/glusterfs/peer_eventsapi.py'
```

For some reason $(DESTDIR) isn't getting prefixed with ${STAGEDIR}.


```
install-data-local:
    $(mkdir_p) $(DESTDIR)$(GLUSTERD_WORKDIR)/glusterfind/.keys
    $(mkdir_p) $(DESTDIR)$(GLUSTERD_WORKDIR)/hooks/1/delete/post/
    rm -f $(DESTDIR)$(GLUSTERD_WORKDIR)/hooks/1/delete/post/S57glusterfind-delete-post
    ln -s $(GLUSTERFS_LIBEXECDIR)/glusterfind/S57glusterfind-delete-post.py \
        $(DESTDIR)$(GLUSTERD_WORKDIR)/hooks/1/delete/post/S57glusterfind-delete-post
```

I tried a few different things like adding MAKE_ENV+=DESTDIR=${STAGEDIR}${PREFIX}  or doing the same with MAKE_ARGS.  I tried adding "USES=pathfix" and "USES=desthack".  None of that seems to have any effect.  

The full port (unfinished) can be found at:








						tuaris/freebsd-glusterfs
					

FreeBSD port for GlusterFS. Contribute to tuaris/freebsd-glusterfs development by creating an account on GitHub.




					github.com
				




An example of one of these Makefile.am files can be found at: 








						glusterfs/Makefile.am at v7.6 · gluster/glusterfs
					

Gluster Filesystem : Build your distributed storage in minutes - glusterfs/Makefile.am at v7.6 · gluster/glusterfs




					github.com
				




The `poudriere testport` log can be found at (ignore the pkg-list errors, I haven't worked on pkg-list yet):


			https://pkg.ny-us.morante.net/poudriere/data/12amd64-default/2020-07-12_04h55m31s/logs/errors/glusterfs-7.6.log


----------



## Jose (Jul 13, 2020)

Similar question recently got asked on the -ports list: https://lists.freebsd.org/pipermail/freebsd-ports/2020-July/118954.html


----------



## tuaris (Jul 16, 2020)

At first glance it looks like I would need to make a patch to change this line in configure.ac:


```
GLUSTERFS_LIBEXECDIR="$(eval echo $libexecdir)/glusterfs"
```

I have a feeling that might have some unwanted effects according to this: 








						Search · GLUSTERFS_LIBEXECDIR · gluster/glusterfs
					

Gluster Filesystem : Build your distributed storage in minutes - Search · GLUSTERFS_LIBEXECDIR · gluster/glusterfs




					github.com
				




So it looks like I will have to use re-install those symlinks using a post-install section in the port, and do something like?


```
rm -f ${STAGEDIR}$(DESTDIR)$(GLUSTERD_WORKDIR)/hooks/1/delete/post/S57glusterfind-delete-post
    ln -s ${STAGEDIR}$(GLUSTERFS_LIBEXECDIR)/glusterfind/S57glusterfind-delete-post.py \
        ${STAGEDIR}$(DESTDIR)$(GLUSTERD_WORKDIR)/hooks/1/delete/post/S57glusterfind-delete-post
```

Or can I instead do a post-configure patch and pre-append ${STAGEDIR} to that line?


----------



## Jose (Jul 16, 2020)

I've never actually done this, so take my advice with a grain of salt. If it was me, I'd try to leave the upstream sources as unmodified as possible to make my life easier during upgrades. I'd re-install the symlinks in the post-install section.


----------

