You are not logged in.

#1 2006-07-23 12:12:53

Youdaman
Member
From: Sydney, Australia
Registered: 2006-01-14
Posts: 41

freeimage Makefile

Hi,

I'm trying to create a package for the FreeImage library:
http://freeimage.sourceforge.net/download.html

Anyway, in the Makefile it's got the following:

install:
        install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
        install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
        ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
        ldconfig

makepkg chokes on the above -- here's the error message:

install -m 644 -o root -g root libfreeimage.a /usr/lib
install: cannot create regular file `/usr/lib/libfreeimage.a': Permission denied

Do I need to make a patch for the Makefile? Are there special flags I can pass in the PKGBUILD?

Offline

#2 2006-07-23 12:35:45

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: freeimage Makefile

you may have to do ./configure --prefix=/usr or make DESTDIR=$startdir/pkg.
Please post your PKGBUILD and we take a look at it.

Offline

#3 2006-07-23 13:49:02

Youdaman
Member
From: Sydney, Australia
Registered: 2006-01-14
Posts: 41

Re: freeimage Makefile

There's no configure file -- the readme's installation instructions specify "make" and "make install" -- that's all my PKGBUILD does:

pkgname=freeimage
pkgver=3.9.1
pkgrel=1
pkgdesc="FreeImage libray"
url="http://freeimage.sourceforge.net/"
depends=()
source=(http://optusnet.dl.sourceforge.net/sourceforge/freeimage/FreeImage391.zip)
md5sums=('8d737a1e2ce978cc7eeb9754290aa310')


build() {
  cd $startdir/src/FreeImage
  make || return 1
  make prefix=$startdir/pkg/usr install
}

Actually I've decided not to create this package, as it merely provides image libs for the Ogre3d graphics library, however I already have those libs (png, mng, tiff, etc) installed so I'm using the --disable-freeimage flag for Ogre3d now smile

Still, it would be nice to know how to overcome the above problem of the Makefile explicitly specifying a user (root) to install -- this is what I believe is causing the trouble, or at least conflicting with fakeroot perhaps?

Offline

#4 2006-07-23 14:45:22

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: freeimage Makefile

This isn't a very flexible Makefile. This is what I had to do:

build() {
  cd $startdir/src/FreeImage
  dest=$startdir/pkg/usr/lib
  mkdir -p $dest
  sed -e "s|INSTALLDIR = /usr/lib|INSTALLDIR = $dest|g" -i Makefile || return 1
  sed -e "s|ldconfig||g" -i Makefile || return 1
  make || return 1
  make install
}

make INSTALLDIR= would not work, as you suggested I had to physically replace that line using sed. It also errored out from trying to use ldconfig which must be run as root so I removed that line as well. You could then do a .install file for it which would run the ldconfig command after the package was built and install via pacman.

Maybe the honorable Snowman has a better solution.

Offline

#5 2006-07-23 14:48:36

Youdaman
Member
From: Sydney, Australia
Registered: 2006-01-14
Posts: 41

Re: freeimage Makefile

Yes the Makefile isn't very flexible at all. I was thinking about using sed or using a patch to change the Makefile, so my thoughts were on the right track -- or at least on the same track as someone else smile

Offline

#6 2006-07-23 14:53:05

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: freeimage Makefile

yeah, a patch would be better than using sed with the makefile because its more reliable  -missed that thought.

Offline

#7 2006-07-23 20:19:44

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: freeimage Makefile

You don't need sed or patch:

build() {
  cd $startdir/src/FreeImage
  make || return 1
  make INSTALLDIR=$startdir/pkg/usr install
} 

I don't know if the above will work because of the symlink and ldconfig command.  And you might need to create some directories.
Perhaps it would be easier to forget about the make install and just install the stuff manually with install commands. There doesn't seem to be much files to install anyway.

EDIT: I'll try it myself.

EDIT2:

pkgname=freeimage
pkgver=3.9.1
pkgrel=1
pkgdesc="FreeImage libray"
url="http://freeimage.sourceforge.net/"
license=("GPL" "custom:FIPL")
depends=('gcc')
source=(http://dl.sourceforge.net/sourceforge/freeimage/FreeImage391.zip http://freeimage.sourceforge.net/freeimage-license.txt)
md5sums=('8d737a1e2ce978cc7eeb9754290aa310' '8e1438cab62c8f655288588dc43daaf6')

build() {
  cd $startdir/src/FreeImage
  sed -i 's/ldconfig//' Makefile
  make || return 1
  install -d $startdir/pkg/usr/lib
  make INSTALLDIR=$startdir/pkg/usr/lib install
  install -D -m644 $startdir/src/freeimage-license.txt $startdir/pkg/usr/share/licenses/custom/$pkgname/freeimage-license.txt
}

Offline

#8 2006-07-23 23:43:41

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: freeimage Makefile

now just how in the *sam-hell* did you get that to work with make INSTALLDIR=$startdir/pkg/usr/lib install ??? Must have been the ldconfig line.

Damn you is a good package monkey...

Offline

#9 2006-07-23 23:54:36

Youdaman
Member
From: Sydney, Australia
Registered: 2006-01-14
Posts: 41

Re: freeimage Makefile

Yeah it was his deletion of ldconfig that did the trick -- that was the only thing that choked using the simple INSTALLDIR variation. So yeah you need sed, but only for one word, and INSTALLDIR saves the day! Thanks Snowman/Penguin smile

Offline

#10 2006-08-25 11:37:06

lessthanjake
Member
From: Norway
Registered: 2005-11-09
Posts: 319
Website

Re: freeimage Makefile

Thanks for the PKGBUILD, but i fails too install the header file.
Adding one line at the bottom fixes it:

pkgname=freeimage
pkgver=3.9.1
pkgrel=1
pkgdesc="FreeImage libray"
url="http://freeimage.sourceforge.net/"
license=("GPL" "custom:FIPL")
depends=('gcc')
source=(http://switch.dl.sourceforge.net/sourceforge/freeimage/FreeImage391.zip http://freeimage.sourceforge.net/freeimage-license.txt)
md5sums=('8d737a1e2ce978cc7eeb9754290aa310' '8e1438cab62c8f655288588dc43daaf6')

build() {
  cd $startdir/src/FreeImage
  sed -i 's/ldconfig//' Makefile
  make || return 1
  install -d $startdir/pkg/usr/lib
  make INSTALLDIR=$startdir/pkg/usr/lib install
  install -D -m644 $startdir/src/freeimage-license.txt $startdir/pkg/usr/share/licenses/custom/$pkgname/freeimage-license.txt
  install -D -m644 $startdir/src/FreeImage/Dist/FreeImage.h $startdir/pkg/usr/include/FreeImage.h
}

Offline

Board footer

Powered by FluxBB