ffmpeg icon indicating copy to clipboard operation
ffmpeg copied to clipboard

pkgconfiguration lost

Open thedayofcondor opened this issue 5 years ago • 3 comments

Hi, it am not sure if this is done on purpose, but it looks like the Dockerfile sets pkgconfig correctly, but then "forgets" to copy the various .pc files from /opt/ffmpeg.libs/pkgconfig/ to the main image (if I understand correctly it gets a list of dependencies running ldd and just copies those).

Would it be possible to preserve the .pc files?

thedayofcondor avatar Feb 05 '20 14:02 thedayofcondor

ACK, it's not trivial as we move the content around so the copy actually change the location, so the content of those files will need to be updated accordingly (sed)

jrottenberg avatar Feb 07 '20 03:02 jrottenberg

I have the same problem with other packages I build - turns out that by default pkg-config (at least on recent versions) ignores the prefix variable and replaces it with the parent folder of the .pc location (ie /usr/local/lib if the .pc is read from /usr/local/lib/pkgconfig), as building in one folder and then moving to a different one is quite a common workflow - so this is generally not an issue.

However, at least in my distribution this default has been overridden (there's a command line option to restore this behaviour) so probably using a sed filter as an enhanced copy is the safest option.

The modification to each .pc file would be always the same, override prefix with /usr/local/lib - I am in the process of updating my own .pc, give me a couple of days and I will be able to share some code

thedayofcondor avatar Feb 07 '20 07:02 thedayofcondor

As promised, this is what I am using now:

OLDPREFIX=/opt/ffmpeg
NEWPREFIX=/usr/local
find ${OLDPREFIX}/lib/ -path "*/pkgconfig/*.pc" | while read PCFILE; do
    echo "Updating ${OLDPREFIX} to ${NEWPREFIX} in ${PCFILE}"
    sed -i "s|^prefix=${OLDPREFIX}$|prefix=${NEWPREFIX}|" ${PCFILE}
done

Note this patches the .pc file in place, ready to be copied - a slightly more elegant solution would be to change the sed line to also perform the copy to /usr/local/lib/pkgconfig/

thedayofcondor avatar Feb 07 '20 14:02 thedayofcondor