loader/Makefile is broken in 1.4rc1

View: New views
6 Messages — Rating Filter:   Alert me  

loader/Makefile is broken in 1.4rc1

by Devrim GÜNDÜZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

loader/Makefile is broken AFAICS. It does not honor DESTDIR , as it used
to do in 1.3.6. Here is a diff between 1.3.6 Makefile and 1.4.0rc1 one:

 install: all
- @mkdir -p $(DESTDIR)$(bindir)
- $(INSTALL_BIN) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
- $(INSTALL_BIN) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
+ @cp $(PGSQL2SHP) $(PGSQL_BINDIR)/$(PGSQL2SHP)
+ @cp $(SHP2PGSQL) $(PGSQL_BINDIR)/$(SHP2PGSQL)
 

which results in:

make[2]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/postgis'
make -C loader install
make[2]: Entering directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/loader'
cp: cannot create regular file `/usr/bin/pgsql2shp': Permission denied
make[2]: *** [install] Error 1
make[2]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/loader'
make[1]: *** [loaderdumper-install] Error 2
make[1]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1'
error: Bad exit status from /var/tmp/rpm-tmp.MmIpx5 (%install)

See cp part -- it does not honor DESTDIR parameter.

Also, why are these hardcoded in the same Makefile?

# PostgreSQL frontend CPPFLAGS and LDFLAGS (for compiling and linking with libpq)
PGSQL_FE_CPPFLAGS=-I/usr/local/pgsql/8.3/include
PGSQL_FE_LDFLAGS=-L/usr/local/pgsql/8.3/lib -lpq

# PostgreSQL executable directory
PGSQL_BINDIR=/usr/local/pgsql/8.3/bin

Regards,


--
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com 
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                   http://www.gunduz.org


_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

signature.asc (204 bytes) Download Attachment

Re: loader/Makefile is broken in 1.4rc1

by Kevin Neufeld :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Devrim,

Mark will be able to explain the change to the Makefile in more detail,
but in short, as of 1.4 PostGIS no longer uses the --prefix option
during configure so there is no DESTDIR.  Rather, it installs in the
same directory as the detected (or specified) PostgreSQL directory.  The
CPPFLAGS are not hard coded as you perceive.  There is a Makefile.in
file that configure uses to generate the actual Makefile.

http://trac.osgeo.org/postgis/browser/branches/1.4/loader/Makefile.in#L22

The /usr/local/pgsql/8.3/ path you have is the location of your detected
(or specified) postgresql installation.  I don't know why the the shape
loader program is trying to install to /usr/bin/, that looks like a bug
... you should see it go to /usr/local/pgsql/8.3/bin.

Clear as mud?
Cheers,
Kevin

Devrim GÜNDÜZ wrote:

> Hi,
>
> loader/Makefile is broken AFAICS. It does not honor DESTDIR , as it used
> to do in 1.3.6. Here is a diff between 1.3.6 Makefile and 1.4.0rc1 one:
>
>  install: all
> - @mkdir -p $(DESTDIR)$(bindir)
> - $(INSTALL_BIN) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
> - $(INSTALL_BIN) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
> + @cp $(PGSQL2SHP) $(PGSQL_BINDIR)/$(PGSQL2SHP)
> + @cp $(SHP2PGSQL) $(PGSQL_BINDIR)/$(SHP2PGSQL)
>  
>
> which results in:
>
> make[2]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/postgis'
> make -C loader install
> make[2]: Entering directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/loader'
> cp: cannot create regular file `/usr/bin/pgsql2shp': Permission denied
> make[2]: *** [install] Error 1
> make[2]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1/loader'
> make[1]: *** [loaderdumper-install] Error 2
> make[1]: Leaving directory `/home/devrim/rpm/BUILD/postgis-1.4.0rc1'
> error: Bad exit status from /var/tmp/rpm-tmp.MmIpx5 (%install)
>
> See cp part -- it does not honor DESTDIR parameter.
>
> Also, why are these hardcoded in the same Makefile?
>
> # PostgreSQL frontend CPPFLAGS and LDFLAGS (for compiling and linking with libpq)
> PGSQL_FE_CPPFLAGS=-I/usr/local/pgsql/8.3/include
> PGSQL_FE_LDFLAGS=-L/usr/local/pgsql/8.3/lib -lpq
>
> # PostgreSQL executable directory
> PGSQL_BINDIR=/usr/local/pgsql/8.3/bin
>
> Regards,
>
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel@...
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>  
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: loader/Makefile is broken in 1.4rc1

by Devrim GÜNDÜZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Sat, 2009-07-04 at 09:05 -0700, Kevin Neufeld wrote:

> Mark will be able to explain the change to the Makefile in more
> detail,  but in short, as of 1.4 PostGIS no longer uses the --prefix
> option during configure

Why?

> so there is no DESTDIR.  Rather, it installs in the
> same directory as the detected (or specified) PostgreSQL directory.

Why was it changed? Why do I have to install PostGIS under PostgreSQL
directory? I believe RPM/deb/whatever users will want to stick with FHS.

> The CPPFLAGS are not hard coded as you perceive.  There is a
> Makefile.in  file that configure uses to generate the actual
> Makefile.
>
> http://trac.osgeo.org/postgis/browser/branches/1.4/loader/Makefile.in#L22
>
> The /usr/local/pgsql/8.3/ path you have is the location of your
> detected (or specified) postgresql installation.  

I don't have such a directory. I'm not sure how it was detected .

> I don't know why the the shape loader program is trying to install
> to /usr/bin/, that looks like a bug
> ... you should see it go to /usr/local/pgsql/8.3/bin.

See above :)

Regards,
--
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com 
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                   http://www.gunduz.org


_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

signature.asc (204 bytes) Download Attachment

Re: loader/Makefile is broken in 1.4rc1

by Mark Cave-Ayland-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Devrim GÜNDÜZ wrote:

>> Mark will be able to explain the change to the Makefile in more
>> detail,  but in short, as of 1.4 PostGIS no longer uses the --prefix
>> option during configure
>
> Why?
>
>> so there is no DESTDIR.  Rather, it installs in the
>> same directory as the detected (or specified) PostgreSQL directory.
>
> Why was it changed? Why do I have to install PostGIS under PostgreSQL
> directory? I believe RPM/deb/whatever users will want to stick with FHS.
The main reason there is no --prefix option anymore is because PostGIS
1.4 delegates file locations/building to PGXS, and so is no longer
responsible for knowing the final locations of files.

There are two reasons for going with PGXS: firstly, different
distributions have different directory structures for storing their
files; so tying everything into PostgreSQL means once PostgreSQL works,
everything else just works. Secondly, any changes in the PostgreSQL
Makefiles are automatically picked up via PGXS which saves us having to
maintain the whole set of randomly-hacked PostgreSQL Makefiles ourselves
(including supporting new platforms as and when they occur).

Now the issue here is that PGXS doesn't handle building front-end
executables, and various experiments I tried to make this work failed
miserably and so a non-PGXS version was devised. However, as you quite
rightly point out, we need to know DESTDIR just in case we are building
out of the tree...

So please can you try the attached patch? Basically we include the PGXS
file in the loader Makefile but then override all of the interesting
targets with the non-PGXS code. This then allows us to tweak the install
and uninstall targets to make use of these variables from PostgreSQL.
This allows a "make install DESTDIR=/tmp" to work correctly on my setup
here.


ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Index: loader/Makefile.in
===================================================================
--- loader/Makefile.in (revision 4256)
+++ loader/Makefile.in (working copy)
@@ -23,9 +23,6 @@
 PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@
 PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@
 
-# PostgreSQL executable directory
-PGSQL_BINDIR=@PGSQL_BINDIR@
-
 # iconv flags
 ICONV_LDFLAGS=@ICONV_LDFLAGS@
 
@@ -36,6 +33,18 @@
 GTK_CFLAGS = @GTK_CFLAGS@
 GTK_LIBS = @GTK_LIBS@
 
+# PGXS information
+#
+# Note that PGXS currently doesn't handle building FE executables, but we need
+# the INSTALL and DESTDIR variables so we can get the correct install paths.
+# Hence we include the PGXS Makefile here, but ensure that we override the
+# 'all' and 'install' targets with the ones we really want to use below.
+PG_CONFIG = @PGCONFIG@
+PGXS := @PGXS@
+include $(PGXS)
+
+
+# The real parts of the Makefile
 all: $(SHP2PGSQL) $(PGSQL2SHP) @GTK_BUILD@
 
 gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI)
@@ -67,12 +76,13 @@
  $(CC) $(CFLAGS) $(ICONV_LDFLAGS) -lm $^ -o $@
 
 install: all
- @cp $(PGSQL2SHP) $(PGSQL_BINDIR)/$(PGSQL2SHP)
- @cp $(SHP2PGSQL) $(PGSQL_BINDIR)/$(SHP2PGSQL)
+ @mkdir -p $(DESTDIR)$(bindir)
+ $(INSTALL) $(PGSQL2SHP) $(DESTDIR)$(bindir)
+ $(INSTALL) $(SHP2PGSQL) $(DESTDIR)$(bindir)
 
 uninstall:
- @rm -f $(PGSQL_BINDIR)/$(PGSQL2SHP)
- @rm -f $(PGSQL_BINDIR)/$(SHP2PGSQL)
+ @rm -f $(DESTDIR)$(bindir)/$(PGSQL2SHP)
+ @rm -f $(DESTDIR)$(bindir)/$(SHP2PGSQL)
 
 clean:
  @rm -f *.o $(SHP2PGSQL) $(PGSQL2SHP)

_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: loader/Makefile is broken in 1.4rc1

by Devrim GÜNDÜZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,

On Sun, 2009-07-05 at 12:57 +0100, Mark Cave-Ayland wrote:
> > Why was it changed? Why do I have to install PostGIS under PostgreSQL
> > directory? I believe RPM/deb/whatever users will want to stick with FHS.

> There are two reasons for going with PGXS: firstly, different
> distributions have different directory structures for storing their
> files; so tying everything into PostgreSQL means once PostgreSQL works,
> everything else just works. Secondly, any changes in the PostgreSQL
> Makefiles are automatically picked up via PGXS which saves us having to
> maintain the whole set of randomly-hacked PostgreSQL Makefiles ourselves
> (including supporting new platforms as and when they occur).

I see, thanks.

> Now the issue here is that PGXS doesn't handle building front-end
> executables, and various experiments I tried to make this work failed
> miserably and so a non-PGXS version was devised. However, as you quite
> rightly point out, we need to know DESTDIR just in case we are building
> out of the tree...
>
> So please can you try the attached patch?

It worked. Package is built cleanly.

Thanks for the quick response.

Regards,
--
Devrim GÜNDÜZ, RHCE
Command Prompt - http://www.CommandPrompt.com 
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                   http://www.gunduz.org

[postgis-loader-makefile.patch]

--- loader/Makefile.in.old 2009-07-06 00:10:47.000000000 +0300
+++ loader/Makefile.in 2009-07-06 00:12:35.000000000 +0300
@@ -23,9 +23,6 @@
 PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@
 PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@
 
-# PostgreSQL executable directory
-PGSQL_BINDIR=@PGSQL_BINDIR@
-
 # iconv flags
 ICONV_LDFLAGS=@ICONV_LDFLAGS@
 
@@ -36,6 +33,19 @@
 GTK_CFLAGS = @GTK_CFLAGS@
 GTK_LIBS = @GTK_LIBS@
 
+# PGXS information
+#
+# Note that PGXS currently doesn't handle building FE executables, but we need
+# the INSTALL and DESTDIR variables so we can get the correct install paths.
+# Hence we include the PGXS Makefile here, but ensure that we override the
+# 'all' and 'install' targets with the ones we really want to use below.
+PG_CONFIG = @PGCONFIG@
+PGXS := @PGXS@
+include $(PGXS)
+
+# The real parts of the Makefile
+
+
 all: $(SHP2PGSQL) $(PGSQL2SHP) @GTK_BUILD@
 
 gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI)
@@ -67,12 +77,13 @@
  $(CC) $(CFLAGS) $(ICONV_LDFLAGS) -lm $^ -o $@
 
 install: all
- @cp $(PGSQL2SHP) $(PGSQL_BINDIR)/$(PGSQL2SHP)
- @cp $(SHP2PGSQL) $(PGSQL_BINDIR)/$(SHP2PGSQL)
+ @mkdir -p $(DESTDIR)$(bindir)
+ $(INSTALL) $(PGSQL2SHP) $(DESTDIR)$(bindir)
+ $(INSTALL) $(SHP2PGSQL) $(DESTDIR)$(bindir)
 
 uninstall:
- @rm -f $(PGSQL_BINDIR)/$(PGSQL2SHP)
- @rm -f $(PGSQL_BINDIR)/$(SHP2PGSQL)
+ @rm -f $(DESTDIR)$(bindir)/$(PGSQL2SHP)
+ @rm -f $(DESTDIR)$(bindir)/$(SHP2PGSQL)
 
 clean:
  @rm -f *.o $(SHP2PGSQL) $(PGSQL2SHP)



_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

signature.asc (204 bytes) Download Attachment

Re: loader/Makefile is broken in 1.4rc1

by Mark Cave-Ayland-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Devrim GÜNDÜZ wrote:

>> Now the issue here is that PGXS doesn't handle building front-end
>> executables, and various experiments I tried to make this work failed
>> miserably and so a non-PGXS version was devised. However, as you quite
>> rightly point out, we need to know DESTDIR just in case we are building
>> out of the tree...
>>
>> So please can you try the attached patch?
>
> It worked. Package is built cleanly.
>
> Thanks for the quick response.

No worries, thanks for testing. I've applied the patch to 1.4 branch and
trunk.


ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel