[postgis-users] Building PostGIS from Sunday CVS..without PostgreSQL Sources...OK ! ! !

Jean David TECHER davidtecher at yahoo.fr
Sun Apr 24 10:39:38 PDT 2005


Hi Sandro and PostGIS'ers,

Last Sunday, I decided to compil PostGIS from CVS (form sunday in the afternoon)...

Since the goal is to build PostGIS WITHOUT PostgreSQL sources but from the binairies installed on the computer 
the tests on Windows for me is OK...Successfull...I did it for PG 8.0.2, Geos 2.1.1 and Proj 4.4.9

The only changes -I had to do - were to make few changes on:

-1/ postgis/Makefile.config.in

- 2/postgis/lwgeom/Makefile

- 3/postgis/loader/Makefile

For each file, I used 

ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
     XXXXXXXXX
else
     XXXXXXXXXX 
endif

The changes in files are at the end of this files (sorry, I didn't at enough times to make patch... :-[ ....)
Since i'm not at job on Monday but Tuesday, I will do a resume doc next Tuesday

NOTICE: For creating postgis doc, I need to have docbook-xslt-stylesheets, xlstproc and icon.dll installed on Windows..Nevermind
Just 3 downloading to do.

cvs -d:pserver:cvs at postgis.refractions.net:/home/cvs/postgis login
cvs -d:pserver:cvs at postgis.refractions.net:/home/cvs/postgis co postgis
cd postgis
autoconf
configure --enable-autotconf --with-geos=`which geos-config` 
make
make install
cd regress
make

Regression Tests, Loading some data with the laoder (...) work fine...


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
========================================[postgis/Makefile.config.in ]==============================================================
#---------------------------------------------------------------
# Configuration Directives
#---------------------------------------------------------------

#
# We recommend that you install the Proj4 and GEOS libraries
# referenced below to get the most use out of your PostGIS
# database.

#
# Set USE_PROJ to 1 for Proj4 reprojection support (recommended)
#
# Reprojection allows you to transform coordinate systems
# in the database with the Transform() function.
#
# Download from: http://www.remotesensing.org/proj
#
USE_PROJ=@USE_PROJ@
PROJ_DIR=@PROJ_DIR@

#
# Set USE_GEOS to 1 for GEOS spatial predicate and operator
# support (recommended).
# GEOS installation directory defaults to /usr/local,
# set GEOS_DIR environment variable to change it.
#
# GEOS allows you to do exact topological tests, such as
# Intersects() and Touches(), as well as geometry operations,
# such as Buffer(), GeomUnion() and Difference().
#
# Download from: http://geos.refractions.net
#
USE_GEOS=@USE_GEOS@
GEOS_DIR=@GEOS_DIR@

#
# Set USE_JTS to 1 if you have libjts installed. 
#
USE_JTS=0
JTS_INCLUDES=@JTS_INCLUDES@
JTS_LIBDIR=@JTS_LIBDIR@

#
# Set USE_STATS to 1 for new GiST statistics collection support
# Note that this support requires additional columns in 
# GEOMETRY_COLUMNS, so see the list archives for info or
# install a fresh database using postgis.sql.
# This option is useless for builds against PGSQL>=80 (stats
# are always gathered in that case, and you don't need additional
# columns in geometry_columns).
#
USE_STATS=1

#
# Set AUTOCACHE_BBOX to 0 if you want finer control over
# bounding box computation and caching for your geometries.
# If you do, bbox computattion strategies are listed in
# the file lwgeom/BBOXCACHE_BEHAVIOURS, but don't expect
# them to be easy nor consistent.
#
AUTOCACHE_BBOX=1

#
# Set USE_ICONV to 1 if you want the loader (shp2pgsql)
# to support UTF-8 output.
#
USE_ICONV=0

#
# PGSQL
#
PGCONFIG=@PGCONFIG@
PGFEINCLUDES=@PGFEINCLUDES@
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
PGBEINCLUDES=@PGBEINCLUDES@ @PGBEINCLUDES@/port @PGBEINCLUDES@/port/win32 @PGBEINCLUDES@/port/win32/arpa
else
PGFELIBS=@PGFELIBS@
endif
#
# Docbook
#
XSLBASE=@XSLBASE@

#
# Compilers
#
CC=@CC@
CXX=@CXX@

#
# Other programs
#
FLEX=@FLEX@
YACC=@YACC@
INSTALL=@INSTALL@ -c
INSTALL_DATA=$(INSTALL) -m 644
INSTALL_BIN=$(INSTALL) -m 755
INSTALL_LIB=$(INSTALL) -m 755

#
# PATHS
#
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
datadir=@datadir@
mandir=@mandir@
docdir=@docdir@
libdir=@libdir@
libexecdir=@libexecdir@
MODULE_INSTALLDIR=@MODULE_INSTALLDIR@
LPATH=@LPATH@

#
# DLL 
#
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
 DLSUFFIX=.dll
 DLFLAGS=@DLFLAGS@
else
 DLSUFFIX=@DLSUFFIX@
 DLFLAGS=@DLFLAGS@
endif

#---------------------------------------------------------------
# END OF CONFIGURATION
#---------------------------------------------------------------

# Use JTS instead of GEOS if available
ifeq ($(USE_JTS),1)
 USE_GEOS=0
endif

#---------------------------------------------------------------
# Test the version string and set the USE_VERSION macro
# appropriately.
#
VERSION=$(shell $(PGCONFIG) --version)
ifneq ($(findstring 7.1,$(VERSION)),)
 USE_VERSION=71
else
 ifneq ($(findstring 7.2,$(VERSION)),)
  USE_VERSION=72
 else
  ifneq ($(findstring 7.3,$(VERSION)),)
   USE_VERSION=73
  else
   ifneq ($(findstring 7.4,$(VERSION)),)
    USE_VERSION=74
   else
    USE_VERSION=80
   endif
  endif
 endif
endif


==========================================================================================================================
========================================[ postgis/lwgeom/Makefile ]==============================================================
# Configuration Directives
include ../Makefile.config
include ../Version.config

#---------------------------------------------------------------
# Default missing CXX variable to c++
# 
ifeq ($(CXX),) 
 CXX = c++
endif

#---------------------------------------------------------------
# Shared library parameters.
#
NAME=lwgeom
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
SHLIB           = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
SHLIB_MAJOR     = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
SHLIB_BARE      = lib$(NAME)$(DLSUFFIX)
SHLIB_LINK  =  
else
SHLIB           = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
SHLIB_MAJOR     = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
SHLIB_BARE      = lib$(NAME)$(DLSUFFIX)
SHLIB_LINK  = $(DLFLAGS)
endif

MODULE_FILENAME = $(LPATH)/$(SHLIB)

#---------------------------------------------------------------
# Postgis version and build date
#---------------------------------------------------------------
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
 POSTGIS_VERSION = $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) USE_GEOS=$(USE_GEOS) USE_PROJ=$(USE_PROJ) USE_STATS=$(USE_STATS)
 POSTGIS_LIB_VERSION = $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_MICRO_VERSION)
 POSTGIS_BUILD_DATE := $(shell date -u "+%Y-%m-%d %H:%M:%S")
