You are not logged in.

#1 2014-10-28 21:42:27

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

[SOLVED] ogdi (new), makefile doesn't have DESTDIR

Hello

For the past few days I tried building FlightGear with osgEarth enabled, but it's still failing...

Now I found that I probably need gdal with ogdi support enabled. I didn't find ogdi in the AUR or repos so I started a new PKGBUILD for it.

OGDI: http://ogdi.sourceforge.net/

It seems to have a strange makefile...

First I exported TOPDIR according to the README. This worked and it builds fine, I think. But packaging fails, I think because there is no DESTDIR in the makefile.

It's not really big but I'm really bad at makefiles, so it'd be great if someone could help me with this.
I think we'd have to patch it. Or maybe there's another way ?

Makefile:

# Copyright (C) 1996 Her Majesty the Queen in Right of Canada.
# Permission to use, copy, modify and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies, that
# both the copyright notice and this permission notice appear in
# supporting documentation, and that the name of Her Majesty the Queen
# in Right  of Canada not be used in advertising or publicity pertaining
# to distribution of the software without specific, written prior
# permission.  Her Majesty the Queen in Right of Canada makes no
# representations about the suitability of this software for any purpose.
# It is provided "as is" without express or implied warranty.

EXTRA_INSTALL_TARGETS	=	mk_nonlocal_install_dirs

include $(TOPDIR)/config/common.mak
 
#
# Sub-directories that need to be built
#
subdirs	= external vpflib ogdi contrib

ifneq ($(PROJ_SETTING),external)
subdirs := proj $(subdirs) 
endif

#
# Default target to build everything in all sub-directories
#
all: $(subdirs) 


#
# Target to allow individual sub-directories to be built 
# (e.g.  make cmpts)
#
.PHONY: $(subdirs)
$(subdirs): mkinstalldirs
	cd $@; $(MAKE)

#
# Make the (local) installation directories
#
.PHONY: mkinstalldirs
mkinstalldirs:
	@echo making install dirs using $(MKINSTALLDIR)
	$(MKINSTALLDIR) $(TOPDIR)/lib/$(TARGET)/static
	$(MKINSTALLDIR) $(TOPDIR)/bin/$(TARGET)

#
# Pass specialized targets into the sub-directories
#
.PHONY: $(STANDARD_TARGETS)
$(STANDARD_TARGETS):
	@for i in $(subdirs); do \
	  $(MAKE) --directory $$i $@; \
	done


mk_nonlocal_install_dirs:
	$(MKINSTALLDIR) $(prefix) $(exec_prefix) $(INST_LIB) $(INST_BIN) $(INST_INCLUDE)

My PKGBUILD so far:

# Maintainer: Cem Aydin (rebootl) <cem.aydin@gmx.ch>

#: Attention: Version spelling different in source path
_pkgver_pathname=3.2.0beta2

pkgname=ogdi
pkgver=3.2.0.beta2
pkgrel=1
pkgdesc="Open Geospatial Data Interface - API"
arch=('i686' 'x86_64')
url="http://ogdi.sourceforge.net/"
license=('custom')
depends=('zlib' 'expat' 'proj-old')
makedepends=()
optdepends=()
source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${_pkgver_pathname}/${pkgname}-${pkgver}.tar.gz")
md5sums=('SKIP')

#prepare() {
#  cd "${srcdir}/$pkgname-$pkgver"
#}

build() {
  cd "${srcdir}/${pkgname}-$pkgver"

  #: (acc. to error during build setting -fPIC is needed)
  export CFLAGS="$CFLAGS -fPIC"

  #: setting TOPDIR is required
  export TOPDIR=$PWD

  ./configure --prefix=/usr \
              --with-zlib \
              --with-expat \
              --with-proj
  make
}

