elphel-dev.bbclass 2.86 KB
Newer Older
1 2
# developers version

3 4
DEPENDS += "linux-xlnx"

5
inherit elphel-misc elphel-scp
6 7 8 9 10

do_unpack(){
    if [ -d ${S} ]; then
        rm -rf ${S}
    fi
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
11
    ln -sf ${VPATH} ${S}
12

13 14 15
    if [ -d ${VPATH}/sysroots ]; then
        rm -rf ${VPATH}/sysroots
    fi
16 17 18 19 20
    # old:
    #ln -sf ${TOPDIR}/tmp/sysroots ${VPATH}/sysroots
    # new:
    ln -sf ${WORKDIR}/recipe-sysroot ${VPATH}/sysroots

21 22 23 24
    if [ -d ${VPATH}/bitbake-logs ]; then
        rm -rf ${VPATH}/bitbake-logs
    fi
    ln -sf ${WORKDIR}/temp ${VPATH}/bitbake-logs
25

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
26 27 28 29
    if [ -d ${VPATH}/image ]; then
        rm -rf ${VPATH}/image
    fi
    ln -sf ${WORKDIR}/image ${VPATH}/image
30 31
}

32 33 34 35
ELPHEL393_USERADD = "eval ${FAKEROOTENV} PSEUDO_LOCALSTATEDIR=${STAGING_DIR_TARGET}${localstatedir}/pseudo ${STAGING_DIR_NATIVE}${bindir}/pseudo useradd --root ${STAGING_DIR_HOST}"
ELPHEL393_INSTALL = "install"
ELPHEL393_MKNOD = "mknod"

36 37
INITSTRING ??= "somescript.sh"

38 39 40
REMOTE_NETMASK ??= "255.255.255.0"
REMOTE_GATEWAY ??= "192.168.0.15"

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
41
EXTRA_OEMAKE = " \
42 43
                INSTALL=${ELPHEL393_INSTALL} \
                MKNOD=${ELPHEL393_MKNOD} \
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
44 45 46 47
                DESTDIR=${D} \
                ELPHEL_KERNEL_DIR=${STAGING_KERNEL_DIR} \
                STAGING_KERNEL_DIR=${STAGING_KERNEL_DIR} \
                STAGING_DIR_HOST=${STAGING_DIR_HOST} \
48
                USERADD='${ELPHEL393_USERADD}' \
49 50
                REMOTE_USER=${REMOTE_USER} \
                REMOTE_IP=${REMOTE_IP} \
51 52
                REMOTE_NETMASK=${REMOTE_NETMASK} \
                REMOTE_GATEWAY=${REMOTE_GATEWAY} \
53 54
                SRCREV=${SRCREV} \
                VERSION='${PE}.${PV}.${PR}' \
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
55
                INITSTRING='${INITSTRING}' \
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
56
                "
57

58 59 60 61 62 63 64 65 66 67 68 69
do_clean_append() {

    import os.path

    VPATH = d.getVar("VPATH")
    dfile = os.path.join(VPATH,"src/.depend")

    if os.path.exists(dfile):
        os.remove(dfile)

}

70 71 72 73 74 75
do_compile_prepend() {
    echo "SRCREV is ${SRCREV}"
    if [ ! -f Makefile ]; then
        echo "Nothing to compile (missing a Makefile)"
        exit 1
    fi
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

    # need to deal with .depend here

    DEPEND_FILE="${VPATH}/src/.depend"

    # Poky does not like non-zero exit codes,
    # look for matching lines - if empty string returned - remove .depend
    TEST_STR=`grep -r "${WORKDIR}" ${DEPEND_FILE} | cat`

    if [ -f $DEPEND_FILE ]; then
      if [ -z "${TEST_STR}" ]; then
        echo "This package version has been updated to ${PE}.${PV}.${PR}. Removing ${DEPEND_FILE} before compiling."
        rm ${DEPEND_FILE}
      fi
    fi

92
}
93

94 95
do_install_append() {
        oe_runmake ${EXTRA_OEMAKE} install
96
        install -d ${D}/etc/elphel393/packages
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
97
        TMPNAME=`basename ${VPATH}`
98
        echo "${PE}.${PV}.${PR}" > ${D}/etc/elphel393/packages/${BPN}
99 100
        #make archive
        tar -czvf ${WORKDIR}/image.tar.gz -C ${WORKDIR}/image .
101 102 103 104
}

# Always start from compile
# link1: http://www.crashcourse.ca/wiki/index.php/BitBake_task_flags
105
#do_compile[nostamp]="1"