else
 POSTGIS_VERSION = $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) USE_GEOS=$(USE_GEOS) USE_PROJ=$(USE_PROJ) USE_STATS=$(USE_STATS)
 POSTGIS_LIB_VERSION = $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION).$(SO_MICRO_VERSION)
 POSTGIS_BUILD_DATE := $(shell date -u "+%Y-%m-%d %H:%M:%S")
endif

#---------------------------------------------------------------

override CFLAGS += -g -O2 -fexceptions
override CFLAGS += -fPIC
#override CFLAGS += -I$(srcdir) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"' 
override CFLAGS += -DUSE_VERSION=$(USE_VERSION)
override CFLAGS += -DPOSTGIS_LIB_VERSION='"$(POSTGIS_LIB_VERSION)"'
override CFLAGS += -DPOSTGIS_SCRIPTS_VERSION='"$(SCRIPTS_VERSION)"'
override CFLAGS += -DPOSTGIS_BUILD_DATE='"$(POSTGIS_BUILD_DATE)"'

JTS_OBJ=lwgeom_nojts.o
ifeq ($(USE_GEOS),1)
 override CFLAGS += -I$(GEOS_DIR)/include -DUSE_GEOS
 GEOS_RULES=detect_geos_version
 GEOS_WRAPPER=lwgeom_geos_wrapper.o
 JTS_OBJ=lwgeom_geos.o
 SHLIB_LINK += -lstdc++ -L$(GEOS_DIR)/lib -lgeos
endif

ifeq ($(USE_JTS),1)
 override CFLAGS += -I$(JTS_INCLUDES) -DUSE_JTS
 JTS_WRAPPER=lwgeom_jts_wrapper.o
 JTS_OBJ=lwgeom_jts.o
 SHLIB_LINK += -lgcj -ljts -lstdc++ -L$(JTS_LIBDIR) 
