[x265] [PATCH] cmake: generate and install pkgconfig file

Rafaël Carré funman at videolan.org
Wed Oct 23 16:10:51 CEST 2013


Le 23/10/2013 12:03, Derek Buitenhuis a écrit :
> On 10/23/2013 6:16 AM, Steve Borho wrote:
>> # HG changeset patch
>> # User Steve Borho <steve at borho.org>
>> # Date 1382480398 18000
>> #      Tue Oct 22 17:19:58 2013 -0500
>> # Node ID a8d4928926e82026ed71ca0af210a5f4f16d405d
>> # Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
>> cmake: generate and install pkgconfig file
>>
>> This installs the x265.pc into /usr/local/lib/pkgconfig/ with these contents:
> 
> s#/usr/local/lib/#/specificed/prefix/#g in the commit message...
> 
>> Name: x265
>> Description: H.265/HEVC video encoder
>> Version: 0.4.1
>> Libs: -L${libdir} -lx265
>> Libs.private:  -lstdc++ -lm -lc -lpthread -lrt
> 
> This is not portable between systems, which may not use GNU's
> libsdtc++. OS X, can for example, use libc++. Don't get me started
> on Libav's MSVC stuff... ;)

Yeah, this should be generated dynamically of course.

@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@ @PLATFORM_LIBS@
Seems to be the way to go.

> Also, I thought you're not supposed to specify -lpthread explicitly --
> that is, use -pthread when compiling/linking instead.

info gcc only mentions -pthread for Solaris 2, _RS/6000 and PowerPC and
says:
     Add support for multithreading using the POSIX threads library.
     This option sets flags for both the preprocessor and linker.  This
     option does not affect the thread safety of object code produced by
     the compiler or that of libraries supplied with it.

No preprocessor option are needed, so -lpthread is the right thing to do
here, afaik.

> -lc should not be added.
> 
> Not all systems use librt, and it is also not portable. I think MinGW might not.
> 
> All of these things should be set properly based on configure checks.

Yeah it will depend for which platform the build is made.

>> The pkg-config file is only generated and installed if CMake finds pkg-config
>>
>> Q1: it seems unwise to hard-code "/lib" in a few places, what if lib64 is
>> used or something else?
> 
> Autotools can set --libdir IIRC, which works around it as such:
> 
> ${prefix}/${libdir}
> 
> Or at least, it has *something* like this, which I cannot recall the name
> of off the top of my head.
> 
>> Q2: Should x265.pc have a version number like x265-0.4.1.pc?
> 
> No. This demeans the entire point of pkg-config. The version is set
> in the .pc file, and it is what should be checked by end users, via
> pkg-config.
> 
> - Derek


More information about the x265-devel mailing list