adding pjsip to my openmoko overlay - part 2

Posted on February 28, 2008
Filed Under openmoko |

since my last post i’ve made some progress with my bitbake recipe to build the pjsip project for openmoko.

the first problem i ran into with the install was bitbake complaining that files from a .svn subdirectory from the source tree couldn’t be installed because of a permission problem. those files shouldn’t be installed anyway but were as a side effect of pjsip’s install Makefile rule, which does a recursive copy of the include directories within each subdirectory to /usr/local/include. this fixes it:

# removes all of the .svn files to avoid problems
# during the install
do_remove_svn_files () {
   # "|| true" is to avoid problems with recursing into directories
   # that are removed
   find ${S} -type d -name '.svn' -exec rm -rf {} \; > /dev/null \
      2>&1 || true
}
addtask remove_svn_files after do_unpack before do_patch

pjsip’s makefile is hardcoded to install the libraries and header files into the /usr/local prefix. the default bitbake recipes don’t look for installed files in these directories and complained that the files were installed but not listed in any package. so, copying what i saw in the ffmpeg recipe, i tried this:

FILES_pjsip-dev = “/usr/local/lib/lib*.a \
/usr/local/include/*\
/usr/local/lib/pkgconfig/libpj.pc”

this appears to have no effect. after some trial and error and finally discovering the “-e” option to bitbake, i saw from this command - bitbake -e pjsip | less - that the FILES variable is already assigned by one of the bitbake classes. i thought my assignment would override it but i guess not. instead, something like this is necessary:

FILES_pjsip-dev += "/usr/local/lib/lib*.a \
/usr/local/include/*\
/usr/local/lib/pkgconfig/libpj.pc"

or the more conventional:

FILES_${PN}-dev += "/usr/local/lib/lib*.a \
/usr/local/include/*\
/usr/local/lib/pkgconfig/libpj.pc"

this works perfectly and produces an ipkg file in build/tmp/deploy/glibc/ipk/armv4t.

pjsip’s install Makefile rule doesn’t install any of the command line utilities or the python bindings. i’ll take a stab at those next.

Comments

2 Responses to “adding pjsip to my openmoko overlay - part 2”

  1. pat on April 14th, 2008 3:58 pm

    $ cat pjproject_0.5.10.1.bb
    DESCRIPTION = “SIP and media stack”
    SECTION = “multimedia”
    LICENSE = “GPL”
    PRIORITY = “optional”
    PR=”r0″
    # DEFAULT_PREFERENCE=”-1″

    SRC_URI = “http://www.pjsip.org/release/${PV}/${PN}-${PV}.tar.gz \
    file://libpj.pc \

    EXTRA_OECONF = “–disable-sound”

    inherit autotools
    inherit pkgconfig

    do_install() {
    install -d ${D}${bindir}

    install -m 0755 ${S}/pjsip-apps/bin/pjsua* ${D}${bindir}/pjsua
    }

    STAGE_TEMP = “${WORKDIR}/temp-staging”
    do_stage() {
    rm -rf ${STAGE_TEMP}
    mkdir -p ${STAGE_TEMP}

    PJ_OS_NAME=`ls ${S}/pjlib/lib/ | sed -e ’s/libpj\(-.*\).a/\1/’`

    for i in `find ${S} -name ‘*.a’`; do
    lib=`basename $i`
    install $i ${STAGE_TEMP}/`echo $lib | sed -e s/${PJ_OS_NAME}//`
    done

    for i in `find ${STAGE_TEMP} -name ‘*.a’`; do
    oe_libinstall -C ${STAGE_TEMP} $(basename $i .a) ${STAGING_LIBDIR}
    done

    echo hier

    for i in `find ${S} -wholename “*/include/*” -type d | sed -e ’s/^.*\/include\///’`; do
    install -m 0755 -d ${STAGING_INCDIR}/$i
    done

    for i in `find ${S} -wholename “*/include/*\.h”; find ${S} -wholename “*/include/*\.hpp”`; do
    install -m 0644 $i ${STAGING_INCDIR}/`echo $i | sed -e ’s/^.*\/include\///’`
    done

    cp ${WORKDIR}/libpj.pc ${S}

    rm -rf ${STAGE_TEMP}
    }

    $ cat files/libpj.pc
    # Package Information for pkg-config

    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    includedir=${prefix}/include

    Name: libpj
    Description: Sip library
    Version: 5.10.1
    Libs: -L${libdir} -lpjsua -lpjsip -lpjmedia -lpjsip-ua -lpjsip-simple -lpjsip-ua -lpjmedia-codec -lpjlib-util -lpj
    Cflags: -I${includedir}

  2. Gene Oden on April 23rd, 2008 9:25 am

    excellent. is this in openembedded? i haven’t had much time to tinker with openmoko lately but plan to spend some time this week.

Leave a Reply