On 12/05/2012 11:10 PM, Stephane Eranian wrote:
> On Wed, Dec 5, 2012 at 12:43 AM, Maynard Johnson <mayna...@us.ibm.com> wrote:
>> Fix installation to honor PREFIX and LIBDIR
>>
>> This patch changes the behavior of 'make install' so
>> that a user can pass PREFIX to have the libpfm4 files
>> installed somewhere other than the standard /usr/local
>> directory.
>>
>> This patch also allows for a user to pass LIBDIR to
>> specify a non-standard install directory for the
>> libpfm library files. The standard library install
>> directory is <install-dir>/lib, but on some architectures
>> (including x86_64 and ppc64), 64-bit libraries are
>> typically installed into a "lib64" subdirectory.
>>
>> This patch also removes the invocation of ldconfig from
>> the lib/Makefile install target, since that results in
>> and error when a non-root user is trying to install.
>>
>> The README was updated to document the three changes
>> made in this patch.
>>
>> Signed-off-by: Maynard Johnson <mayna...@us.ibm.com>
>> ---
>>  README       |   14 ++++++++++++++
>>  config.mk    |    8 ++++++--
>>  lib/Makefile |    1 -
>>  3 files changed, 20 insertions(+), 3 deletions(-)
>>
>> diff --git a/README b/README
>> index 70bb052..cf2fcc3 100644
>> --- a/README
>> +++ b/README
>> @@ -104,6 +104,20 @@ INSTALLATION
>>         - type make
>>         - type make install
>>
>> +       - The default installation location is /usr/local. You can specify
>> +         a diffierent install location as follows:
     oops!  typo --^
>> +               $ make PREFIX=<install-dir> install
>> +         Depending on your install location, you may need to run the 
>> 'ldconfig'
>> +         command or use LD_LIBRARY_PATH when you build and run tools that
>> +         link to the libpfm4 library.
>> +
>> +       - By default, libpfm library files are installed in 
>> <install-dir>/lib.
>> +         If 'make' builds 64-bit libraries on your system, and your target
>> +         architecture expects 64-bit libraries to be located in a library
>> +         named "lib64", then you should use the LIBDIR variable when 
>> installing,
>> +         as follows:
>> +               $ make LIBDIR=<install-dir>/lib64 install
>> +
>>         - To compile and install the Python bindings, you need to go to the
>>           python sub-directory and type make. Python may not be 
>> systematically
>>           built.
>> diff --git a/config.mk b/config.mk
>> index 9e5504c..1a38d87 100644
>> --- a/config.mk
>> +++ b/config.mk
>> @@ -101,8 +101,12 @@ AGE=0
>>  #
>>  # Where should things (lib, headers, man) go in the end.
>>  #
>> -PREFIX=/usr/local
>> -LIBDIR=$(PREFIX)/lib
>> +ifeq (${PREFIX},)
>> +       PREFIX=/usr/local
>> +endif
> What's the point of the ifeq compared to leaving
> PREFIX=/usr/local? The user can always override from cmdline: make
> PREFIX=/tmp/foo

Yeah, you're right.  Dumb mistake. I got confused at first when trying various 
options to install into a location other than /usr/local.  In particular, 
installing on ppc64 was problematic.  For example, the following install 
attempt failed:

--------------------------------
$ make BITMODE=64 PREFIX=/home/mpj/mylibpfm  install
installing in
make[1]: Entering directory `/home/mpj/temp/libpfm-4.3.0/lib'
building: libpfm.a libpfm.so.4.3.0
mkdir -p /lib64
install -m 644 libpfm.a /lib64
install: cannot create regular file `/lib64/libpfm.a': Permission denied
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/mpj/temp/libpfm-4.3.0/lib'
make: *** [install] Error 2
--------------------------------

In fact, my patch #2 of this 2 patch series resolved that issue, but I somehow 
misled myself to thinking I also needed the ifeq tests for PREFIX and LIBDIR.

So, please ignore those two changes.  Do you think the updates to the README 
are helpful?  I know they would have been for me.  ;-)

And what's your opinion on removing the LDCONFIG invocation below?  As I said 
in my patch description, running ldconfig will fail when you try to install 
libpfm as a non-root user.

Thanks.
-Maynard


> 
>> +ifeq (${LIBDIR},)
>> +       LIBDIR=$(PREFIX)/lib
>> +endif
> 
> What's wrong with: make LIBDIR=/tmp/foo/lib64 PREFIX=/tmp/foo?
> 
>>  INCDIR=$(PREFIX)/include
>>  MANDIR=$(PREFIX)/share/man
>>  DOCDIR=$(PREFIX)/share/doc/libpfm-$(VERSION).$(REVISION).$(AGE)
>> diff --git a/lib/Makefile b/lib/Makefile
>> index d2f00a9..1df6894 100644
>> --- a/lib/Makefile
>> +++ b/lib/Makefile
>> @@ -281,7 +281,6 @@ ifeq ($(CONFIG_PFMLIB_SHARED),y)
>>         $(INSTALL) $(SLIBPFM) $(DESTDIR)$(LIBDIR)
>>         cd $(DESTDIR)$(LIBDIR); $(LN) $(SLIBPFM) $(VLIBPFM)
>>         cd $(DESTDIR)$(LIBDIR); $(LN) $(SLIBPFM) libpfm.$(SOLIBEXT)
>> -       $(LDCONFIG)
>>  endif
>>
>>  tags:
>> --
>> 1.7.1
>>
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> perfmon2-devel mailing list
>> perfmon2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel
> 


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to