Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | # Copyright (C) 2017 Armin Kuster <akuster808@gmail.com> |
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 3 | |
| 4 | SUMARRY = "NIST Certified SCAP 1.2 toolkit" |
| 5 | HOME_URL = "https://www.open-scap.org/tools/openscap-base/" |
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" |
| 7 | LICENSE = "LGPL-2.1" |
| 8 | |
| 9 | DEPENDS = "autoconf-archive pkgconfig gconf procps curl libxml2 rpm \ |
| 10 | libxslt libcap swig swig-native" |
| 11 | |
| 12 | DEPENDS_class-native = "autoconf-archive-native pkgconfig-native swig-native curl-native libxml2-native libxslt-native dpkg-native libgcrypt-native nss-native" |
| 13 | |
| 14 | SRCREV = "59c234b3e9907480c89dfbd1b466a6bf72a2d2ed" |
| 15 | SRC_URI = "git://github.com/akuster/openscap.git;branch=oe \ |
| 16 | file://crypto_pkgconfig.patch \ |
| 17 | file://run-ptest \ |
| 18 | " |
| 19 | |
| 20 | inherit autotools-brokensep pkgconfig python3native perlnative ptest |
| 21 | |
| 22 | S = "${WORKDIR}/git" |
| 23 | |
| 24 | PACKAGECONFIG ?= "nss3 pcre rpm" |
| 25 | PACKAGECONFIG[pcre] = ",--enable-regex-posix, libpcre" |
| 26 | PACKAGECONFIG[gcrypt] = "--with-crypto=gcrypt,, libgcrypt " |
| 27 | PACKAGECONFIG[nss3] = "--with-crypto=nss3,, nss" |
| 28 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python, python" |
| 29 | PACKAGECONFIG[python3] = "--enable-python3, --disable-python3, python3, python3" |
| 30 | PACKAGECONFIG[perl] = "--enable-perl, --disable-perl, perl, perl" |
| 31 | PACKAGECONFIG[rpm] = " --enable-util-scap-as-rpm, --disable-util-scap-as-rpm, rpm, rpm" |
| 32 | |
| 33 | export LDFLAGS += " -ldl" |
| 34 | |
| 35 | EXTRA_OECONF += "--enable-probes-independent --enable-probes-linux \ |
| 36 | --enable-probes-solaris --enable-probes-unix --disable-util-oscap-docker\ |
| 37 | --enable-util-oscap-ssh --enable-util-oscap --enable-ssp --enable-sce \ |
| 38 | " |
| 39 | |
| 40 | EXTRA_OECONF_class-native += "--disable-probes-independent --enable-probes-linux \ |
| 41 | --disable-probes-solaris --disable-probes-unix \ |
| 42 | --enable-util-oscap \ |
| 43 | " |
| 44 | |
| 45 | do_configure_prepend () { |
| 46 | sed -i 's:-I/usr/include:-I${STAGING_INCDIR}:' ${S}/swig/perl/Makefile.am |
| 47 | sed -i 's:-I/usr/include:-I${STAGING_INCDIR}:' ${S}/swig/python3/Makefile.am |
| 48 | sed -i 's:-I/usr/include:-I${STAGING_INCDIR}:' ${S}/swig/python2/Makefile.am |
| 49 | sed -i 's:python2:python:' ${S}/utils/scap-as-rpm |
| 50 | } |
| 51 | |
| 52 | |
| 53 | include openscap.inc |
| 54 | |
| 55 | do_configure_append_class-native () { |
| 56 | sed -i 's:OSCAP_DEFAULT_CPE_PATH.*$:OSCAP_DEFAULT_CPE_PATH "${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe":' ${S}/config.h |
| 57 | sed -i 's:OSCAP_DEFAULT_SCHEMA_PATH.*$:OSCAP_DEFAULT_SCHEMA_PATH "${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas":' ${S}/config.h |
| 58 | sed -i 's:OSCAP_DEFAULT_XSLT_PATH.*$:OSCAP_DEFAULT_XSLT_PATH "${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl":' ${S}/config.h |
| 59 | } |
| 60 | |
| 61 | do_clean[cleandirs] += " ${STAGING_OSCAP_BUILDDIR}" |
| 62 | |
| 63 | do_install_append_class-native () { |
| 64 | oscapdir=${STAGING_OSCAP_BUILDDIR}/${datadir_native} |
| 65 | install -d $oscapdir |
| 66 | cp -a ${D}/${STAGING_DATADIR_NATIVE}/openscap $oscapdir |
| 67 | } |
| 68 | |
| 69 | TESTDIR = "tests" |
| 70 | |
| 71 | do_compile_ptest() { |
| 72 | sed -i 's:python2:python:' ${S}/${TESTDIR}/nist/test_worker.py |
| 73 | echo 'buildtest-TESTS: $(check)' >> ${TESTDIR}/Makefile |
| 74 | oe_runmake -C ${TESTDIR} buildtest-TESTS |
| 75 | } |
| 76 | |
| 77 | do_install_ptest() { |
| 78 | # install the tests |
| 79 | cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH} |
| 80 | } |
| 81 | |
| 82 | FILES_${PN} += "${PYTHON_SITEPACKAGES_DIR}" |
| 83 | |
| 84 | RDEPENDS_${PN} += "libxml2 python libgcc" |
| 85 | RDEPENDS_${PN}-ptest = "bash perl python" |
| 86 | |
| 87 | BBCLASSEXTEND = "native" |