endif

ifeq ($(USE_PROJ),1)
 override CFLAGS += -I$(PROJ_DIR)/include -DUSE_PROJ 
 SHLIB_LINK += -L$(PROJ_DIR)/lib -lproj
endif

override CFLAGS += $(PGBEINCLUDES) -DAUTOCACHE_BBOX=$(AUTOCACHE_BBOX) 

override CXXFLAGS := $(CFLAGS)
# memory debug for gcc 2.91, 2.95, 3.0 and 3.1
# for gcc >= 3.2.2 set GLIBCPP_FORCE_NEW at runtime instead
#override CXXFLAGS += -D__USE_MALLOC

#---------------------------------------------------------------
# Add index selectivity to C flags
#
ifeq ($(USE_STATS),1)
 override CFLAGS += -DUSE_STATS
endif
 
SA_OBJS=measures.o box2d.o ptarray.o lwgeom_api.o lwgeom.o lwpoint.o lwline.o lwpoly.o lwmpoint.o lwmline.o lwmpoly.o lwcollection.o $(GEOS_WRAPPER) $(JTS_WRAPPER) wktunparse.o lwgparse.o wktparse.tab.o lex.yy.o vsprintf.o

OBJS=$(SA_OBJS) liblwgeom.o lwgeom_pg.o lwgeom_debug.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o $(JTS_OBJ) lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o stringBuffer.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_svg.o lwgeom_gml.o lwgeom_triggers.o lwgeom_dump.o

#OTHERS=y.output lex.yy.c wktparse.tab.c wktparse.tab.h lwpostgis.sql
OTHERS=y.output lwpostgis.sql ../lwpostgis.sql postgis_geos_version.h


#---------------------------------------------------------------
# Makefile targets

all: $(GEOS_RULES) $(SHLIB) ../lwpostgis.sql

#------------ It's for Win32 -----------------------------------
$(SHLIB): $(OBJS)
 
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
 dlltool --export-all  --output-def lwgeom.def $(OBJS)
 dllwrap  -o $@ --dllname $@ --def lwgeom.def $(OBJS) $(SHLIB_LINK) -L$(shell pg_config --libdir) -lpostgres
 dlltool --dllname $@  --def lwgeom.def --output-lib liblwgeom.a
else
 $(CC) $(SHLIB_LINK) -o $(SHLIB) $(OBJS)
endif


wktparse.tab.c: wktparse.y
 $(YACC) -vd -p lwg_parse_yy wktparse.y
 mv -f y.tab.c wktparse.tab.c
 mv -f y.tab.h wktparse.tab.h


lex.yy.c: wktparse.lex wktparse.tab.c
 $(FLEX) -Plwg_parse_yy -i -f -o'lex.yy.c' wktparse.lex 

lwgeom_jts_wrapper.o: lwgeom_jts_wrapper.cpp

lwgeom_geos_wrapper.o: lwgeom_geos_wrapper.cpp

lwgeom_geos.o: lwgeom_geos.c profile.h

lwgeom_jts.o: lwgeom_jts.c profile.h

lwgeom_nojts.o: lwgeom_nojts.c

lwgeom_functions_basic.o: lwgeom_functions_basic.c profile.h

# Shared library stuff

../lwpostgis.sql: lwpostgis.sql
 cp lwpostgis.sql ..

lwpostgis.sql: lwpostgis.sql.in
 cpp -P -traditional-cpp -DUSE_VERSION=$(USE_VERSION) $< | sed -e 's:@MODULE_FILENAME@:$(MODULE_FILENAME):g;s:@POSTGIS_VERSION@:$(POSTGIS_VERSION):g;s:@POSTGIS_SCRIPTS_VERSION@:$(SCRIPTS_VERSION):g;s/@POSTGIS_BUILD_DATE@/$(POSTGIS_BUILD_DATE)/g' | grep -v '^#' > $@

install: all install-lwgeom-lib install-lwgeom-scripts

install-lwgeom-scripts:
 @mkdir -p $(datadir)
 $(INSTALL_DATA) lwpostgis.sql $(datadir)/lwpostgis.sql
 $(INSTALL_DATA) ../spatial_ref_sys.sql $(datadir)/spatial_ref_sys.sql

#- This has been copied from postgresql and adapted
install-lwgeom-lib: $(SHLIB)
 @mkdir -p $(MODULE_INSTALLDIR)
 $(INSTALL_LIB) $< $(MODULE_INSTALLDIR)/$(SHLIB)

