Download raw body.
Correctly create a symbolic link in a port
>>>> 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"
>
> Thank you very much; this worked for me. However, I've encountered
> another issue: I'm unable to set the owner and group for the directories
> created by the Makefile. I've tried several approaches:
>
> 1. Adding the -o and -g options to ${INSTALL_DATA} and ${INSTALL_DATA_DIR}.
>
> 2. Directly adding chown commands to the post-install section.
>
> 3. Adding @owner and @group to the PLIST file.
>
> None of these methods have successfully set the owner and group of the
> directories to the daemon user and group. The directories consistently
> end up with root as the owner and wheel as the group. I don't want to
> use the -m 777 option, as that would be insecure.
I was finally able to resolve the issue with the permissions on the
directories created by this port. The problem was that I had not
included a trailing slash (/) at the end of the listed directories when
running the @sample command in the packing-list (PLIST). Without the
slash, the system does not recognize it as a directory and fails to set
the permissions correctly. I think it would be helpful if, when
executing the make plist or make update-plist commands, the system could
alert you to any directories that are not correctly listed, as this is
something you might easily overlook without carefully reading the
documentation.
>
>>
>>> 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
>>>
>>
>
> I have attached the current state of the port to this email.
Correctly create a symbolic link in a port