Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2020 09:49:01 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-ports@freebsd.org
Subject:   Re: Ports from github
Message-ID:  <5bb5cc69-ef90-2285-324f-58e09399d3ef@FreeBSD.org>
In-Reply-To: <3c6205ea-e589-769b-7b12-ee7e6d3fa8ff@missouri.edu>
References:  <3c6205ea-e589-769b-7b12-ee7e6d3fa8ff@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--n1itdvt4nlp8z0QoUnY6Aq4ad1NPPrJWP
Content-Type: multipart/mixed; boundary="1z3YyftSJ556xYoaCcGMRRfrxjCcmkXv7"

--1z3YyftSJ556xYoaCcGMRRfrxjCcmkXv7
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: quoted-printable

On 24/05/2020 03:39, Montgomery-Smith, Stephen wrote:
> Is there a "howto" that explains how to build a port from a project tha=
t
> is on github?  The FreeBSD porters handbook seems to assume a lot of
> knowledge is already understood.

Well, the only thing "different" about porting something from Github, as
opposed to any other distfile location, occurs in the 'fetch' phase --
actually pulling down the distfiles.  Once you've got past that, the
rest of building the port is exactly the same as it would be if you got
the distfiles from anywhere else.

So, minimally a Github using port will set the following variables:

PORTNAME=3D someport
PORTVERSION=3D 1.2.3
DISTVERSIONPREFIX=3D v
USE_GITHUB=3D yes
GH_ACCOUNT=3D someone

and it won't set:

MASTER_SITES
DISTFILES

An example from amongst the ports I maintain is database/pg_citus:

PORTNAME=3D       citus
PORTVERSION=3D    9.3.0
DISTVERSIONPREFIX=3D      v

USE_GITHUB=3D     yes
GH_ACCOUNT=3D     citusdata

=46rom this, the ports can work out that the Github project is:

   https://github.com/citusdata/citus/
                      ^^^^^^^^^
                      GH_ACCOUNT
                                ^^^^^
                                PORTNAME

If you go to that project URL and look at their releases page:

  https://github.com/citusdata/citus/releases

you'll see the list of versions like so:

  v9.3.0
  ^ ^^^^
  | PORTVERSION
  DISTVERSIONPREFIX

That's all that is needed for this port to be able to download a tarball
of the project's sources.

Now, this is about the simplest possible example of what you might need
when pulling sources from Github, and this pattern probably accounts for
the largest fraction of the Github-using ports in the tree.

Beyond that, the next largest fraction will be projects where the
PORTNAME doesn't quite match the GH project URL, or their release tags
specify the version as (eg.) v1_2_3 rather than v1.2.3 -- all just minor
tweaks so the ports can put together the right URL to pull the distfiles
from.

Beyond that is where it can start to get pretty complicated though.
Sometimes a project doesn't create formal releases, or you want to pull
down a code base a few commits beyond the latest release, or the project
uses a lot of different sub-projects linked into its tree from other
github repositories.  Certain programs written in go are pretty
notorious for this, and can end up with huge lists of distfiles.  See
www/gitlab-pages for an example.

Finally, and only if you really want to blow your mind: throw in an
unreasonable number of port options to the mix.  www/nginx is the
pinnacle (or is it nadir?) here.

In general I'd offer the following three pieces of advice when trying to
get to grips with a new area in porting:

  * Find a good example of a port that does something similar and
    blatantly copy it[*].
  * Keep things as simple as possible (but no simpler).
  * Work iteratively: start with something close, and make simple
    minimal changes, one at a time and testing as you go, to get it spot
    on.

[*] The trick here is not to copy a port that does things sub-optimally.
 Sods law has it that if there's a dozen good examples you might copy,
and one bad one, it's the bad one that will seem like the most enticing
prospect.

If in doubt, ask.  It helps if you can provide a concrete example or a
specific context for your questions, and indeed, trying to formulate
such a question will often lead you directly to the answer yourself.

	Cheers,

	Matthew






--1z3YyftSJ556xYoaCcGMRRfrxjCcmkXv7--

--n1itdvt4nlp8z0QoUnY6Aq4ad1NPPrJWP
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEGfFU7L8RLlBUTj8wAFE/EOCp5OcFAl7KNP5fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDE5
RjE1NEVDQkYxMTJFNTA1NDRFM0YzMDAwNTEzRjEwRTBBOUU0RTcACgkQAFE/EOCp
5OfMWA/9Eys+2BuVQLTN2EqYPKtEbGLiRrZVaSIGpH3VtNZs10aUBJfDI590OwWF
TaviE2mKtrwvMWajrv8Q8dNtcklXAawNbgWb13AQB802fDjxUUPa9HJs+KC/DwZP
tsHoY8y4OiOgjhs9l6P2a5CV5KRiGQsqLD572sPOFswRniCVcdnsc6p1m1TOgmj7
Dw1nd4nTJR9ISIadRXhdPeyVrGEzdnOYWHoHjuekdKQNYpBPbclLWu0jwZjr3h0S
LRAQFoCbpXlNC5T9SpX6m/sBed8BCc2puYbnxEPn/mzOmSxnBaLbYIU+CU4fwPqs
sy7txV6mjffcoj0npv4XAeP93z1u7s77ecxyOy0T10m/VvMI+oviihsYSj5PyNxF
mBzGBojmknEsif+T1+rwIlsdnT5AC2VPDhtFNcTBGS7NnDgDCF17omdK5CSIWCwX
XvX1EJDwPSw5ZvSGfXDem4HGs0E3wus7SvryNsFndf1WwObr/0IQmwx3Xs/gctfk
HKjPeTavsxKqn8D5qNPIqN84z8C9k25778IRnF5mmIdMb7fOVMgHfEQGDt40r0s2
FwcJW1y52OgPynS8opXwi+HVpBREBZ9+p7zmb3GjBNwQ3LRMTZUA/GPVtlW8VBMN
QAD9SritFZH17lU5ISmuyiiHYFMFzwi17Q84mHLw86o0GvIJWBU=
=Iuul
-----END PGP SIGNATURE-----

--n1itdvt4nlp8z0QoUnY6Aq4ad1NPPrJWP--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5bb5cc69-ef90-2285-324f-58e09399d3ef>