From 614ffee6c2af9b8538cc94802b8a1854c53aeb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Mon, 24 May 2021 22:54:39 +0700 Subject: [PATCH] build-style: introduce sip-build --- common/build-style/sip-build.sh | 65 +++++++++++++++++++++ common/environment/build-style/sip-build.sh | 6 ++ 2 files changed, 71 insertions(+) create mode 100644 common/build-style/sip-build.sh create mode 100644 common/environment/build-style/sip-build.sh diff --git a/common/build-style/sip-build.sh b/common/build-style/sip-build.sh new file mode 100644 index 00000000000000..1cde601ee82e38 --- /dev/null +++ b/common/build-style/sip-build.sh @@ -0,0 +1,65 @@ +# +# This helper is for templates using sip-build. +# + +do_configure() { + local _build_help= + local _qmake= + local _confirm_license= + local _apidir= + local _dbusdir= + : "${sip_builddir:=build}" + mkdir -p "${sip_builddir}" + + _build_help="$(sip-build --help)" + case "$_build_help" in + *--confirm-license*) _confirm_license=yes ;; + esac + case "$_build_help" in + *--qmake*) + if [ "$QMAKE" ]; then + _qmake="$QMAKE" + elif [ -x /usr/lib/qt6/bin/qmake ]; then + _qmake=/usr/lib/qt6/bin/qmake + elif [ -x /usr/lib/qt5/bin/qmake ]; then + _qmake=/usr/lib/qt5/bin/qmake + else + msg_error 'qmake not found\n' + fi + ;; + esac + case "$_build_help" in + *--dbus*) + for _dbusdir in "$XBPS_CROSS_BASE/usr/include/dbus"*; do + if [ -f "$_dbusdir/dbus/dbus-python.h" ]; then + break + fi + done + ;; + esac + + sip-build --no-make \ + ${_confirm_license:+--confirm-license} \ + ${_apidir:+--api-dir "$_apidir"} \ + ${_qmake:+--qmake "$_qmake"} \ + ${_dbusdir:+--dbus "$_dbusdir"} \ + --build-dir "${sip_builddir}" + + if [ "$CROSS_BUILD" ]; then + # -I/usr/include/python$py3_ver is set by sip-build :( + find "${sip_builddir}" -name Makefile | + xargs sed -i "s,-I\\(/usr/include\\),-I$XBPS_CROSS_BASE\\1,g" + fi +} + +do_build() { + : "${sip_builddir:=build}" + make -C "${sip_builddir}" ${makejobs} +} + +do_install() { + : "${sip_builddir:=build}" + make -C "${sip_builddir}" \ + DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} \ + install +} diff --git a/common/environment/build-style/sip-build.sh b/common/environment/build-style/sip-build.sh new file mode 100644 index 00000000000000..ffaefc90ce4753 --- /dev/null +++ b/common/environment/build-style/sip-build.sh @@ -0,0 +1,6 @@ +hostmakedepends+=" python3-PyQt-builder pkg-config" +makedepends+=" python3-devel" +lib32disabled=yes + +CFLAGS+=" -I$XBPS_CROSS_BASE/usr/include/python$py3_ver" +CXXFLAGS+=" -I$XBPS_CROSS_BASE/usr/include/python$py3_ver"