You may directly download all of the source code of the lastest release at https://github.com/postgrespro/pgsphere/releases/latest.
You can find the development source code of pgSphere on Github, presently as the master branch of https://github.com/postgrespro/pgsphere.
You will need PostgreSQL version 9.1 or above. Next to downloading and extracting the source tree, you will need to install the server development packages for PostgreSQL (or you could also compile and install PostgreSQL itself from souce.) For Linux, these packages typically have names such as postgresql-devel or postgresql-server-dev-9.x. To compile pgSphere, run the follwing commands in its source directory:
USE_PGXS=1 make
sudo USE_PGXS=1 make install