pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Set install_name to fix devel/mustach on macOS

Sijmen Mulder <> writes:

>> Longer term, it would be nice to have some higher-level declarative
>> workaround.  I suppose this is either a bug in upstreams or a bug in
>> macos (is install_name covered by any standards?) depending on how you
>> look at it :-)

What I mean is to have some pkgsrc mechanism to set a variable like


and have pkgsrc automatically do what you have done in the patch.  I'm
not sure how many cases there are where upstream doesn't do the
macos-right thing.

> It's used to add the installed library's location to the list of library
> search paths of macOS binaries (at link time):
>   An install name is just a pathname embedded within a dynamic library
>   which tells the linker where that library can be found at runtime.
>   For example, libfoo.dylib might have an install name of
>   /usr/lib/libfoo.dylib. This install name gets copied into the
>   application at link time. When the dynamic linker goes looking for
>   libfoo.dylib at runtime, it will fetch the install name out of the
>   application and know to look for the library in /usr/lib.
> So it's a different mechanism, one any install target for projects
> wanting to support macOS should account for (so yes, upstream).

Good luck with upstreams!

> Index: devel/mustach/Makefile
> ===================================================================
> RCS file: /cvsroot/pkgsrc/devel/mustach/Makefile,v
> retrieving revision 1.2
> diff -u -r1.2 Makefile
> --- devel/mustach/Makefile	25 Dec 2019 17:34:31 -0000	1.2
> +++ devel/mustach/Makefile	27 Dec 2019 18:46:58 -0000
> @@ -15,5 +15,15 @@
>  # Workaround is portable, might as well use it everywhere.
> +# install_name must be set on macOS. Upstream PR:
> +#
> +.if ${OPSYS} == "Darwin"
> +.PHONY: fix-darwin-install-name
> +post-install: fix-darwin-install-name
> +fix-darwin-install-name:
> +	install_name_tool -id ${PREFIX}/lib/ \
> +	    ${DESTDIR}${PREFIX}/lib/
> +.endif
> +
>  .include "../../textproc/json-c/"
>  .include "../../mk/"

Interesting that it is .so and not .dylib.

Assuming you actually built the package and built some depending package
that worked, that looks fine -- please go ahead and commit it.

Home | Main Index | Thread Index | Old Index