1705982a5SPatrick WilliamsSUMMARY = "IPMI (Intelligent Platform Management Interface) library and tools"
2705982a5SPatrick WilliamsDESCRIPTION = "OpenIPMI is an effort to create a full-function IPMI system, \
3705982a5SPatrick Williamsto allow full access to all IPMI information on a server \
4705982a5SPatrick Williamsand to abstract it to a level that will make it easy to use"
5705982a5SPatrick Williams
6705982a5SPatrick WilliamsHOMEPAGE = "http://openipmi.sourceforge.net"
7705982a5SPatrick Williams
8705982a5SPatrick WilliamsDEPENDS = " \
9705982a5SPatrick Williams    glib-2.0 \
10705982a5SPatrick Williams    ncurses \
11705982a5SPatrick Williams    net-snmp \
12705982a5SPatrick Williams    openssl \
13705982a5SPatrick Williams    popt \
14705982a5SPatrick Williams    python3 \
15705982a5SPatrick Williams    swig-native \
16705982a5SPatrick Williams    readline \
17705982a5SPatrick Williams    "
18705982a5SPatrick Williams
19705982a5SPatrick WilliamsLICENSE = "GPL-2.0-only & LGPL-2.1-only & BSD-3-Clause"
20705982a5SPatrick Williams
21705982a5SPatrick WilliamsLIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
22705982a5SPatrick Williams                    file://COPYING.LIB;md5=d8045f3b8f929c1cb29a1e3fd737b499 \
23705982a5SPatrick Williams                    file://COPYING.BSD;md5=4b318d4160eb69c8ee53452feb1b4cdf \
24705982a5SPatrick Williams                    "
25705982a5SPatrick Williams
26705982a5SPatrick WilliamsSRC_URI = "${SOURCEFORGE_MIRROR}/openipmi/OpenIPMI-${PV}.tar.gz \
27705982a5SPatrick Williams           file://fix-symlink-install-error-in-cmdlang.patch \
28705982a5SPatrick Williams           file://openipmi-no-openipmigui-man.patch \
29705982a5SPatrick Williams           file://ipmi-init-fix-the-arguments.patch \
30705982a5SPatrick Williams           file://include_sys_types.patch \
31705982a5SPatrick Williams           file://openipmi-helper \
32705982a5SPatrick Williams           file://ipmi.service \
33705982a5SPatrick Williams           "
34705982a5SPatrick Williams
35705982a5SPatrick WilliamsS = "${WORKDIR}/OpenIPMI-${PV}"
36705982a5SPatrick Williams
37705982a5SPatrick WilliamsSRC_URI[sha256sum] = "93227e43c72b5c3bd5949323e0669aa5527d1a971473a3a365af03fb8284a95f"
38705982a5SPatrick Williams
39705982a5SPatrick Williamsinherit autotools-brokensep pkgconfig perlnative update-rc.d systemd cpan-base python3targetconfig
40705982a5SPatrick Williams
41705982a5SPatrick WilliamsCFLAGS += "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
42705982a5SPatrick Williams
43705982a5SPatrick WilliamsEXTRA_OECONF = "--disable-static \
44705982a5SPatrick Williams                --with-perl='${STAGING_BINDIR_NATIVE}/perl-native/perl' \
45*b58112e5SPatrick Williams                --with-glibver=2.0 \
46*b58112e5SPatrick Williams                --with-pythoncflags='-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}' \
47*b58112e5SPatrick Williams               "
48705982a5SPatrick Williams
49705982a5SPatrick WilliamsPACKAGECONFIG ??= "gdbm"
50705982a5SPatrick WilliamsPACKAGECONFIG[gdbm] = "ac_cv_header_gdbm_h=yes,ac_cv_header_gdbm_h=no,gdbm,"
51705982a5SPatrick Williams
52705982a5SPatrick WilliamsPACKAGES += "${PN}-perl ${PN}-python"
53705982a5SPatrick WilliamsPRIVATE_LIBS:${PN}-perl = "libOpenIPMI.so.0"
54705982a5SPatrick Williams
55705982a5SPatrick WilliamsFILES:${PN}-perl = " \
56705982a5SPatrick Williams    ${libdir}/perl/vendor_perl/*/OpenIPMI.pm \
57705982a5SPatrick Williams    ${libdir}/perl/vendor_perl/*/auto/OpenIPMI/OpenIPMI.so \
58705982a5SPatrick Williams    "
59705982a5SPatrick Williams
60705982a5SPatrick WilliamsFILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
61705982a5SPatrick Williams
62705982a5SPatrick WilliamsFILES:${PN}-dbg += " \
63705982a5SPatrick Williams    ${libdir}/perl/vendor_perl/*/auto/OpenIPMI/.debug \
64705982a5SPatrick Williams    ${PYTHON_SITEPACKAGES_DIR}/.debug \
65705982a5SPatrick Williams    "
66705982a5SPatrick Williams
67705982a5SPatrick Williamsdo_configure () {
68705982a5SPatrick Williams    # Let's perform regular configuration first then handle perl issues.
69*b58112e5SPatrick Williams    autotools_do_configure
70705982a5SPatrick Williams
71705982a5SPatrick Williams    perl_ver=`perl -V:version | cut -d\' -f 2`
72705982a5SPatrick Williams
73705982a5SPatrick Williams    # Force openipmi perl bindings to be compiled using perl-native instead of
74705982a5SPatrick Williams    # the host's perl. Set the proper install directory for the resulting
75705982a5SPatrick Williams    # openipmi.pm and openipmi.so
76705982a5SPatrick Williams    for i in ${S}/swig/Makefile ${S}/swig/perl/Makefile; do
77705982a5SPatrick Williams        echo "SAL: i = $i"
78705982a5SPatrick Williams        echo "SAL: STAGING_INCDIR_NATIVE = $STAGING_INCDIR_NATIVE"
79705982a5SPatrick Williams        echo "SAL: libdir = $libdir"
80705982a5SPatrick Williams        sed -i -e "/^PERL_CFLAGS/s:-I/usr/local/include:-I${STAGING_INCDIR_NATIVE}:g" $i
81705982a5SPatrick Williams        sed -i -e "/^PERL_CFLAGS/s:-I .* :-I ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE :g" $i
82705982a5SPatrick Williams        sed -i -e "/^PERL_INSTALL_DIR/s:^PERL_INSTALL_DIR = .*:PERL_INSTALL_DIR = ${libdir}/perl/vendor_perl/$perl_ver:g" $i
83705982a5SPatrick Williams    done
84705982a5SPatrick Williams}
85705982a5SPatrick Williams
86705982a5SPatrick Williamsdo_compile:append () {
87705982a5SPatrick Williams    sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' ${S}/swig/perl/OpenIPMI_wrap.c
88705982a5SPatrick Williams}
89705982a5SPatrick Williams
90705982a5SPatrick Williamsdo_install:append () {
91705982a5SPatrick Williams    echo "SAL: D = $D"
92705982a5SPatrick Williams    echo "SAL: libdir = $libdir"
93705982a5SPatrick Williams    install -m 0755 -d ${D}${sysconfdir}/sysconfig ${D}${sysconfdir}/init.d
94705982a5SPatrick Williams    install -m 0755 ${S}/ipmi.init ${D}${sysconfdir}/init.d/ipmi
95705982a5SPatrick Williams    install -m 0644 ${S}/ipmi.sysconf ${D}${sysconfdir}/sysconfig/ipmi
96705982a5SPatrick Williams    # SAL: mv: cannot stat `/localdisk/loadbuild/slittle1/workspace/cgts_test_build/bitbake_build/tmp/work/x86_64-wrs-linux/openipmi-2.0.19-r4/image/usr/lib64/perl5': No such file or directory
97705982a5SPatrick Williams    # SAL: real path to perl is /localdisk/loadbuild/slittle1/workspace/cgts_test_build/bitbake_build/tmp/work/x86_64-wrs-linux/perl-5.14.2-r8.3/package/usr/lib64/perl5 and it is a symlink to perl so no need to mv.
98705982a5SPatrick Williams    if [ -d ${D}${libdir}/perl5 ]
99705982a5SPatrick Williams    then
100705982a5SPatrick Williams        mv ${D}${libdir}/perl5 ${D}${libdir}/perl
101705982a5SPatrick Williams    fi
102705982a5SPatrick Williams
103705982a5SPatrick Williams    # for systemd
104705982a5SPatrick Williams    install -d ${D}${systemd_unitdir}/system
105705982a5SPatrick Williams    install -m 0664 ${WORKDIR}/ipmi.service ${D}${systemd_unitdir}/system
106705982a5SPatrick Williams    sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" ${D}${systemd_unitdir}/system/ipmi.service
107705982a5SPatrick Williams    install -d ${D}${libexecdir}
108705982a5SPatrick Williams    install -m 0755 ${WORKDIR}/openipmi-helper ${D}${libexecdir}
109705982a5SPatrick Williams}
110705982a5SPatrick Williams
111705982a5SPatrick WilliamsINITSCRIPT_NAME = "ipmi"
112705982a5SPatrick WilliamsINITSCRIPT_PARAMS = "start 30 . stop 70 0 1 2 3 4 5 6 ."
113705982a5SPatrick Williams
114705982a5SPatrick WilliamsSYSTEMD_SERVICE:${PN} = "ipmi.service"
115705982a5SPatrick WilliamsSYSTEMD_AUTO_ENABLE = "disable"
116