librelist archives

« back to archive

PATCH: Install into /usr/lib64 on x86_64 arch where needed

PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Daniel P. Berrange
Date:
2010-03-25 @ 15:32
The src/CMakeLists.txt file has hardcoded 'lib' as the name of the install
directory for libraries. This is not valid on many 64-bit platforms which
instead use 'lib64'.  By using the ${LIB_INSTALL_DIR} variable from cmake,
the correct choice of lib vs lib64 is used for the current platform.

Regards,
Daniel

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2d9a6cb..751e609 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,7 +42,7 @@ SET (PUB_HDRS api/yajl_parse.h api/yajl_gen.h api/yajl_common.h)
 ADD_DEFINITIONS(-DYAJL_BUILD)
 
 # set up some paths
-SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
+SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/${LIB_INSTALL_DIR})
 SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl)
 
 # set the output path for libraries
@@ -77,7 +77,7 @@ ENDFOREACH (header ${PUB_HDRS})
 INCLUDE_DIRECTORIES(${incDir}/..)
 
 IF(NOT WIN32)
-  INSTALL(TARGETS yajl LIBRARY DESTINATION lib)
-  INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib)
+  INSTALL(TARGETS yajl LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+  INSTALL(TARGETS yajl_s ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
   INSTALL(DIRECTORY api/ DESTINATION include/yajl)
 ENDIF()


-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Vitali Lovich
Date:
2010-03-25 @ 15:51
I just tried out LIB_INSTALL_DIR & it's blank on my machine.  Where's 
the doc in CMake for this variable?  I can't find it.

On 03/25/2010 08:32 AM, Daniel P. Berrange wrote:
> The src/CMakeLists.txt file has hardcoded 'lib' as the name of the install
> directory for libraries. This is not valid on many 64-bit platforms which
> instead use 'lib64'.  By using the ${LIB_INSTALL_DIR} variable from cmake,
> the correct choice of lib vs lib64 is used for the current platform.
>
> Regards,
> Daniel
>
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 2d9a6cb..751e609 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -42,7 +42,7 @@ SET (PUB_HDRS api/yajl_parse.h api/yajl_gen.h 
api/yajl_common.h)
>   ADD_DEFINITIONS(-DYAJL_BUILD)
>
>   # set up some paths
> -SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
> +SET (libDir 
${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/${LIB_INSTALL_DIR})
>   SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl)
>
>   # set the output path for libraries
> @@ -77,7 +77,7 @@ ENDFOREACH (header ${PUB_HDRS})
>   INCLUDE_DIRECTORIES(${incDir}/..)
>
>   IF(NOT WIN32)
> -  INSTALL(TARGETS yajl LIBRARY DESTINATION lib)
> -  INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib)
> +  INSTALL(TARGETS yajl LIBRARY DESTINATION ${LIB_INSTALL_DIR})
> +  INSTALL(TARGETS yajl_s ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
>     INSTALL(DIRECTORY api/ DESTINATION include/yajl)
>   ENDIF()
>
>
>    

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Daniel P. Berrange
Date:
2010-03-25 @ 15:54
On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
> I just tried out LIB_INSTALL_DIR & it's blank on my machine.  Where's 
> the doc in CMake for this variable?  I can't find it.

Hmm, looking more closely, this appears to be something defined by Fedora's 
RPM macros for invoking cmake only. I had assumed Fedora was just overriding
a existing standard cmake macro, but I guess this is custom :-(

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Vitali Lovich
Date:
2010-03-25 @ 16:06
One way to split this patch up would be to perhaps do the following:

install to lib${LIB_SUFFIX}.

This means that the distributor has enough control to do this if they 
are building for an OS where this is an issue.

If there's a way for CMake to figure out that it's a 64-build target & 
the OS is using lib64 (which I'm not sure if there is), then it can set 
LIB_SUFFIX.

On 03/25/2010 08:54 AM, Daniel P. Berrange wrote:
> On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
>    
>> I just tried out LIB_INSTALL_DIR&  it's blank on my machine.  Where's
>> the doc in CMake for this variable?  I can't find it.
>>      
> Hmm, looking more closely, this appears to be something defined by Fedora's
> RPM macros for invoking cmake only. I had assumed Fedora was just overriding
> a existing standard cmake macro, but I guess this is custom :-(
>
> Daniel
>    

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Lloyd Hilaiel
Date:
2010-03-25 @ 16:56
HmmMMmm.

What do you guys think of this patch?
http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642

Though manual, seems to give desired behavior:
http://gist.github.com/343802

If no-one can think of flaws nor a better approach, I'll merge it in..

very best,
lloyd

On Thu, Mar 25, 2010 at 09:06:08AM -0700, Vitali Lovich wrote:
> One way to split this patch up would be to perhaps do the following:
> 
> install to lib${LIB_SUFFIX}.
> 
> This means that the distributor has enough control to do this if they 
> are building for an OS where this is an issue.
> 
> If there's a way for CMake to figure out that it's a 64-build target & 
> the OS is using lib64 (which I'm not sure if there is), then it can set 
> LIB_SUFFIX.
> 
> On 03/25/2010 08:54 AM, Daniel P. Berrange wrote:
> > On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
> >    
> >> I just tried out LIB_INSTALL_DIR&  it's blank on my machine.  Where's
> >> the doc in CMake for this variable?  I can't find it.
> >>      
> > Hmm, looking more closely, this appears to be something defined by Fedora's
> > RPM macros for invoking cmake only. I had assumed Fedora was just overriding
> > a existing standard cmake macro, but I guess this is custom :-(
> >
> > Daniel
> >    
> 

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Vitali Lovich
Date:
2010-03-25 @ 16:54
I was just thinking of using a regular CMake variable - that seems to be 
the approach taken by other projects.

Thus, the usage would be

cmake -DLIB_SUFFIX=64 instead of LIB_SUFFIX=64 cmake & internally you 
just use ${LIB_SUFFIX}.

Style choice I guess.

Cheers,
Vitali

On 03/25/2010 09:56 AM, Lloyd Hilaiel wrote:
> HmmMMmm.
>
> What do you guys think of this patch?
> http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642
>
> Though manual, seems to give desired behavior:
> http://gist.github.com/343802
>
> If no-one can think of flaws nor a better approach, I'll merge it in..
>
> very best,
> lloyd
>
> On Thu, Mar 25, 2010 at 09:06:08AM -0700, Vitali Lovich wrote:
>    
>> One way to split this patch up would be to perhaps do the following:
>>
>> install to lib${LIB_SUFFIX}.
>>
>> This means that the distributor has enough control to do this if they
>> are building for an OS where this is an issue.
>>
>> If there's a way for CMake to figure out that it's a 64-build target&
>> the OS is using lib64 (which I'm not sure if there is), then it can set
>> LIB_SUFFIX.
>>
>> On 03/25/2010 08:54 AM, Daniel P. Berrange wrote:
>>      
>>> On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
>>>
>>>        
>>>> I just tried out LIB_INSTALL_DIR&   it's blank on my machine.  Where's
>>>> the doc in CMake for this variable?  I can't find it.
>>>>
>>>>          
>>> Hmm, looking more closely, this appears to be something defined by Fedora's
>>> RPM macros for invoking cmake only. I had assumed Fedora was just overriding
>>> a existing standard cmake macro, but I guess this is custom :-(
>>>
>>> Daniel
>>>
>>>        
>>      

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Lloyd Hilaiel
Date:
2010-03-25 @ 17:09
On Thu, Mar 25, 2010 at 09:54:10AM -0700, Vitali Lovich wrote:
> I was just thinking of using a regular CMake variable - that seems to be 
> the approach taken by other projects.

sounds reasonable to me.  precedent is good.

how bout' now?

http://github.com/lloyd/yajl/commit/402d4a3c62fc96d75ad55439f39eea06d2f30e37

lloyd

> Thus, the usage would be
> 
> cmake -DLIB_SUFFIX=64 instead of LIB_SUFFIX=64 cmake & internally you 
> just use ${LIB_SUFFIX}.
> 
> Style choice I guess.
> 
> Cheers,
> Vitali
> 
> On 03/25/2010 09:56 AM, Lloyd Hilaiel wrote:
> > HmmMMmm.
> >
> > What do you guys think of this patch?
> > http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642
> >
> > Though manual, seems to give desired behavior:
> > http://gist.github.com/343802
> >
> > If no-one can think of flaws nor a better approach, I'll merge it in..
> >
> > very best,
> > lloyd
> >
> > On Thu, Mar 25, 2010 at 09:06:08AM -0700, Vitali Lovich wrote:
> >    
> >> One way to split this patch up would be to perhaps do the following:
> >>
> >> install to lib${LIB_SUFFIX}.
> >>
> >> This means that the distributor has enough control to do this if they
> >> are building for an OS where this is an issue.
> >>
> >> If there's a way for CMake to figure out that it's a 64-build target&
> >> the OS is using lib64 (which I'm not sure if there is), then it can set
> >> LIB_SUFFIX.
> >>
> >> On 03/25/2010 08:54 AM, Daniel P. Berrange wrote:
> >>      
> >>> On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
> >>>
> >>>        
> >>>> I just tried out LIB_INSTALL_DIR&   it's blank on my machine.  Where's
> >>>> the doc in CMake for this variable?  I can't find it.
> >>>>
> >>>>          
> >>> Hmm, looking more closely, this appears to be something defined by Fedora's
> >>> RPM macros for invoking cmake only. I had assumed Fedora was just overriding
> >>> a existing standard cmake macro, but I guess this is custom :-(
> >>>
> >>> Daniel
> >>>
> >>>        
> >>      
> 

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Daniel P. Berrange
Date:
2010-03-25 @ 17:06
On Thu, Mar 25, 2010 at 11:09:38AM -0600, Lloyd Hilaiel wrote:
> On Thu, Mar 25, 2010 at 09:54:10AM -0700, Vitali Lovich wrote:
> > I was just thinking of using a regular CMake variable - that seems to be 
> > the approach taken by other projects.
> 
> sounds reasonable to me.  precedent is good.
> 
> how bout' now?
> 
> http://github.com/lloyd/yajl/commit/402d4a3c62fc96d75ad55439f39eea06d2f30e37

Looks good !

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Lloyd Hilaiel
Date:
2010-03-25 @ 17:35
On Thu, Mar 25, 2010 at 05:06:46PM +0000, Daniel P. Berrange wrote:
> On Thu, Mar 25, 2010 at 11:09:38AM -0600, Lloyd Hilaiel wrote:
> > On Thu, Mar 25, 2010 at 09:54:10AM -0700, Vitali Lovich wrote:
> > > I was just thinking of using a regular CMake variable - that seems to be 
> > > the approach taken by other projects.
> > 
> > sounds reasonable to me.  precedent is good.
> > 
> > how bout' now?
> > 
> > http://github.com/lloyd/yajl/commit/402d4a3c62fc96d75ad55439f39eea06d2f30e37
> 
> Looks good !

merged.  nice doing business with ya.

lloyd 

> 
> Regards,
> Daniel
> -- 
> |: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
> |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
> |: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
> |: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Vitali Lovich
Date:
2010-03-25 @ 17:05
LGTM

On 03/25/2010 10:09 AM, Lloyd Hilaiel wrote:
> On Thu, Mar 25, 2010 at 09:54:10AM -0700, Vitali Lovich wrote:
>    
>> I was just thinking of using a regular CMake variable - that seems to be
>> the approach taken by other projects.
>>      
> sounds reasonable to me.  precedent is good.
>
> how bout' now?
>
> http://github.com/lloyd/yajl/commit/402d4a3c62fc96d75ad55439f39eea06d2f30e37
>
> lloyd
>
>    
>> Thus, the usage would be
>>
>> cmake -DLIB_SUFFIX=64 instead of LIB_SUFFIX=64 cmake&  internally you
>> just use ${LIB_SUFFIX}.
>>
>> Style choice I guess.
>>
>> Cheers,
>> Vitali
>>
>> On 03/25/2010 09:56 AM, Lloyd Hilaiel wrote:
>>      
>>> HmmMMmm.
>>>
>>> What do you guys think of this patch?
>>> http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642
>>>
>>> Though manual, seems to give desired behavior:
>>> http://gist.github.com/343802
>>>
>>> If no-one can think of flaws nor a better approach, I'll merge it in..
>>>
>>> very best,
>>> lloyd
>>>
>>> On Thu, Mar 25, 2010 at 09:06:08AM -0700, Vitali Lovich wrote:
>>>
>>>        
>>>> One way to split this patch up would be to perhaps do the following:
>>>>
>>>> install to lib${LIB_SUFFIX}.
>>>>
>>>> This means that the distributor has enough control to do this if they
>>>> are building for an OS where this is an issue.
>>>>
>>>> If there's a way for CMake to figure out that it's a 64-build target&
>>>> the OS is using lib64 (which I'm not sure if there is), then it can set
>>>> LIB_SUFFIX.
>>>>
>>>> On 03/25/2010 08:54 AM, Daniel P. Berrange wrote:
>>>>
>>>>          
>>>>> On Thu, Mar 25, 2010 at 08:51:29AM -0700, Vitali Lovich wrote:
>>>>>
>>>>>
>>>>>            
>>>>>> I just tried out LIB_INSTALL_DIR&    it's blank on my machine.  Where's
>>>>>> the doc in CMake for this variable?  I can't find it.
>>>>>>
>>>>>>
>>>>>>              
>>>>> Hmm, looking more closely, this appears to be something defined by Fedora's
>>>>> RPM macros for invoking cmake only. I had assumed Fedora was just overriding
>>>>> a existing standard cmake macro, but I guess this is custom :-(
>>>>>
>>>>> Daniel
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>>      

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Daniel P. Berrange
Date:
2010-03-25 @ 17:03
On Thu, Mar 25, 2010 at 10:56:20AM -0600, Lloyd Hilaiel wrote:
> HmmMMmm.
> 
> What do you guys think of this patch?
> http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642
> 
> Though manual, seems to give desired behavior:
> http://gist.github.com/343802
> 
> If no-one can think of flaws nor a better approach, I'll merge it in..

That works for my needs.

FYI, I'm now maintaining RPMS of the yajl in Fedora and RHEL, since we
starting using it for our JSON parsing in libvirt when talking to QEMU's
monitor service.

Regads,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Re: [yajl] PATCH: Install into /usr/lib64 on x86_64 arch where needed

From:
Vitali Lovich
Date:
2010-03-25 @ 17:08
BTW, LIB_INSTALL_PREFIX I believe was a full-install path.  It's better 
style to set CMAKE_INSTALL_PREFIX - that's where the lib, install & bin 
directories live.

On 03/25/2010 10:03 AM, Daniel P. Berrange wrote:
> On Thu, Mar 25, 2010 at 10:56:20AM -0600, Lloyd Hilaiel wrote:
>    
>> HmmMMmm.
>>
>> What do you guys think of this patch?
>> http://github.com/lloyd/yajl/commit/d4afe025bc07d9d2df89130e0baeec1901890642
>>
>> Though manual, seems to give desired behavior:
>> http://gist.github.com/343802
>>
>> If no-one can think of flaws nor a better approach, I'll merge it in..
>>      
> That works for my needs.
>
> FYI, I'm now maintaining RPMS of the yajl in Fedora and RHEL, since we
> starting using it for our JSON parsing in libvirt when talking to QEMU's
> monitor service.
>
> Regads,
> Daniel
>