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

Building PSOL From Source

Jeff Kaufman edited this page Jul 8, 2013 · 44 revisions

Most people will be fine using the binary distribution of PSOL to build ngx_pagespeed the standard way but if that isn't working for you or you want to make changes that require changing the PSOL core, then you need to build PSOL from source.

First build mod_pagespeed at the tag we currently work at:

$ mkdir -p ~/bin
$ cd ~/bin
$ svn co http://src.chromium.org/svn/trunk/tools/depot_tools
$ export PATH=$PATH:~/bin/depot_tools
$ mkdir ~/mod_pagespeed
$ cd ~/mod_pagespeed
$ gclient config http://modpagespeed.googlecode.com/svn/tags/1.5.27.3/src
$ gclient sync --force --jobs=1
$ cd src/
$ make AR.host="$PWD/build/wrappers/ar.sh" \
       AR.target="$PWD/build/wrappers/ar.sh" \
       BUILDTYPE=Release \
       mod_pagespeed_test pagespeed_automatic_test

(See mod_pagespeed: build from source if you run into trouble, or ask for help on the mailing list.)

Then build the pagespeed optimization library:

$ cd ~/mod_pagespeed/src/net/instaweb/automatic
$ make CXXFLAGS="-DSERF_HTTPS_FETCHING=0" \
       BUILDTYPE=Release \
       AR.host="$PWD/../../../build/wrappers/ar.sh" \
       AR.target="$PWD/../../../build/wrappers/ar.sh" \
       all

While make all will always report an error, as long as it creates pagespeed_automatic.a you have what you need.

Check out ngx_pagespeed:

$ cd ~
$ git clone https://github.com/pagespeed/ngx_pagespeed.git

Download and build nginx:

$ cd ~
$ # check http://nginx.org/en/download.html for the latest version
$ wget http://nginx.org/download/nginx-1.4.1.tar.gz
$ tar -xvzf nginx-1.4.1.tar.gz
$ cd nginx-1.4.1/
$ MOD_PAGESPEED_DIR="$HOME/mod_pagespeed/src" ./configure \
    --add-module=$HOME/ngx_pagespeed
$ make install

This assumes you put everything in your home directory; if not, change paths appropriately. All paths need to be absolute.

For a debug build, remove the BUILDTYPE=Release option when running make mod_pagespeed_test pagespeed_automatic_test and add the flag --with-debug to ./configure --add-module=....

If you're testing this and don't want to install this as root, which is a good idea, you can use --prefix, as in ./configure --add-module=... --prefix=$HOME/nginx and then nginx will install to a single directory inside your home directory.

Clone this wiki locally