1require ${BPN}.inc
2
3FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-native:"
4
5inherit meson native
6
7DEPENDS += " \
8    meson-native \
9    glib-2.0-native \
10    lcms-native \
11"
12
13SRC_URI += " \
14    file://0001-Move-the-function-cd_icc_create_from_edid-to-avoid-u.patch \
15    file://Makefile;subdir=${BPN}-${PV} \
16"
17
18do_configure() {
19    # we expect meson to fail - but before it extracts project's version in log file
20    meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON} > /dev/null 2>&1 || true
21
22    # extract and split version
23    version=`grep 'Project version:' ${B}/meson-logs/meson-log.txt | sed 's|Project version: ||'`
24    major=`echo $version | cut -d. -f1`
25    minor=`echo $version | cut -d. -f2`
26    micro=`echo $version | cut -d. -f3`
27    echo "Project version: $major.$minor.$micro"
28
29    # extract project name
30    proj_name=`grep 'Project name:' ${B}/meson-logs/meson-log.txt | sed 's|Project name: ||'`
31
32    # create cd-version.h
33    mkdir -p ${B}/colord
34	sed ${S}/lib/colord/cd-version.h.in \
35		-e 's:@CD_MAJOR_VERSION_PRIVATE@:1:g' \
36		-e 's:@CD_MINOR_VERSION_PRIVATE@:4:g' \
37		-e 's:@CD_MICRO_VERSION_PRIVATE@:4:g' \
38		> ${B}/colord/cd-version.h
39
40    # create config.h based on target build and add what's necessary only
41    localedir=`echo ${datadir}/locale | sed 's:${prefix}/::g'`
42    echo "#define LOCALEDIR \"$localedir\"" >> ${B}/config.h
43    echo "#define GETTEXT_PACKAGE \"colord\"" >> ${B}/config.h
44    echo "#define PACKAGE_NAME \"$proj_name\"" >> ${B}/config.h
45    echo "#define PACKAGE_VERSION \"$version\"" >> ${B}/config.h
46}
47
48do_compile() {
49    oe_runmake -C${S} DESTDIR=${B}
50}
51
52do_install() {
53    version=`grep 'Project version:' ${B}/meson-logs/meson-log.txt | sed 's|Project version: ||'`
54    major=`echo $version | cut -d. -f1`
55
56    install -d ${D}${libdir}
57    install -m 755 ${B}/libcolord.so ${D}${libdir}/libcolord.so.$version
58    ln -s libcolord.so.$version "${D}/${libdir}/libcolord.so"
59    ln -s libcolord.so.$version "${D}/${libdir}/libcolord.so.$major"
60
61    install -d ${D}${bindir}
62    install -m 755 ${B}/cd_create_profile ${D}${bindir}/
63    install -m 755 ${B}/cd_idt8 ${D}${bindir}/
64}
65