Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Building Release Binaries

Jan-Willem Maessen edited this page May 27, 2014 · 28 revisions

The psol/ directory includes just the parts of mod_pagespeed that ports need in order to build. By preparing it for people we can let others build with a much simpler flow.

First we take a mod_pagespeed checkout and extract the headers and a few source files into a new psol directory. Prepare a local mod_pagespeed checkout and build it. Follow build psol from source but stop when it asks you to check out ngx_pagespeed. You'll need to change the tag in the gclient config to the one of the release you're doing. Run the build process twice, once with BUILDTYPE=Debug and once with BUILDTYPE=Release.

To check that this worked ok, run:

grep '^#define MOD_PAGESPEED_VERSION_STRING' /path/to/mod_pagespeed/src/out/*/obj/gen/net/instaweb/public/version.h

You should see that both the Debug and Release versions have the right version, which is the version you're trying to release.  If that's 1.5.27.2 you would expect to see:

/path/to/mod_pagespeed/src/out/Debug/obj/gen/net/instaweb/public/version.h: #define MOD_PAGESPEED_VERSION_STRING "1.5.27.2"
/path/to/mod_pagespeed/src/out/Release/obj/gen/net/instaweb/public/version.h: #define MOD_PAGESPEED_VERSION_STRING "1.5.27.2"

Now get an ngx_pagespeed checkout and run the trunk-tracking version of prepare_psol.sh to get the headers:

git clone https://github.com/pagespeed/ngx_pagespeed.git
cd ngx_pagespeed
git checkout [branch]
scripts/prepare_psol.sh /path/to/mod_pagespeed/src/

Note that your mod_pagespeed checkout actually needs to be named "mod_pagespeed", so create a symlink with that name if necessary. If you're making a normal release then [branch] would be trunk-tracking. If you're making a point release, like 1.7.30.2 to update 1.7.30.1, then [branch] would be the branch name of the previous release in that series, like release-1.7.30.1-beta.

This will create a psol directory that has headers and a few source files.

Next we need to populate psol/lib, which means building binaries.  If you pacakge builds went according to plan, that should already have happened on your two CentOS5 VMs, and you should find the appropriate files on gelato.cbf:release/1.2.3.4/psol. You'll see something like this:

gelato$ find release/1.2.3.4/psol -type f
release/1.8.31.3/psol/lib/Release/linux/x64/pagespeed_js_minify
release/1.8.31.3/psol/lib/Release/linux/x64/pagespeed_automatic.a
release/1.8.31.3/psol/lib/Release/linux/ia32/pagespeed_js_minify
release/1.8.31.3/psol/lib/Release/linux/ia32/pagespeed_automatic.a
release/1.8.31.3/psol/lib/Debug/linux/x64/pagespeed_automatic.a
release/1.8.31.3/psol/lib/Debug/linux/ia32/pagespeed_automatic.a

If that's true, you can just:

rsync -a psol gelato.cbf:release/1.2.3.4/psol

and then create the .tar file on gelato as described in the last set of commands on this page. Otherwise you should read on.

We want to build these on a linux system running a toolchain at least as old as any we might want to distribute to. A CentOS 5 VM is good here, because that's going to be running GCC 4.1. We want both 32 and 64 bit binaries, so you need two VMs.

On each VM, build PSOL from source stopping once you have pagespeed_automatic.a. Check if you have a Release version of pagespeed_automatic.a available from creating the release in the first place:

find . -name pagespeed_automatic.a -ls

If not, build specify BUILDTYPE=Release. If you do, you can proceed to the next step, but you'll probably need to come back here to build the Debug version later.

Now the two VMs have all the Release binaries built. Use scp to copy them down to your system:

scp hostname-32-bit:mod_pagespeed/src/pagespeed_automatic.a \
   /path/to/your/new/psol/lib/Release/linux/ia32/
scp hostname-64-bit:mod_pagespeed/src/pagespeed_automatic.a \
   /path/to/your/new/psol/lib/Release/linux/x64/

Then on each VM, start over to make Debug builds. This is:

$ cd ~/mod_pagespeed/src/net/instaweb/automatic
$ make clean
$ cd ~/mod_pagespeed/src

Then run make again, as in the build doc, but with BUILDTYPE=Debug. Continue with the doc from there, and when you build in net/instaweb/automatic you should also use a BUILDTYPE=Debug argument with make all.

Run the same scps again, this time to lib/Debug/....

If you built this off of tag 1.2.3.4 then tar it up as:

find psol/lib -name '*.a' | xargs -n 1 ranlib
tar -cvf 1.2.3.4.tar psol/
gzip --best 1.2.3.4.tar

Now we need to test that our new psol directory works. If there isn't already a branch for tracking this release, make one and get it building against this svn tag. Then on both the 64 bit and 32 bit VMs build nginx following the installation instructions, using the release-tracking branch and the psol/ you built. Make sure it passes tests. Then repeat the building from the ./configure step, this time specifying --with-debug to make sure that the debug binaries are good too.

Clone this wiki locally