ifneq ($(PORTNAME), win)
ifneq ($(SHLIB), $(SHLIB_MAJOR))
 cd $(MODULE_INSTALLDIR) && \
 rm -f $(SHLIB_MAHOR) && \
 ln -sf $(SHLIB) $(SHLIB_MAJOR)
endif
ifneq ($(SHLIB), lib$(NAME)$(DLSUFFIX))
 cd $(MODULE_INSTALLDIR) && \
 rm -f $(SHLIB_BARE) && \
 ln -sf $(SHLIB) $(SHLIB_BARE)
endif
endif # not win

uninstall-lib: 
 rm -f $(MODULE_INSTALLDIR)/$(SHLIB)
 rm -f $(MODULE_INSTALLDIR)/$(SHLIB_MAJOR)
 rm -f $(MODULE_INSTALLDIR)/$(SHLIB_BARE)

#----------------------------------------------------------

detect_geos_version: 
 sh ../geos_version.sh $(GEOS_DIR) > postgis_geos_version.h

uninstall-lwgeom-scripts:
 rm -f $(datadir)/postgis/lwpostgis.sql
 rm -f $(datadir)/postgis/spatial_ref_sys.sql

uninstall: uninstall-lib uninstall-lwgeom-scripts

clean-lib:
 rm -f $(SHLIB) $(SHLIB_MAJOR) $(SHLIB_BARE)

clean distclean: clean-lib
 rm -f *.o *.so *.a test $(OTHERS)

maintainer-clean: clean
 rm  -f lex.yy.c wktparse.tab.c wktparse.tab.h

liblwgeom_sa.o: liblwgeom.c
 $(CC) -DSTANDALONE -o $@ -c $<

liblwgeom_sa.so: $(SA_OBJS) liblwgeom_sa.o 
 $(CC) -shared -o $@ $^ 

liblwgeom_sa.a: $(SA_OBJS) liblwgeom_sa.o 
 $(AR) -rc $@ $^ 


test: liblwgeom_sa.so liblwgeom_sa.a test.c
 $(CC) -Wall -lm -g -o test test.c liblwgeom_sa.a 

tsort:
 lorder $(SA_OBJS) | tsort

==========================================================================================================================
========================================[ postgis/loader/Makefile ] ===============================================================
include ../Makefile.config

#
# PostGIS Loader Makefile
#
SHELL = /bin/sh

subdir = contrib/postgis/loader
EXE = 

UNAME = $(shell uname)
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
 EXE = .exe
endif
ifeq ($(findstring MINGW,$(UNAME)),MINGW)
 EXE = .exe
endif

OBJS = shpopen.o dbfopen.o getopt.o

#---------------------------------------------------------------

ifeq ($(USE_ICONV),1)
 override CFLAGS += -DUSE_ICONV
endif

override CFLAGS := -g -Wall -I.. $(CFLAGS) -DUSE_VERSION=$(USE_VERSION)

all: shp2pgsql$(EXE) pgsql2shp$(EXE)

pgsql2shp.o: pgsql2shp.c
 $(CC) $(CFLAGS) $(PGFEINCLUDES) -c $<

pgsql2shp$(EXE): $(OBJS) pgsql2shp.o PQunescapeBytea.o
 
ifeq ($(findstring MINGW,$(MSYSTEM)),MINGW)
 $(CC) $(CFLAGS) $(OBJS) PQunescapeBytea.o pgsql2shp.o $(LDFLAGS) $(shell pg_config --libdir)/libpq.a -o $@
else
 $(CC) $(CFLAGS) $(PGFELIBS) $(OBJS) PQunescapeBytea.o pgsql2shp.o $(LDFLAGS) -o $@ 
endif


shp2pgsql$(EXE): $(OBJS) shp2pgsql.o
 $(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@ 

install: all
 @mkdir -p $(bindir)
 $(INSTALL_BIN) pgsql2shp$(EXE) $(bindir)/pgsql2shp$(EXE)
 $(INSTALL_BIN) shp2pgsql$(EXE) $(bindir)/shp2pgsql$(EXE)

uninstall:
 rm -f $(bindir)/pgsql2shp$(EXE)
 rm -f $(bindir)/shp2pgsql$(EXE)

clean:
 rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(EXE) pgsql2shp$(EXE)


==========================================================================================================================---------------------------------------------------------------
TECHER Jean David
01MAP
e-mail: david at 01map.net
Tél: 04 67 45 60 27
Entreprise: http://www.01map.net
Perso: http://techer.pascal.free.fr/postgis/
---------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050424/a97961cf/attachment.html>


More information about the postgis-users mailing list