Making a local branch of the ports tree

Scot Hetzel swhetzel at
Thu Apr 26 18:09:17 UTC 2007

On 4/25/07, Bill Moran <wmoran at> wrote:
> I know I've seen this discussed a dozen times, but google is letting me
> down right now.
> Basically, I want to create a private branch of the ports tree for
> scripts and other stuff that isn't suitable to submit back to the main
> ports tree, and use portupgrade and other ports tools to maintain this
> across a bunch of systems that mount their ports tree via NFS.
> My thought is to make /usr/ports/private (or similar) and teach cvsup
> not to blow it away.  Then I just need to make sure that portupgrade
> and other tools see it.
> Does anyone have a HOWTO or list of steps to get this going?  I know
> this has been discussed before but I can't find any reference to it now.

I have the local ports tree setup as follows:

1. Create ${PORTSDIR}/Makefile.local

--${PORTSDIR}/Makefile.local --
SUBDIR+=	local
-- ${PORTSDIR}/Makefile.local --

2. Create ${PORTSDIR}/local/Makefile

-- ${PORTSDIR}/local/Makefile --
SUBDIR += emulators
SUBDIR += games
SUBDIR += graphics
SUBDIR += net
SUBDIR += security
SUBDIR += textproc
SUBDIR += x11

.include <>
-- ${PORTSDIR}/local/Makefile --

3. Then in each subdir listed in ${PORTSDIR}/local/Makefile, create
these two files:

  a. Create ${PORTSDIR}/local/<PKGCATEGORY>/Makefile

    -- ${PORTSDIR}/local/emulators/Makefile --
    COMMENT = Local Emulator Ports

    SUBDIR += linux-wine

    .include <>
    -- ${PORTSDIR}/local/emulators/Makefile --

  b. Create Create ${PORTSDIR}/local/<PKGCATEGORY>/

    -- ${PORTSDIR}/local/emulators/ --

    # Define PKGNAMEPREFIX if you have local ports that may conflict with
    # FreeBSD's port
    #PKGNAMEPREFIX?=	local-

    # LOCALPORTSDIR: Similar to PORTSDIR, but used to define
dependencies between local ports
    -- ${PORTSDIR}/local/emulators/ --

  c. Optional: link all the local/<PKGCATEGORY>/'s together

     cd /usr/ports/local ; for dir in games graphics net security
textproc x11 ; do ln emulators/ ${dir}/ ; done

This setup allows the use of 'make index' to build an INDEX-* file
that contains your local ports.

The benefits to this design is that it allows for easy integration of
local ports into the FreeBSD ports collection without having to define
VALID_CATEGORIES.  It also allows the local ports to be placed into
the appropriate subdir related to their primary PKGCATEGORY.

No electrons were mamed while sending this message. Only slightly bruised.

More information about the freebsd-ports mailing list