Skip to content

Instantly share code, notes, and snippets.

@nh-mike
Last active April 20, 2023 16:22
Show Gist options
  • Save nh-mike/5fedd35ac6a88069565814e611c6891c to your computer and use it in GitHub Desktop.
Save nh-mike/5fedd35ac6a88069565814e611c6891c to your computer and use it in GitHub Desktop.
DirectFB2 Yocto Recipe
Currently compiling full image core-image-base sucessfully on langdale for Raspberry Pi Zero W for my setup.
Only complaint during compilaion is as follows;
File /usr/lib/libdirectfb-2.0.so.0.0.0 in package directfb2 contains reference to TMPDIR [buildpaths]
Also, when trying to use this with SDL2 and Pygame, I am receiving a Segemntation Error.
I had problems with DirectFB 1.7.7, so I decided to do something about it.
SUMMARY = "DirectFB2 library"
HOMEPAGE = "https://github.com/directfb2/DirectFB2"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
PROVIDES += "directfb2 directfb directfb2-dev directfb-dev"
RPROVIDES:${PN} += "directfb2 directfb directfb2-dev directfb-dev"
#DEPENDS += "meson ninja fluxcomp-native"
DEPENDS += "meson fluxcomp-native"
#Since we are generating errors about libdirectfbwm_default.so requires libdirectfb-2.0.so.0
#WARN_QA:append = " file-rdeps"
#ERROR_QA:remove = "file-rdeps"
SRC_URI = "git://github.com/directfb2/DirectFB2.git;protocol=https;branch=master"
SRCREV = "ac4f10ca5dcb9fb8c848fcde26a19d88cc8afd25"
S = "${WORKDIR}/git"
MODULEDIRNAME = "directfb-2.0.0"
inherit meson pkgconfig
INSANE_SKIP_${PN} += "pkgconfig"
# Configure options for meson
EXTRA_OEMESON = '\
--cross-file=${S}/my.meson.x86target.cross\
--prefix=${D}${prefix}\
-Ddebug-support=false\
-Ddrmkms=true\
-Dfbdev=true\
-Dlinuxinput=true\
-Dmemcpy-probing=false\
-Dmoduledirname=${MODULEDIRNAME}\
-Dmulti=false\
-Dmulti-kernel=false\
-Dsentinels=false\
-Dsmooth-scaling=false\
-Dtext=false\
-Dtrace=false'
#do_configure:prepend() {
# export KBUILD_ABS_SRCTREE=""
#}
do_configure() {
meson env2mfile --cross -o ${S}/my.meson.x86target.cross --system=linux --cpu=${PACKAGE_ARCH} --cpu-family=${TARGET_ARCH}
meson setup ${EXTRA_OEMESON} ${S} ${B}
}
do_compile() {
meson compile -C ${B}
}
do_install() {
meson install -C ${B}
}
python do_fix_pc_files() {
import os
import re
import glob
pc_files = glob.glob(d.expand('${D}${libdir}/pkgconfig/*.pc'))
build_prefix = d.getVar('D', True)
moduledir_build = d.getVar('D', True) + d.getVar('prefix', True)
for pc_file in pc_files:
with open(pc_file, 'r') as file:
content = file.read()
content = re.sub(r"prefix=" + re.escape(build_prefix), "prefix=", content)
content = re.sub(r"moduledir=" + re.escape(moduledir_build), "moduledir=${prefix}", content)
with open(pc_file, 'w') as file:
file.write(content)
fpath = d.expand('${D}${bindir}/dfb-update-pkgconfig')
with open(fpath, 'r') as file:
content = file.read()
content = re.sub(re.escape(d.expand('${D}')), "", content)
with open(fpath, 'w') as file:
file.write(content)
}
addtask do_fix_pc_files after do_install before do_package
LEAD_SONAME = "libdirectfb-2.0.so.0"
FILES:${PN}-dev += "\
${bindir}/directfb-config \
${libdir}/${MODULEDIRNAME}/systems/*.la \
${libdir}/${MODULEDIRNAME}/inputdrivers/*.la \
${libdir}/${MODULEDIRNAME}/interfaces/*/*.la \
${libdir}/${MODULEDIRNAME}/wm/*.la \
"
FILES:${PN} += "\
${libdir}/${MODULEDIRNAME}/systems/*.so \
${libdir}/${MODULEDIRNAME}/inputdrivers/*.so \
${libdir}/${MODULEDIRNAME}/interfaces/*/*.so \
${libdir}/${MODULEDIRNAME}/wm/*.so \
${datadir}/directfb-${PV} \
"
SUMMARY = "Fluxcomp"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://src/fluxcomp.cpp;md5=8f16923235d8fa62a6a19529614bf387"
#PROVIDES += "fluxcomp fluxcomp-native"
BBCLASSEXTEND = "native"
#DEPENDS:append_class-target = " fluxcomp-native"
#DEPENDS = "autoconf automake libtool"
SRC_URI = "git://github.com/deniskropp/flux.git;protocol=https;branch=master"
PV = "1.0+git${SRCPV}"
SRCREV = "10ad2ebc78b396032714b839f200848ea0dd9503"
S = "${WORKDIR}/git"
B = "${S}/src/build"
inherit autotools pkgconfig
EXTRA_OECONF = ""
do_show_fluxcomp_path() {
echo "Fluxcomp path: ${STAGING_BINDIR_NATIVE}/fluxcomp"
}
addtask show_fluxcomp_path before do_configure
do_configure() {
# Generate the configure script using autotools
if [ -f ${S}/configure.in ]; then
mv ${S}/configure.in ${S}/configure.ac
fi
MYBUIDDIR=$(pwd)
cd ${S}
autoreconf -i -f -I ${S}/configure.ac
# Run configure with the necessary options
${S}/configure --host=${TARGET_SYS} --prefix=${S} --exec-prefix=${exec_prefix} --bindir=${STAGING_BINDIR_NATIVE} --libdir=${libdir}
cd ${MYBUILDDIR}
}
do_compile() {
MYBUIDDIR=$(pwd)
cd ${S}
make -j 4
mkdir -p ${B}
cp ${S}/src/fluxcomp ${B}/fluxcomp
cp ${S}/src/fluxcomp.o ${B}/fluxcomp.o
cp -R ${S}/src/.libs ${B}/.libs
cd ${MYBUILDDIR}
}
do_install() {
echo "DO_INSTALL FLUXCOMP TO ${D}${bindir}"
install -d ${D}${bindir}
install -m 0755 ${B}/fluxcomp ${D}${bindir}/
if [ -e ${D}${bindir}/fluxcomp-native ]; then
mv ${D}${bindir}/fluxcomp-native ${D}${bindir}/fluxcomp
fi
}
# Specify where the files will be installed
FILES_${PN} += "${STAGING_BINDIR_NATIVE}/fluxcomp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment