Skip to content

Instantly share code, notes, and snippets.

@rnix
Created October 3, 2012 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnix/3824423 to your computer and use it in GitHub Desktop.
Save rnix/3824423 to your computer and use it in GitHub Desktop.
Build PostGIS on Amazon Linux AMI release 2012.03
CUNIT=2.1-2
CUNITD=CUnit-$(CUNIT)
install: required optional
@make -j8 -f PostGIS.makefile
required:
@sudo yum install postgresql postgresql-devel postgresql9-server libxml2-devel make gcc gcc-c++ swig automake autoconf gettext libtool git libcurl-devel numpy python-devel libxslt-devel
optional: CUnit
@sudo yum install ant docbook-utils docbook-style-xsl ImageMagick
CUnit: $(CUNITD)-src.tar.bz2
@tar jxf $^
@cd $(CUNITD); ./configure >../$@.configure.out 2>&1
@cd $(CUNITD); make >../$@.make.out 2>&1
@cd $(CUNITD); sudo make install >../$@.make.out 2>&1
$(CUNITD)-src.tar.bz2:
@curl -L -o $@ 'http://downloads.sourceforge.net/project/cunit/CUnit/$(CUNIT)/$@'
cleandirs:
@make -f PostGIS.makefile cleandirs
clean:
@make -f PostGIS.makefile clean
POSTGIS=2.0.1
PROJ=4.8.0
GEOS=3.3.5
JSON=0.10
GDAL=1.9.1
install: postgis
#
proj: proj-$(PROJ)
json-c: json-c-latest
geos: geos-$(GEOS)
gdal: gdal-$(GDAL)
#
postgis: proj geos json-c gdal postgis-$(POSTGIS)
postgis-$(POSTGIS): postgis-$(POSTGIS).tar.gz
@tar zxf $^
@cd $@; ./configure >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
postgis-$(POSTGIS).tar.gz:
@curl --silent -LO http://postgis.refractions.net/download/$@
#
proj-$(PROJ): proj-$(PROJ).tar.gz
@tar zxf $^
@cd $@; ./configure >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
@cd $@; sudo make install >../$@.install.out 2>&1
proj-$(PROJ).tar.gz:
@curl --silent -LO http://download.osgeo.org/proj/$@
#
geos-$(GEOS): geos-$(GEOS).tar.bz2
@tar jxf $^
@cd $@; CFLAGS=-m64 CPPFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 FFLAGS=-m64 LDFLAGS=-L/usr/lib64/ ./configure --enable-python >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
@cd $@; sudo make install >../$@.install.out 2>&1
geos-$(GEOS).tar.bz2:
@curl --silent -LO http://download.osgeo.org/geos/$@
#
json-c-$(JSON): json-c-$(JSON).tar.gz
@tar zxf $^
@cd $@; ./configure >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
@cd $@; sudo make install >../$@.install.out 2>&1
json-c-$(JSON).tar.gz:
@curl --silent -LO https://github.com/downloads/json-c/json-c/$@
@git clone https://github.com/json-c/json-c.git
json-c-latest:
@git clone https://github.com/json-c/json-c.git json-c-latest
@cd $@ ./autogen.sh >../$@.autogen.out 2>&1 ; ./configure >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
@cd $@; sudo make install >../$@.install.out 2>&1
#
gdal-$(GDAL): gdal-$(GDAL).tar.gz
@tar zxf $^
@cd $@; ./configure >../$@.configure.out 2>&1
@cd $@; make >../$@.make.out 2>&1
@cd $@; sudo make install >../$@.install.out 2>&1
gdal-$(GDAL).tar.gz:
@curl -LO http://download.osgeo.org/gdal/$@
@openssl md5 gdal-1.9.1.tar.gz | awk '{ if ($$NF == "c5cf09b92dac1f5775db056e165b34f5") exit 0; else exit 1}'
cleandirs:
find . -maxdepth 1 -type d -name '[a-z]*' -exec rm -rf {} \;
clean:
rm -rf proj-* geos-* gdal-* json-*
Copy link

ghost commented Oct 31, 2012

I would say that on L38 should be tar jvf (it's a .tar.bz2 not a .tar.gz) and on L1 it's CUNIT=2.1-2 (build dir is 2.1-2 and 2.1.2 tarball doesn't exist)

-j8 seems a little bit aggressive (it brings to me some race conditions on download/compile phase, nothing to "hard" to solve), although it's better for compiling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment