Creating port from pre-built package

Stefan Esser se at freebsd.org
Fri Feb 12 07:45:05 UTC 2021


Am 11.02.21 um 18:12 schrieb Shawn Webb:
> On Thu, Feb 11, 2021 at 06:09:52PM +0100, Patrick M. Hausen wrote:
>> Hi all,
>>
>>> Am 11.02.2021 um 18:03 schrieb Chris <portmaster at bsdforge.com>:
>>>
>>> On 2021-02-11 08:26, Shawn Webb wrote:
>>>> Hey all,
>>>> The Splunk universal forwarder for FreeBSD is distributed as a package
>>>> tarball that you can use `pkg add` on. I'm in a position where I'd
>>>> like to create a port of the package so that I can automate certain
>>>> tasks.
>>> Reverse engineer a package? I think that will violate the NDA you
>>> signed. ;-)
>>>
>>> Really. Unless the package is simply a wrapper of a binary blob. You'll
>>> need to *build* the port, as part of the package creation process.
>>> That is, unless I've *completely* misunderstood your intent here. :-)
>>
>> The binary package is provided by the software manufacturer without
>> source code.
>>
>> Still one might want to have a port available so one can put the port
>> in poudriere and have it available in one's own package repo.
>>
> 
> Right, I'm not aiming to recompile the software. I'm looking to simply
> create a new package.txz with the pre-built artifacts included.

I shouldn't be too hard to create a port, just be careful to consider
the architecture dependency of the binary package you are using.

If multiple architectures and OS releases are supported, then you'll
have to create the package name from those parameters and provide
distinfo data for all supported combinations of architecture and
OS release. You can override the name of the DISTINFO_FILE in the
port's Makefile to have separate distinfo files per arch/version.

In the port's Makefile extract the contents of the correct package
into the stage directory, have dummy targets for phases that are not
reuquired (e.g. an empty do-stage to have the stage done marker set
in the ${WRKSRC} directory) and provide a pkg-plist (possibly multiple
variants selected by the PLIST variable, if there are arch/version
specific differences).

Use ONLY_FOR_ARCH and IGNORE to limit the package building to those
architectures and releases that are supported, to prevent package
fall-out messages and to give ports users a reasonable error message
when trying to build the port on an unsupported system.

The generated package will have the meta-data from your port. If
you want to preserve some meta-date from the pre-built package, then
extract it from the extracted distfile, e.g. in the build phase.
Else use NO_BUILD to suppress this and possibly other phases that
are not required (empty dummy targets will do as well).

Regards, STefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20210212/694d4d2f/attachment.sig>


More information about the freebsd-ports mailing list