Changeset View
Standalone View
Mk/Uses/qmake.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# There are three Qt related USES files with different access to Qt. | |||||
# - qmake: The port requires Qt's qmake to build -- creates the configure target | |||||
# - auto includes qt.mk | |||||
# - qt-dist: The port is a port for an part of Qt4 or Qt5 | |||||
# - auto inclues qt.mk | |||||
# - qt.mk - Dependency handling. USE_QT=foo bar | |||||
# | |||||
# | |||||
# Provide support for qmake-based projects | # Provide support for qmake-based projects | ||||
# | # | ||||
# Feature: qmake | # Feature: qmake | ||||
# Usage: USES=qmake or USES=qmake:ARGS | # Usage: USES=qmake or USES=qmake:ARGS | ||||
# Must be used along with 'USE_QT*=#' | # Must be used along with 'USE_QT*=#' | ||||
# Valid ARGS: norecursive outsource | # Valid ARGS: norecursive outsource | ||||
# ARGS description: | # ARGS description: | ||||
# norecursive Don't pass -recursive argument to qmake binary | # norecursive Don't pass -recursive argument to qmake binary | ||||
# outsource Perform an out-of-source build | # outsource Perform an out-of-source build | ||||
# no_env Suppress modification of configure and make environment. | |||||
# no_configure Don't add the configure target -- this is implied by | |||||
# HAS_CONFIGURE=yes and GNU_CONFIGURE=yes | |||||
# | # | ||||
# | # | ||||
# Variables for ports: | # Variables for ports: | ||||
# QMAKE_ENV - Environment passed to qmake. | # QMAKE_ENV - Environment passed to qmake. | ||||
# Default: ${CONFIGURE_ENV} | # Default: ${CONFIGURE_ENV} | ||||
# QMAKE_ARGS - Arguments passed to qmake. | # QMAKE_ARGS - Arguments passed to qmake. | ||||
# Default: see below | # Default: see below | ||||
# QMAKE_CONFIGURE_ARGS - Extra arguments passed to qmake after everything | # QMAKE_CONFIGURE_ARGS - Extra arguments passed to qmake after everything | ||||
# else, such as "-foo -no-bar". The arguments are usually | # else, such as "-foo -no-bar". The arguments are usually | ||||
# set in configure.json. This variable is specific to | # set in configure.json. This variable is specific to | ||||
# qmake from Qt 5. | # qmake from Qt 5. | ||||
# Default: empty | # Default: empty | ||||
# QMAKE_SOURCE_PATH - Path to qmake project files. | # QMAKE_SOURCE_PATH - Path to qmake project files. | ||||
# Default: ${WRKSRC} if out-of-source build is | # Default: ${WRKSRC} if out-of-source build is | ||||
# requested, empty otherwise. | # requested, empty otherwise. | ||||
# | # | ||||
# User defined variables: | # User defined variables: | ||||
# QMAKE_VERBOSE - Enable verbose configure output. | # QMAKE_VERBOSE - Enable verbose configure output. | ||||
# | # | ||||
# MAINTAINER: kde@FreeBSD.org | # MAINTAINER: kde@FreeBSD.org | ||||
.if !defined(_INCLUDE_USES_QMAKE_MK) | .if !defined(_INCLUDE_USES_QMAKE_MK) | ||||
_INCLUDE_USES_QMAKE_MK= yes | _INCLUDE_USES_QMAKE_MK= yes | ||||
# _QT_VERSION is defined in bsd.qt.mk, only if a correct Qt version was selected | # Suck in qt.mk | ||||
# via USE_QT*. | .include "${USESDIR}/qt.mk" | ||||
.if empty(_QT_VERSION) | |||||
IGNORE= 'USES+= qmake' must be accompanied with 'USE_QT[${_QT_SUPPORTED:S/ //g}]= #' | |||||
.endif | |||||
# _env is a private argument used only by bsd.qt.mk to get variables and custom | _VALID_ARGS= norecursive outsource no_env no_configure | ||||
# targets (currently, only qmake-configure), without qmake being added to the | |||||
# configure stage. | |||||
_VALID_ARGS= norecursive outsource _env | |||||
.for arg in ${qmake_ARGS} | . for arg in ${qmake_ARGS} | ||||
. if empty(_VALID_ARGS:M${arg}) | . if empty(_VALID_ARGS:M${arg}) | ||||
IGNORE= Incorrect 'USES+= qmake' usage: argument '${arg}' is not recognized | IGNORE= Incorrect 'USES+= qmake' usage: argument '${arg}' is not recognized | ||||
. endif | . endif | ||||
.endfor | . endfor | ||||
.if ! ${qmake_ARGS:M_env} | # Check whether we need to add the configure target | ||||
USE_QT${_QT_VERSION:R:R}+= qmake_build | _ADD_CONFIGURE_TARGET= yes | ||||
. if !empty(qmake_ARGS:Mno_configure) || defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE) | |||||
_ADD_CONFIGURE_TARGET= # unset | |||||
.endif | . endif | ||||
mat: That should not be needed, qmake_ARGS should always be defined, unless this is because we can… | |||||
Not Done Inline ActionsExactly, this is needed for ports like qmake with: USES= qt-dist:4 tcberner: Exactly, this is needed for ports like qmake with:
```
USES= qt-dist:4
``` | |||||
Not Done Inline ActionsI think qt-dist should do a qt_ARGS?= so that qt is not special like that in any way mat: I think qt-dist should do a `qt_ARGS?=` so that qt is not special like that in any way | |||||
# QMAKESPEC belongs to bsd.qt.mk. | # QMAKESPEC belongs to bsd.qt.mk. | ||||
QMAKE_ENV?= ${CONFIGURE_ENV} | QMAKE_ENV?= ${CONFIGURE_ENV} | ||||
QMAKE_ARGS+= -spec ${QMAKESPEC} \ | QMAKE_ARGS+= -spec ${QMAKESPEC} \ | ||||
QMAKE_CC="${CC}" QMAKE_CXX="${CXX}" \ | QMAKE_CC="${CC}" QMAKE_CXX="${CXX}" \ | ||||
QMAKE_LINK_C="${CC}" QMAKE_LINK_C_SHLIB="${CC}" \ | QMAKE_LINK_C="${CC}" QMAKE_LINK_C_SHLIB="${CC}" \ | ||||
QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" \ | QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" \ | ||||
QMAKE_CFLAGS="${CFLAGS}" \ | QMAKE_CFLAGS="${CFLAGS}" \ | ||||
QMAKE_CXXFLAGS="${CXXFLAGS}" \ | QMAKE_CXXFLAGS="${CXXFLAGS}" \ | ||||
QMAKE_LFLAGS="${LDFLAGS}" \ | QMAKE_LFLAGS="${LDFLAGS}" \ | ||||
QMAKE_LIBS="${LIBS}" \ | QMAKE_LIBS="${LIBS}" \ | ||||
QMAKE_CFLAGS_DEBUG="" \ | QMAKE_CFLAGS_DEBUG="" \ | ||||
QMAKE_CFLAGS_RELEASE="" \ | QMAKE_CFLAGS_RELEASE="" \ | ||||
QMAKE_CXXFLAGS_DEBUG="" \ | QMAKE_CXXFLAGS_DEBUG="" \ | ||||
QMAKE_CXXFLAGS_RELEASE="" \ | QMAKE_CXXFLAGS_RELEASE="" \ | ||||
PREFIX="${PREFIX}" | PREFIX="${PREFIX}" | ||||
.if defined(WITH_DEBUG) | . if defined(WITH_DEBUG) | ||||
PLIST_SUB+= DEBUG="" | |||||
QMAKE_ARGS+= CONFIG+="debug" \ | QMAKE_ARGS+= CONFIG+="debug" \ | ||||
CONFIG-="release" | CONFIG-="release" | ||||
.else | . else | ||||
PLIST_SUB+= DEBUG="@comment " | |||||
QMAKE_ARGS+= CONFIG+="release" \ | QMAKE_ARGS+= CONFIG+="release" \ | ||||
CONFIG-="debug separate_debug_info" | CONFIG-="debug separate_debug_info" | ||||
.endif # defined(WITH_DEBUG) | . endif # defined(WITH_DEBUG) | ||||
# We set -recursive by default to keep qmake from running in the build stage. | # We set -recursive by default to keep qmake from running in the build stage. | ||||
.if ! ${qmake_ARGS:Mnorecursive} | . if ! ${qmake_ARGS:Mnorecursive} | ||||
QMAKE_ARGS+= -recursive | QMAKE_ARGS+= -recursive | ||||
.endif | . endif | ||||
.if defined(QMAKE_VERBOSE) | . if defined(QMAKE_VERBOSE) | ||||
QMAKE_ARGS+= -d | QMAKE_ARGS+= -d | ||||
.endif | . endif | ||||
# _QMAKE_WRKSRC (and _QMAKE, below) are needed to abstract the qmake target and | # _QMAKE_WRKSRC (and _QMAKE, below) are needed to abstract the qmake target and | ||||
# use it for both qtbase and USES=qmake ports. They are private, not supposed to | # use it for both qtbase and USES=qmake ports. They are private, not supposed to | ||||
# be used anywhere else. | # be used anywhere else. | ||||
_QMAKE_WRKSRC?= ${CONFIGURE_WRKSRC} | _QMAKE_WRKSRC?= ${CONFIGURE_WRKSRC} | ||||
.if ${qmake_ARGS:Moutsource} | . if ${qmake_ARGS:Moutsource} | ||||
CONFIGURE_WRKSRC= ${WRKDIR}/.build | CONFIGURE_WRKSRC= ${WRKDIR}/.build | ||||
BUILD_WRKSRC= ${CONFIGURE_WRKSRC} | BUILD_WRKSRC= ${CONFIGURE_WRKSRC} | ||||
INSTALL_WRKSRC= ${BUILD_WRKSRC} | INSTALL_WRKSRC= ${BUILD_WRKSRC} | ||||
TEST_WRKSRC= ${BUILD_WRKSRC} | TEST_WRKSRC= ${BUILD_WRKSRC} | ||||
QMAKE_SOURCE_PATH?= ${WRKSRC} | QMAKE_SOURCE_PATH?= ${WRKSRC} | ||||
.else | . else | ||||
QMAKE_SOURCE_PATH?= # empty | QMAKE_SOURCE_PATH?= # empty | ||||
.endif | . endif | ||||
.if ! ${qmake_ARGS:M_env} | # Add qmake to USE_QT -- unless it's qmake itself | ||||
. if !${PORTNAME} == qmake | |||||
USE_QT+= qmake_build | |||||
Not Done Inline ActionsI may have missed it, but I did not see where there was something making sure qmake was included before qt. mat: I may have missed it, but I did not see where there was something making sure qmake was… | |||||
Not Done Inline ActionsWould a match ala .if empty(USES:Mqt.*qmake) IGNORE=qmake must appear before qt in USES .endif work? tcberner: Would a match ala
```
.if empty(USES:Mqt.*qmake)
IGNORE=qmake must appear before qt in USES
. | |||||
Not Done Inline ActionsNo, it has to work whatever the order they are added. You'll have to include qt.mk after ading to USE_QT. I see that qt.mk is already included early here, so adding to USE_QT doesn't, does it? Or maybe it is handled in POST so it does work. mat: No, it has to work whatever the order they are added. You'll have to include qt.mk after ading… | |||||
Not Done Inline ActionsI think I added the POST stuff because of this, but I have to check whether it works in any order already. tcberner: I think I added the POST stuff because of this, but I have to check whether it works in any… | |||||
Not Done Inline ActionsPlease do test, it works whatever the order USES is set. (There is a sort police that likes to have it sorted, but the order is really undefined.) mat: Please do test, it works whatever the order USES is set. (There is a sort police that likes to… | |||||
Not Done Inline Actions# make -VUSES -VUSE_QT -Cdevel/qbs compiler:c++11-lib python:run qt:5 qmake:outsource shebangfix buildtools_build core concurrent gui network script testlib widgets xml qmake_build seems to work \o/ tcberner: ```
# make -VUSES -VUSE_QT -Cdevel/qbs
compiler:c++11-lib python:run qt:5 qmake:outsource… | |||||
. endif | |||||
. if empty(qmake_ARGS:Mno_env) | |||||
DESTDIRNAME= INSTALL_ROOT | DESTDIRNAME= INSTALL_ROOT | ||||
CONFIGURE_ENV+= QTDIR="${QT_ARCHDIR}" QMAKE="${QMAKE}" \ | |||||
MOC="${MOC}" RCC="${RCC}" UIC="${UIC}" \ | |||||
QMAKESPEC="${QMAKESPEC}" | |||||
CONFIGURE_ARGS+= --with-qt-includes=${QT_INCDIR} \ | |||||
--with-qt-libraries=${QT_LIBDIR} \ | |||||
--with-extra-includes=${LOCALBASE}/include \ | |||||
--with-extra-libs=${LOCALBASE}/lib | |||||
.endif | . endif | ||||
_USES_POST+= qmake | |||||
.endif # _QMAKE_MK_INCLUDED | |||||
# ============================================================================= | |||||
# | |||||
# ============================================================================= | |||||
.if defined(_POSTMKINCLUDED) && !defined(_QMAKE_MK_POST_INCLUDED) | |||||
_QMAKE_MK_POST_INCLUDED= qmake.mk | |||||
# Define a custom target to make it usable by bsd.qt.mk for internal Qt | # Define a custom target to make it usable by bsd.qt.mk for internal Qt | ||||
# configuration. | # configuration. | ||||
qmake-configure: | qmake-configure: | ||||
@${MKDIR} ${_QMAKE_WRKSRC} | @${MKDIR} ${_QMAKE_WRKSRC} | ||||
@cd ${_QMAKE_WRKSRC} && \ | @cd ${_QMAKE_WRKSRC} && \ | ||||
${SETENV} ${QMAKE_ENV} ${_QMAKE} ${QMAKE_ARGS} \ | ${SETENV} ${QMAKE_ENV} ${_QMAKE} ${QMAKE_ARGS} \ | ||||
${QMAKE_SOURCE_PATH} \ | ${QMAKE_SOURCE_PATH} \ | ||||
${QMAKE_CONFIGURE_ARGS:?--:} ${QMAKE_CONFIGURE_ARGS} | ${QMAKE_CONFIGURE_ARGS:?--:} ${QMAKE_CONFIGURE_ARGS} | ||||
.if !target(do-configure) && ! ${qmake_ARGS:M_env} | . if !target(do-configure) && !empty(_ADD_CONFIGURE_TARGET) | ||||
_USES_configure+= 450:qmake-configure | _USES_configure+= 450:qmake-configure | ||||
.endif | . endif | ||||
.endif # !defined(_INCLUDE_USES_QMAKE_MK) | .endif # !defined(_INCLUDE_USES_QMAKE_MK) |
That should not be needed, qmake_ARGS should always be defined, unless this is because we can come here from USES=qt-dist.