Monday, September 02, 2024

Re: Correctly create a symbolic link in a port

On 2024/09/02 00:32, Lucas Gabriel Vuotto wrote:
> On Sun, Sep 01, 2024 at 07:30:57PM GMT, David Uhden Collado wrote:
> > Hello everyone,
> >
> > I am currently working on porting a BitTorrent client designed to run on the
> > I2P network. While I originally intended to prioritize porting other tools,
> > such as the Monero CLI [1] and SimpleX Chat CLI [2] [3], I unfortunately ran
> > into challenges that were too complex for me to solve. Although I received
> > some help with the Monero port, we were unable to achieve a fully functional
> > result.
> >
> > At this point, I am focusing on this BitTorrent client, as I find it very
> > useful to be able to run it as a background service on torrent seeding
> > servers. However, I have encountered a specific problem that I have yet to
> > resolve: in order to enable the command line interface, a symbolic link must
> > be created from the "XD" binary to "XD-CLI". Despite several attempts, I
> > continue to encounter errors when building the package.

don't overthink things.

assuming you mean you want a ${PREFIX}/bin/XD-CLI that links to the
existing XD binary in the same dir then you want something like this
in post-install:

ln -s XD ${PREFIX}/bin/XD-CLI

then the usual, clean things from the previous build assuming you
have one, and regen plist. "make clean=fake; make plist"

> This doesn't help much, as you aren't sharing what issues are you
> running into.

...or what was tried.

> There 261 Makefiles that use 'ln -s' according to
>
> find . -type f \( -path './pobj/*' -o -path './mystuff/*' \) -prune -o \
> -name Makefile -exec grep -Fl 'ln -s' {} + | wc -l
>
> Quite a bunch of them do it for linking binaries during the install
> phase. Of those, all the ones I checked do it in the post-install
> target, so maybe you should stick to that pattern. Also, in those cases,
> what I saw is that the links are either cwd -> ${PREFIX}/... or
> ${TRUEPREFIX}/... -> ${PREFIX}/... . Read bsd.port.mk(5), in particular
> the parts for TRUEPREFIX and the section "THE FAKE FRAMEWORK", which
> explicitly addresses symlinks.
>
> Lucas
>

No comments:

Post a Comment