php_5.6.%.bbappend 3.12 KB
Newer Older
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
1 2 3
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI_append += " file://php.ini"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
4

Andrey Filippov's avatar
Andrey Filippov committed
5
EXTRA_OECONF += "--enable-elphel \
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
6
                --enable-exif \
7
                --with-curl=${STAGING_LIBDIR}/.. \
Andrey Filippov's avatar
Andrey Filippov committed
8
                --with-readline=${STAGING_LIBDIR}/.. \
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
9
                --with-config-file-path=${sysconfdir}/php \
Andrey Filippov's avatar
Andrey Filippov committed
10 11
                "

12
DEPENDS += " curl"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
13

14
VPATH = "${TOPDIR}/../../rootfs-elphel/elphel-apps-php-extension"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
15
VFILE = "VERSION"
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
16 17

do_unpack_append(){
18
    print("Link everything to the main tree")
19
    VPATH = d.getVar('VPATH', True)
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
20
    S = d.getVar('S', True)
21 22
    TOPDIR = d.getVar('TOPDIR', True)
    WORKDIR = d.getVar('WORKDIR', True)
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
23
    
24 25 26 27
    if os.path.isdir(VPATH):
        print("VPATH exists - creating links...")        
        devdir_abspath = os.path.abspath(VPATH+"/src")
        for path, folders, files in os.walk(VPATH+"/src"):
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
28 29 30 31
            folders[:]=[fd for fd in folders if fd != ".git"]
            for folder in folders:
                folder_abspath = os.path.abspath(os.path.join(path, folder))
                folder_relpath = folder_abspath.replace(devdir_abspath+"/", '')
32
                os.system("cd "+S+";mkdir -p "+folder_relpath)
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
33 34 35
            for filename in files:
                file_abspath = os.path.abspath(os.path.join(path, filename))
                file_relpath = file_abspath.replace(devdir_abspath+"/", '')
36 37 38
                os.system("cd "+S+";ln -sf "+file_abspath+" "+file_relpath)
        #make a link back:
        
39 40 41 42 43 44 45 46 47 48 49
        if os.path.isdir(VPATH+"/php"):
            os.system("rm -rf "+VPATH+"/php")
        os.system("ln -sf "+S+" "+VPATH+"/php")
            
        if os.path.isdir(VPATH+"/sysroots"):
            os.system("rm -rf "+VPATH+"/sysroots")
        os.system("ln -sf "+TOPDIR+"/tmp/sysroots "+VPATH+"/sysroots")
        
        if os.path.isdir(VPATH+"/bitbake-logs"):
            os.system("rm -rf "+VPATH+"/bitbake-logs")
        os.system("ln -sf "+WORKDIR+"/temp "+VPATH+"/bitbake-logs")
50

Andrey Filippov's avatar
Andrey Filippov committed
51 52 53 54 55 56 57 58 59 60 61
}

# --- Adding support for scp installed files to the target  ---
do_target_scp () {
#Without next echo - no trace of the scp in the log!
    SSH_COMMAND='tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync'
    echo scp -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
    scp -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
    echo ssh ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
    ssh ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
}
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
62

63
inherit elphel-misc-functions
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
64 65 66 67 68

ELPHEL_PE = "${@version_update('${VPATH}','${VFILE}',0)}"
ELPHEL_PV = "${@version_update('${VPATH}','${VFILE}',1)}"
ELPHEL_PR = "${@version_update('${VPATH}','${VFILE}',2)}"

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
69 70
FILES_${PN} += " /etc/*"

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
71
do_install_append(){
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
72 73 74
    install -d ${D}/etc/elphel393/packages -d ${D}/etc/php
    install -m 0644 ${WORKDIR}/php.ini ${D}/etc/php
    
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
75 76 77 78 79
    echo "${ELPHEL_PE}.${ELPHEL_PV}.${ELPHEL_PR}" > ${D}/etc/elphel393/packages/apps-php-extension

    tar -czvf ${WORKDIR}/image.tar.gz -C ${WORKDIR}/image .
}

Andrey Filippov's avatar
Andrey Filippov committed
80 81 82
addtask do_target_scp after do_install
do_target_scp[doc] = "scp installed files to the target. TARGET_USER and TARGET_IP should be defined (ssh-copy-id TARGET_USER@TARGET_USER should be issued once)"
EXPORT_FUNCTIONS do_target_scp