libdnf: add support for python2
[pti/rtp.git] / meta-stx / recipes-devtools / libdnf / libdnf_0.26.0.bbappend
1 #
2 # Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 DEPENDS += "\
17     python-native \
18     "
19
20 EXTRA_OECMAKE_PY2 = " \
21     -DPYTHON_INSTALL_DIR=${libdir}/python2.7/site-packages \
22     -DPYTHON_DESIRED:FILEPATH=${STAGING_BINDIR_NATIVE}/python-native/python \
23     -DWITH_MAN=OFF \
24     ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DWITH_GIR=ON', '-DWITH_GIR=OFF', d)} \
25     -DWITH_TESTS=OFF \
26     "
27
28 do_configure_append() {
29         rm -rf ${B}/build-py2
30         mkdir -p ${B}/build-py2
31         cd ${B}/build-py2
32
33         cmake \
34           ${OECMAKE_GENERATOR_ARGS} \
35           $oecmake_sitefile \
36           ${OECMAKE_SOURCEPATH} \
37           -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
38           -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
39           -DCMAKE_INSTALL_SO_NO_EXE=0 \
40           -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
41           -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
42           ${EXTRA_OECMAKE_PY2} \
43           -Wno-dev
44 }
45
46 cmake_runcmake_build_py2() {
47         bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}/build-py2' "$@" -- ${EXTRA_OECMAKE_BUILD}
48         eval ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}/build-py2' "$@" -- ${EXTRA_OECMAKE_BUILD}
49 }
50
51 do_compile_append() {
52         cd ${B}/build-py2
53         cmake_runcmake_build_py2 --target ${OECMAKE_TARGET_COMPILE}
54 }
55
56 do_install_append() {
57         cd ${B}/build-py2
58         DESTDIR='${D}' cmake_runcmake_build_py2 --target ${OECMAKE_TARGET_INSTALL}
59 }
60