package () {
  cd "${srcdir}/${pkgname}-$pkgver"

  make DESTDIR="${pkgdir}" install

# install license
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

Thanks

Edit: grammar, clarify
Edit: Ah, sorry this probably should have gone under "Creating & Modifying Packages".

Edit: See Post #7 for a PKGBUILD. But also note the remark about FlightGear if you're into this. (Basically, it didn't help.)

Last edited by rebootl (2014-11-04 19:17:40)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#2 2014-10-28 23:10:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

There's nothing magic about the name of the DESTDIR variable - though it is a de facto standard.  Just use TOPDIR as that's what the Makefile uses:

make TOPDIR="${pkgdir}" install

This seem appropriate for this subforum.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2014-10-28 23:40:13

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

Thanks for your reply Trilby.

This seem appropriate for this subforum.

Then sorry for the rush.

There's something weird with this.
If I do so I get:

[...]
==> Entering fakeroot environment...
/home/cem/Arch-pkg/ogdi/PKGBUILD: line 4: _pkgver-pathname=3.2.0beta2: command not found
==> Starting package()...
makefile:15: /home/cem/Arch-pkg/ogdi/pkg/ogdi/config/common.mak: No such file or directory
make: *** No rule to make target '/home/cem/Arch-pkg/ogdi/pkg/ogdi/config/common.mak'.  Stop.
==> ERROR: A failure occurred in package().
    Aborting...

I can see

include $(TOPDIR)/config/common.mak

in the makefile.
It seems to expect that the "builddir" and the "install" dir is actually, somewhat, the same, i.e. TOPDIR... (?)

I have to admit that I am somewhat tired and I think I'd better continue another time...

Ah, yes and there's the "error" about the variable I set, but this just goes away if I comment it and write the version in the path... And the other error remains the same.


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#4 2014-10-29 02:34:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

Ah, you're right, sorry.   There's not even an install directive in that makefile anyway - unless it's in the included file.  I tried to experiment with this myself, but the url is bad - do you have an update of the url?

There are likely two approaches: let it install "locally", then copy the contents of the lib and usr folders to ${pkgdest}, or patch the makefile to change some lines' TOPDIR to DESTDIR.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2014-10-29 17:26:27

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

Ok, I used a dash ("-") in my variable for the pathname, which of course is a bad idea, corrected above. I should've known, but didn't notice because the tarball was already downloaded here.

[...] let it install "locally", then copy the contents of the lib and usr folders to ${pkgdest}

That's a good idea. I might be able to do it this way, but I can't do it right now.
(With the beta version, building doesn't work, so maybe I'll have to use another version.)

I'll report back. But please feel free to continue your experiments as well. I'm not even sure if it's really this one, FlightGear w/ osgEarth is needing. But it's included in the Debian gdal package...

Thanks

Edit: corrected miswording

Last edited by rebootl (2014-10-29 17:31:30)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#6 2014-10-30 22:12:43

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

Can I omit 'make install' and just copy the files e.g. using 'install ...' ?

I tried to put DESTDIR in config/common.mak.in but it didn't work.

$ cat destdir.patch 
--- common.mak.in_ORIGINAL	2014-10-30 18:04:39.471425285 +0100
+++ common.mak.in	2014-10-30 18:39:16.322726517 +0100
@@ -73,7 +73,7 @@
 #
 #	Final OS installation location.
 #
-prefix		= /usr/local
+prefix		= $(DESTDIR)/usr/local
 exec_prefix 	= ${prefix}
 INST_INCLUDE	= ${prefix}/include
 INST_LIB	= ${exec_prefix}/lib

I also tried something like:

prefix		= /usr/local
 exec_prefix 	= $(DESTDIR)${prefix}
 INST_INCLUDE	= $(DESTDIR)${prefix}/include
 INST_LIB	= $(DESTDIR)${exec_prefix}/lib

(I don't remember exactly whether I used a slash in between...)

But, in both cases, it still tries to install into /usr/... during package()...

I also tried installing "locally" using 'make install' or 'make TOPDIR=$PWD install' in build() or package(). The same, e.g.:

[...]
cp /home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/bin/Linux/ogdi_import /usr/bin
cp: cannot create regular file ‘/usr/bin/ogdi_import’: Permission denied
/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/config/common.mak:249: recipe for target 'default-install' failed
make[2]: *** [default-install] Error 1
make[2]: Leaving directory '/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/contrib/ogdi_import'
make[2]: Entering directory '/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/contrib/ogdi_info'
cp /home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/bin/Linux/ogdi_info /usr/bin
cp: cannot create regular file ‘/usr/bin/ogdi_info’: Permission denied
/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/config/common.mak:249: recipe for target 'default-install' failed
make[2]: *** [default-install] Error 1
make[2]: Leaving directory '/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/contrib/ogdi_info'
makefile:39: recipe for target 'install' failed
make[1]: *** [install] Error 2
make[1]: Leaving directory '/home/cem/Arch-pkg/ogdi/src/ogdi-3.2.0.beta2/contrib'
makefile:54: recipe for target 'install' failed
make: *** [install] Error 2
==> ERROR: A failure occurred in package().
    Aborting...

The only other idea I have would be to look at the Debian package and try to figure out what they do, or then - give this up.

Edit: clarify

Last edited by rebootl (2014-10-30 22:13:25)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#7 2014-10-31 12:08:34

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: [SOLVED] ogdi (new), makefile doesn't have DESTDIR

Puh, once you find the solution it's actually simple. I looked at the Debian package tongue.

Actually, using prefix with make install worked, i.e.:

TOPDIR="$PWD" make prefix="${pkgdir}/usr" install

Debian package rules file: http://anonscm.debian.org/viewvc/pkg-gr … iew=markup
(L83)

I'll put up the PKGBUILD here, when I've cleaned it up.

Thanks

Edit: I think this PKGBUILD should work. Please re-verify it on usage, for your own sake. Additionally, I patched the makefile to remove the ogdi subdir in /usr/lib/.

./PKGBUILD

# Maintainer: Cem Aydin (rebootl) <cem.aydin@gmx.ch>

#: Attention: Version spelling different in source path
#: (in case this changes, it could be removed)
_path_ver=3.2.0beta2

pkgname=ogdi
pkgver=3.2.0.beta2
pkgrel=1
pkgdesc="Open Geospatial Data Interface - API"
arch=('i686' 'x86_64')
url="http://ogdi.sourceforge.net/"
license=('custom')
depends=('zlib' 'expat' 'proj-old')
makedepends=()
optdepends=()
source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${_path_ver}/${pkgname}-${pkgver}.tar.gz"
        'lib-install-dir.patch')
md5sums=('8efc8f1e1dc77bfeda431d9b8e08d871'
         'a32858dc29b8c5584d0351552d55703b')

prepare() {
  cd "${srcdir}/$pkgname-$pkgver"

  #: install libs in correct location (/usr/lib instead of /usr/lib/ogdi)
  patch config/common.mak.in < ${srcdir}/lib-install-dir.patch
}

build() {
  cd "${srcdir}/${pkgname}-$pkgver"

  #: (acc. to error during build setting -fPIC is needed)
  export CFLAGS="$CFLAGS -fPIC"

  #: setting TOPDIR is required
  export TOPDIR=$PWD

  ./configure --prefix=/usr \
              --with-zlib \
              --with-expat \
              --with-proj
  make
}

package () {
  cd "${srcdir}/${pkgname}-$pkgver"

  TOPDIR="$PWD" make prefix="${pkgdir}/usr" install

# install license
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

./lib-install-dir.patch

--- common.mak.in_ORIGINAL	2014-10-31 16:00:34.222369849 +0100
+++ common.mak.in	2014-10-31 16:00:52.498717526 +0100
@@ -225,8 +225,8 @@
 
 ifeq ($(TARGETGEN),$(DYNAGEN))
 default-install:
-	mkdir -p $(INST_LIB)/ogdi
-	cp $(TARGETGEN) $(INST_LIB)/ogdi
+	mkdir -p $(INST_LIB)
+	cp $(TARGETGEN) $(INST_LIB)
 endif
 
 ifeq ($(TARGETGEN),$(SHRDGEN))

Unfortunately this did not help me building FlightGear w/ osgEarth support. gdal must be missing something else... I'm re-looking at building gdal now, and I see that there seem to be a few issues w/ it's configure not finding or complaining about libraries, e.g.: webp, curl, spatialite, freexl and proj (though they're installed of course). But that's another topic.

Last edited by rebootl (2014-11-04 19:07:24)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

Board footer

Powered by FluxBB