Background:
I am trying to build ADLINK Vortex OpenSplice Community Edition in a Yocto recipe.
Everything works fine when I try build OpenSplice in a Bash shell. However, there are a lot of problems when I try to build OpenSplice in an sh shell. The problem is that configure script (and the scripts it calls) have a lot of bashisms (arrays, popd, pushd, etc). The Bash configure files are too long and complicated to rewrite to sh with a Yocto patch file.
Problem I cannot source a Bash script to set environment variables in do_configure() in a Yocto recipe.
I can run the configure script in my Yocto recipe. This works for instance:bash -c "printf '5' | source ${S}/configure"
The configure script asks for which platform I want to build OpenSplice, printf '5'
enters option 5.
But this script does not set the environment variables that are supposed to be set. I know, Bash starts a child shell, and the environment variables do not leave that shell.
I tried to source Bash in my recipe:
. bash -c "printf '5' | source ${S}/configure"
But this gives the following error:
sh: 3: /bin/bash: Syntax error: Unterminated quoted string
What I also tried is using system calls in python. But this gives the same problem, it opens a child shell and the environment variables are not available in the parent shell.
Question So, the question is how can I source a Bash script in a Yocto recipe? Any solution is welcome, also the dirty ones.
Recipe
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=c4bfc022908a26f6f895ab14b6baebca"
# Opensplice does not work with semantic versioning. Therefore ${PV} cannot be used.
# OSPL_V6_9_190925OSS_RELEASE is the 10th release of Opensplice V6.9 (.9 in zero-based
# numbering). SRCREV is commit hash of OSPL_V6_9_190925OSS_RELEASE.
SRC_URI = "git://github.com/ADLINK-IST/opensplice.git"
SRCREV = "c98e118a2e4366d2a5a6af8cbcecdf112bf9e4ab"
S = "${WORKDIR}/git"
DEPENDS += " bash gcc gawk flex bison perl bison-native "
RDEPENDS_${PN} += " bash bison "
do_configure () {
# # configure prompts for choice of target architecture
# # printf '5' enters choice 5; armv7l.linux-release
bash -c "printf '5' | source ${S}/configure"
}
do_build () {
make
}
do_install () {
make install
}