[yocto] add dejavu-fonts to image

Michel D'HOOGE michel.dhooge at free.fr
Thu Oct 13 07:56:34 PDT 2016




Hello, thanks a lot the build work now ! 

I'm very proud: this is the 1st time I can help someone on Yocto! This means a lot to me ;-) 


<blockquote>


But i have another issue, i would like to install the font in /usr/lib/fonts, this is not the case for the moment (it 's for Qt5.7 use). How i can said to yocto to install font (.ttf) on this folder please ? 
</blockquote>
I also need to use Qt5.7, but since I'm currently on other tasks, you discover the troubles a couple of hours before me. So let's try to debug this together… 
<blockquote>


</blockquote>



1/ File ttf-dejavu_2.37.bb includes (requires) `ttf.inc` that is in the same folder. 
2/ File ttf.inc has the following method: 

do_install() { 
install -d ${D}${datadir}/fonts/truetype/ 
find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${datadir}/fonts/truetype/ \; 
} 


which is in turn appended by dejavu with: 

do_install_append () { 
install -d ${D}${sysconfdir}/fonts/conf.d/ 
install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/ 
} 


3/ The log of the install task of the recipe is /tmp/work/all-poky-linux/ttf-dejavu/2.37-r7/temp/run.do_install 
We have: 

export datadir="/usr/share" 

export sysconfdir="/etc" 



I compared to my Debian system: the files are stored in the same folders. So it seems this is qt that doesn't search in the "correct" place. 


4/ After some grepping in meta-qt5, I have: 



classes/qmake5_paths.bbclass 
OE_QMAKE_PATH_LIBS = "${libdir}" 



classes/qmake5_paths.bbclass 
OE_QMAKE_PATH_QT_FONTS = "${OE_QMAKE_PATH_LIBS}/fonts" 


5/ But I don't know what is the best solution now. We could change the OE_QMAKE_PATH_QT_FONTS variable. But this implies to recompile many pieces, I believe. 


So I opt for changing the do_install function. The quick & dirty solution is to create a ttf-dejavu_2.37.bbappend file that totally redefine the do_install method. 




do_install() { 
install -d ${D}${datadir}/fonts/truetype/ 
find ./ -name '*.tt[cf]' -exec install -m 0644 {} ${D}${ libdir }/fonts/truetype/ \; 

install -d ${D}${sysconfdir}/fonts/conf.d/ 
install -m 0644 ${WORKDIR}/30-dejavu-aliases.conf ${D}${sysconfdir}/fonts/conf.d/ 
} 




I can't test it right now, but I hope this helps you. 


Michel 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20161013/ea12dea8/attachment.html>


More information about the yocto mailing list