]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Add a new makefile for the third-party libraries.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 5 Apr 2010 18:33:36 +0000 (14:33 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 5 Apr 2010 18:33:36 +0000 (14:33 -0400)
Change the 'lib' target in the main makefile to recurse into the 'lib' directory.
Add 'lp_solve' and 'lp_solve_55' directories to the library .gitignore.
Update the readme with new instructions.

lib/.gitignore
lib/README
lib/makefile [new file with mode: 0644]
makefile

index 7397096ff6ef0670cff318a111ba22d68341f01f..a58bf8801a0532bda4be60c0ec04c126ec7f9c77 100644 (file)
@@ -1 +1,3 @@
+lp_solve
+lp_solve_55
 Shapely
index 61bb6f02654b8ff32ce279f7a6a2620eeab6a842..699a26aebd25a8f6ce90f36b987175f27aba300a 100644 (file)
@@ -1,11 +1,6 @@
-Third-party libraries are stored here. Currently, Shapely is the only
-one we're using which isn't available through package managers.
+Third-party libraries are stored here. Currently, we use Shapely and
+lp_solve (along with its Python bindings). To install them, simply run
+'make' within this directory. You can also run 'make lib' in the
+top-level directory.
 
-Shapely should be downloaded and extracted:
-
-  wget http://pypi.python.org/packages/source/S/Shapely/Shapely-1.0.14.tar.gz
-  tar -xvzf Shapely-1.0.14.tar.gz
-  mv Shapely-1.0.14 Shapely
-  rm Shapely-1.0.14.tar.gz
-  
-This will probably be handled by the makefile.
+You will need GEOS installed for Shapely to work properly.
diff --git a/lib/makefile b/lib/makefile
new file mode 100644 (file)
index 0000000..4115134
--- /dev/null
@@ -0,0 +1,68 @@
+SHAPELY_URL=http://pypi.python.org/packages/source/S/Shapely/Shapely-1.0.14.tar.gz
+LP_SOLVE_LIB_URL=http://downloads.sourceforge.net/project/lpsolve/lpsolve/5.5.0.15/lp_solve_5.5.0.15_source.tar.gz
+LP_SOLVE_PYTHON_URL=http://downloads.sourceforge.net/project/lpsolve/lpsolve/5.5.0.15/lp_solve_5.5.0.15_Python_source.tar.gz
+
+
+all: lp_solve shapely
+
+
+clean:
+       rm -rf lp_solve
+       rm -rf lp_solve_5.5
+       rm -rf Shapely
+       rm -f  *.tar.gz
+
+
+shapely: ./Shapely/setup.py
+
+# We just need to check for any Shapely file here. There
+# is nothing special about setup.py.
+./Shapely/setup.py:
+       if [ ! -d Shapely ]; then                       \
+               wget -O shapely.tar.gz $(SHAPELY_URL);  \
+               tar -xvzf shapely.tar.gz;               \
+               rm shapely.tar.gz;                      \
+               mv Shapely* Shapely;                    \
+       fi;
+
+
+lp_solve: ./lp_solve/liblpsolve55.so ./lp_solve/lpsolve55.so
+
+
+# Patch Makefile.Linux so that it doesn't pass the -l
+# flag to flex. Double dollar signs are required to get
+# a single '$' within a makefile.
+LFLAGS_PATCH = sed -i 's/^LFLAGS = -L -l$$/LFLAGS = -L/'
+./lp_solve/liblpsolve55.so:
+       make lp_solve_lib_src
+       if [ -f lp_solve_5.5/Makefile.Linux ]; then \
+               $(LFLAGS_PATCH) lp_solve_5.5/Makefile.Linux;          \
+               mv lp_solve_5.5/Makefile.Linux lp_solve_5.5/Makefile; \
+       fi;
+       make -C lp_solve_5.5
+       mkdir -p lp_solve
+       mv lp_solve_5.5/lpsolve55/liblpsolve55.so ./lp_solve
+
+
+./lp_solve/lpsolve55.so:
+       make ./lp_solve/liblpsolve55.so lp_solve_python_src
+       cd lp_solve_5.5/extra/Python;                                 \
+       sed -i 's~lpsolve55/bin/\(ux\|win\)32~../lp_solve~' setup.py; \
+       python setup.py build;                                        \
+       mv build/lib.linux-*/* ../../../lp_solve/;
+
+
+lp_solve_lib_src:
+       if [ ! -d lp_solve_5.5 ]; then                           \
+               wget -O lp_solve.tar.gz $(LP_SOLVE_LIB_URL); \
+               tar -xvzf lp_solve.tar.gz;                   \
+               rm lp_solve.tar.gz;                          \
+       fi;
+
+
+lp_solve_python_src: lp_solve_lib_src
+       if [ ! -d lp_solve_5.5/extra ]; then                           \
+               wget -O lp_solve_python.tar.gz $(LP_SOLVE_PYTHON_URL); \
+               tar -xvzf lp_solve_python.tar.gz;                      \
+               rm lp_solve_python.tar.gz;                             \
+       fi;
index 74729735303716524f63a12029e89bf658c6064a..2631b6b11a8ed60dde2a492ca0f2db83bb2879b4 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,7 +1,6 @@
 DB_NAME=census
 DB_USER=postgres
 TIGER_SRID=4269
-SHAPELY_URL=http://pypi.python.org/packages/source/S/Shapely/Shapely-1.0.14.tar.gz
 
 
 # Dark magic. We set these makefile variables to be the result of the
@@ -27,12 +26,7 @@ test:
 
 # Download or check out any third-party libraries.
 lib:
-       if [ ! -d lib/Shapely ]; then                   \
-               wget -O shapely.tar.gz $(SHAPELY_URL);  \
-               tar -xvzf shapely.tar.gz -C lib/    ;   \
-               rm shapely.tar.gz;                      \
-               mv lib/Shapely* lib/Shapely;            \
-       fi;
+       make -C lib/
 
 
 # Remove byte-compiled python code.