DESCRIPTION = "Pharo VM"
# DEPENDS = ""
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

#FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

DEPENDS = "libsdl2 libdrm tslib mesa mesa-demos"

# pharo 9.0
SRCREV = "${AUTOREV}"
IMAGE_FILE ?= "latest-64.zip;sha256sum=5fcb782c39663391402d915d29251815be3fa378f1398a41a702387b5fcc8577;"
# TODO add checksum form 64 bits images
IMAGE_FILE:raspberrypi = "latest-32.zip;sha256sum=660e9fd0c6bd5650574cbbea0773d17a75f05be14ce68a119727dc9200a49a30;"
#SRCREV = "961e9c4589540b2cccb924f17bb051bc8c9ae5c1"
SRC_URI = "git://github.com/pharo-project/opensmalltalk-vm.git;branch=pharo-9;"
SRC_URI += "http://files.pharo.org/image/90/${IMAGE_FILE};"
SRC_URI += "file://001-patch-vm-maker.patch"
S="${WORKDIR}/git"

EXTRA_OECMAKE += "-DFEATURE_LIB_GIT2=off -DFEATURE_LIB_CAIRO=off "
TARGET_CFLAGS:raspberrypi += "-D__ARM_ARCH_6__"
inherit cmake

do_install() {
    install -d ${D}/opt/pharo
    install -d ${D}/opt/pharo/images
    install -m 0755 ${B}/build/vm/* ${D}/opt/pharo
    install -m 0755 ${WORKDIR}/*.image  ${D}/opt/pharo/images/
    install -m 0755 ${WORKDIR}/*.changes ${D}/opt/pharo/images/
    install -m 0755 ${WORKDIR}/*.sources ${D}/opt/pharo/images/
}
PACKAGES = "${PN} ${PN}-dbg" 
FILES:${PN} += "/opt/pharo/*"
# FILES:${PN} += "/opt/images/*"