Opened 11 years ago

Closed 11 years ago

#42828 closed defect (fixed)

glew: pkg-config .pc files contain path to destroot

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: RJVB (René Bertin), cooljeanius (Eric Gallager), mamoll (Mark Moll)
Port: glew

Description

The pkg-config .pc files that the glew port installs contain the path to the destroot:

$ port -v installed glew
The following ports are currently installed:
  glew @1.10.0_0+universal (active) platform='darwin 13' archs='i386 x86_64'
$ port -q contents glew | xargs grep destroot
/opt/local/lib/pkgconfig/glew.pc:prefix=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local
/opt/local/lib/pkgconfig/glew.pc:exec_prefix=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/bin
/opt/local/lib/pkgconfig/glew.pc:libdir=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/lib
/opt/local/lib/pkgconfig/glew.pc:includedir=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/include/GL
/opt/local/lib/pkgconfig/glewmx.pc:prefix=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local
/opt/local/lib/pkgconfig/glewmx.pc:exec_prefix=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/bin
/opt/local/lib/pkgconfig/glewmx.pc:libdir=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/lib
/opt/local/lib/pkgconfig/glewmx.pc:includedir=/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/include/GL

This was originally reported on the mailing list while Trac was down.

It seems the .pc files get created correctly during the build phase:

sed \
		-e "s|@prefix@|/opt/local|g" \
		-e "s|@libdir@|/opt/local/lib|g" \
		-e "s|@exec_prefix@|/opt/local/bin|g" \
		-e "s|@includedir@|/opt/local/include/GL|g" \
		-e "s|@version@|1.10.0|g" \
		-e "s|@cflags@||g" \
		-e "s|@libname@|GLEW|g" \
		< glew.pc.in > glew.pc
sed \
		-e "s|@prefix@|/opt/local|g" \
		-e "s|@libdir@|/opt/local/lib|g" \
		-e "s|@exec_prefix@|/opt/local/bin|g" \
		-e "s|@includedir@|/opt/local/include/GL|g" \
		-e "s|@version@|1.10.0|g" \
		-e "s|@cflags@|-DGLEW_MX|g" \
		-e "s|@libname@|GLEWmx|g" \
		< glew.pc.in > glewmx.pc

But then get overwritten with an incorrect version at destroot time:

sed \
		-e "s|@prefix@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local|g" \
		-e "s|@libdir@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/lib|g" \
		-e "s|@exec_prefix@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/bin|g" \
		-e "s|@includedir@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/include/GL|g" \
		-e "s|@version@|1.10.0|g" \
		-e "s|@cflags@||g" \
		-e "s|@libname@|GLEW|g" \
		< glew.pc.in > glew.pc
sed \
		-e "s|@prefix@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local|g" \
		-e "s|@libdir@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/lib|g" \
		-e "s|@exec_prefix@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/bin|g" \
		-e "s|@includedir@|/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_glew/glew/work/destroot/opt/local/include/GL|g" \
		-e "s|@version@|1.10.0|g" \
		-e "s|@cflags@|-DGLEW_MX|g" \
		-e "s|@libname@|GLEWmx|g" \
		< glew.pc.in > glewmx.pc

This appears to be because the Makefile deliberately declares the .pc files as ".PHONY" because, according to a comment in the Makefile, "GLEW_DEST can vary". The Makefile does not support DESTDIR, so the Portfile sets GLEW_DEST=${prefix} at build time and GLEW_DEST=${destroot}${prefix} at destroot time.

A solution might be to always set GLEW_DEST=${prefix} and apply this patch which provides proper DESTDIR support, which has already been merged upstream.

Change History (2)

comment:1 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:2 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: mmoll@… added
Resolution: fixed
Status: newclosed

Mark fixed this a different way in r119889 by using reinplace to remove the path to the destroot from the .pc files.

Note: See TracTickets for help on using tickets.