May 11, 2015

Build Your Own p4 for Cygwin


Our Cygwin license has expired and due to the low demand for Cygwin platform builds we are not renewing it. All Cygwin builds have been pulled from our site in compliance with the license. However if you are a stalwart fan of Perforce and Cygwin all is not lost! Let’s look at your options.

Using the Windows p4:

There is a function that many folks in the Perforce community have used for awhile now to avoid installing two p4 executables on their machine. In Cygwin you can add the following function to your .bashrc:

p4() { PWD=$(cygpath -wa .) "/cygdrive/c/Program Files (x86)/Perforce/p4" "[email protected]"; }

This will allow you to use the regular Windows build of p4 from inside of Cygwin.

Roll your own:

You can still get your hands on Cygwin p4 and p4api builds, but it will take a bit more work. Last year we open sourced the command line and API to give people a bit more control over the tools they use. A side effect of this is it means people can also build these tools on any platform they like.

Here at Perforce we use the Jam build system written many moons ago by our founder Christopher Seiwald. To build p4/p4api you’ll need two things:

  1. a copy of the p4 source code
  2. a copy of Jam

Conveniently both of these are located in the Perforce Workshop. Here are the relevant download links:

Grab and build jam.


Now go into the p4 source code and run:

<path to jam>/jam -sOS=CYGWIN p4 <path to jam>/jam -sOS=CYGWIN p4api

Wait a few seconds and you should have a Cygwin based p4 of your very own!