Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple installation of native script for use in other recipe

I need to install a native script, call it foo, in one recipe (foo-native) and then use it in the do_compile step of another (target) recipe - call it bar.

My (minimal) native recipe

SRC_URI = "file://foo"
LICENSE = "CLOSED"

inherit native

BBCLASSEXTEND = "native"

S = "${WORKDIR}"

do_compile() { 
    : 
}

do_install() {
    install -d ${D}/usr/bin
    install ${WORKDIR}/foo ${D}/usr/bin
}

The script, foo, exists in a directory called files which resides next to the recipe. i.e.

foo/
├── files
│   └── foo
└── foo.bb

My target recipe for bar

SRC_URI = ""
LICENSE = "CLOSED"

DEPENDS = "foo-native"

do_fetch[noexec] = "1"
do_configure[noexec] = "1"

do_compile() {
    foo >myfile.json
}

do_install() {
    install -d ${D}/etc
    install ${WORKDIR}/myfile.json ${D}/etc
}

The error I get is in the do_compile task of bar, and it simply says that foo can not be found (i.e. has not been installed into a directory on the path).

like image 946
kdopen Avatar asked Aug 15 '17 21:08

kdopen


1 Answers

First, you don't need the line

inherit native

in foo.bb. It's taken care of for you by BBCLASSEXTEND = "native".

Secondly, change your do_install to:

do_install() {
    install -d ${D}${bindir}
    install ${WORKDIR}/foo ${D}${bindir}
}

Note: use ${bindir} instead of /usr/bin. ${bindir} is determined using ${prefix}, which in turn is changed e.g. when building a -native version of a recipe.

like image 55
Anders Avatar answered Nov 15 '22 07:11

Anders