Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2001 12:48:37 -0500
From:      Will Andrews <will@physics.purdue.edu>
To:        Joe Glass <joe@glass.cl.msu.edu>
Cc:        will@FreeBSD.org, ports@FreeBSD.org
Subject:   Re: FreeBSD Port: qt-2.3.0
Message-ID:  <20010622124837.G74316@bohr.physics.purdue.edu>
In-Reply-To: <3B335A83.F4B91BCC@glass.cl.msu.edu>; from joe@glass.cl.msu.edu on Fri, Jun 22, 2001 at 10:47:31AM -0400
References:  <3B335A83.F4B91BCC@glass.cl.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 22, 2001 at 10:47:31AM -0400, Joe Glass (joe@glass.cl.msu.edu) wrote:
> Hi Will, I'm having a lot of trouble compiling KDE applications on my
> FreeBSD 4.3 box.  It seems like none of them know where any of the Qt
> files are.  When I compile, I'm trying ./configure
> --with-qt-includes=/usr/X11R6/include/qt2
> --with-qt-libraries=/usr/X11R6/lib.  I sometimes also have to set the
> MOC variable to the full path to moc2.  Are the above the right step
> towards compiling KDE applications, or am I doing this wrong?  Also, it
> seems the paths for qt23 are not standard, I'm curious to why they are?  

Hi Joe,

You have to realize that the configure arguments aren't enough.
If you look at ports/Mk/bsd.kde.mk, you'll notice that there's a
lot of other stuff there, most notably configure environment
vars.  That's the most common mistake people make -- they assume
(and probably rightfully) that they only need arguments, but you
also need environment variables set when running configure.

So, if you also look at ports/Mk/bsd.port.mk, you'll see that
configure is run like this:

do-configure:
.if defined(USE_AUTOMAKE)
	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOMAKE_ENV} ${AUTOMAKE} \
		${AUTOMAKE_ARGS})
.endif
.if defined(USE_AUTOCONF)
	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOCONF_ENV} ${AUTOCONF} \
		${AUTOCONF_ARGS})
.endif
	@if [ -f ${SCRIPTDIR}/configure ]; then \
		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
			${SCRIPTDIR}/configure; \
	fi
.if defined(HAS_CONFIGURE)
	@(cd ${CONFIGURE_WRKSRC} && \
		if !  ${SETENV} CC="${CC}" CXX="${CXX}" \
		CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
		INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
		INSTALL_DATA="${INSTALL_DATA}" \
		INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
		INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
		${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}; then \
			${ECHO} "===>  Script \"${CONFIGURE_SCRIPT}\" failed: here are the contents of \"${CONFIGURE_LOG}\""; \
	                ${CAT} ${CONFIGURE_LOG}; \
			${ECHO} "(end of \"${CONFIGURE_LOG}\")"; \
			${FALSE}; \
		fi)
.endif
.if defined(PERL_CONFIGURE)
	@cd ${CONFIGURE_WRKSRC} && \
	${SETENV} ${CONFIGURE_ENV} \
	${PERL5} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
.endif
.if defined(USE_IMAKE)
	@(cd ${CONFIGURE_WRKSRC}; ${SETENV} ${MAKE_ENV} ${XMKMF})
.endif
.endif

So, as you can see, the various GNU utilities are run in
sequential order as needed (this varies for each port, but for
most only HAS_CONFIGURE section is required).  And as you can
see, the part I'm trying to point out is:

	${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}

Where, for any and (nearly) all QT2-based apps:

CONFIGURE_ARGS+=--with-qt-includes=${X11BASE}/include/qt2 \
		--with-qt-libraries=${X11BASE}/lib \
		--with-extra-libs=${LOCALBASE}/lib
CONFIGURE_ENV+=	MOC="${MOC}" LIBQT="-l${QTNAME}" \
		CPPFLAGS="${QTCPPFLAGS}" LIBS="${QTCFGLIBS}"
QTCPPFLAGS+=    -I/usr/include -D_GETOPT_H -D_PTH_H_ -D_PTH_PTHREAD_H_ \
		-I${LOCALBASE}/include -I${PREFIX}/include -I${X11BASE}/include/qt2
QTCFGLIBS+=     -Wl,-export-dynamic -L${LOCALBASE}/lib -L${X11BASE}/lib -ljpeg -lgcc -lstdc++

If you look at these vars closely you'll notice that
QT{CPPFLAGS,CFGLIBS} are not generally port variables.  They're
specially designed for QT2-based apps.  Some QT2-based apps don't
use this consistently broken style and os you may need to remove
these variables, replacing them with whatever is appropriate.
See QT_NONSTANDARD in ports/Mk/bsd.kde.mk.  Also, notice these
are all referred with '+=' not '='.  That's because the port may
have some others defined already, so first we define
QT{CPPFLAGS,CFGLIBS}?=  (blank variable) to allow QT_NONSTANDARD
to work properly.  The -D_PTH_* stuff is to prevent conflicts
with some really stupidly constructed pthreads-ish ports.
-D_GETOPT_H is for the libgnugetopt port.

Anyways, that's the gist of qt/kde support.  I mainly hacked it
together in few days based on about two years' experience with
the various qt/kde stuff, and this is the "API" to create ports
based on QT/QT2/KDE/KDE2 applications -- right in bsd.kde.mk.

Oh, and the reason why they're nonstandard.. is because in
FreeBSD, we install things in organized ways.  Libraries go where
libraries go, headers go where headers go, binaries go where
binaries go.. not everything for one package under a prefix.  See
hier(7) for more information.

Woo, that was long.  I should throw this message in some
documentation file somewhere.  Hopefully I've helped you too.

-- 
wca

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010622124837.G74316>