You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

310 lines
11 KiB

##
## qt.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: qt
Summary: The Qt Toolkit
URL: http://www.trolltech.com/products/qt/x11.html
Vendor: TrollTech AS
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: XWindow
License: GPL
Version: 3.3.8
Release: 20080101
# package options
%option with_threads yes
%option with_pgsql no
%option with_mysql no
%option with_tools no
# list of sources
Source0: ftp://ftp.trolltech.com/pub/qt/source/qt-x11-free-%{version}.tar.gz
Patch0: qt.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, X11, xft, mesa, gcc, sed
PreReq: OpenPKG, openpkg >= 20040130, X11, xft, mesa
%if "%{with_pgsql}" == "yes"
BuildPreReq: postgresql
PreReq: postgresql
%endif
%if "%{with_mysql}" == "yes"
BuildPreReq: mysql
PreReq: mysql
%endif
AutoReq: no
AutoReqProv: no
%description
Qt is a GUI (graphical user interface) software toolkit which
simplifies the task of writing and maintaining GUIs, and allows
the developer to create prototypes and feature-rich applications
quickly. Offering C++ library bindings, Qt enables development
in an object-oriented environment and appeals to developers with
portability in mind. Qt's portable C++ library bindings allow
for error-free recompiling on at least the three major platforms
Unix (and Linux), Apple Macintosh, and Microsoft Windows. Its
API architecture is designed to reduce complexity and increase
reliability through a signal and slot mechanism, which is similar to
templates in C++, but with influences from component technology.
%track
prog qt = {
version = %{version}
url = ftp://ftp.trolltech.com/pub/qt/source/
regex = qt-x11-free-(\d+\.\d+\.\d+)\.tar\.(gz|bz2)
}
%prep
%setup -q -n qt-x11-free-%{version}
%patch -p0
# avoid dependencies external to OpenPKG instance
%{l_shtool} subst \
-e 's;[ \t]*/usr/local/include;;g' \
-e 's;[ \t]*/usr/local/lib;;g' \
mkspecs/darwin-g++/qmake.conf \
mkspecs/freebsd-g++/qmake.conf \
mkspecs/netbsd-g++/qmake.conf \
mkspecs/macx-pbuilder/qmake.conf \
mkspecs/openbsd-g++/qmake.conf
# correctly detect OpenPKG xrender and xft installations
%{l_shtool} subst \
-e 's;[^A-Za-z_]\(INCDIRS="\);\1%{l_prefix}/include ;g' \
-e 's;^\(LIBDIRS="\);\1%{l_prefix}/lib ;g' \
config.tests/x11/xfreetype.test \
config.tests/x11/xrender.test
%{l_shtool} subst \
-e 's;freetype2/freetype/;freetype/;g' \
-e 's;freetype2;freetype;g' \
-e "s;-lfontconfig;`%{l_prefix}/bin/pkg-config --libs-only-l fontconfig`;" \
config.tests/x11/xfreetype.test
# repair nonstandard posix thread test macro usage
%{l_shtool} subst \
-e 's/\(defined(_POSIX_THREAD_SAFE_FUNCTIONS)\)/(\1 \&\& _POSIX_THREAD_SAFE_FUNCTIONS-0>0)/g' \
src/dialogs/qfiledialog.cpp src/kernel/qfont_x11.cpp \
src/tools/qdatetime.cpp src/tools/qdir_unix.cpp
%build
# display a warning that this package is a beast
( echo "The qt package may require up to 625 Mb of temporary disk"
echo "space and 1 to 4 hours (depending on options) to build on"
echo "a 800 MHz system. Therefore, please be prepared and patient."
) | %{l_rpmtool} msg -b -t notice
# set HOME to a writable directory for qsettings
# and set QTDIR to just the source tree directory
# and determine the target platform to build
HOME=`pwd`
QTDIR=`pwd`
case "%{l_platform -t}" in
*-freebsd* ) oscomp="freebsd-g++" ;;
*-linux* ) oscomp="linux-g++" ;;
*-sunos* ) oscomp="solaris-g++" ;;
* ) echo "platform %{l_platform -t} not supported" 2>&1; exit 1 ;;
esac
# calculate X11 paths in advance
l_x11_incdir=`%{l_rc} --query x11_incdir`
l_x11_libdir=`%{l_rc} --query x11_libdir`
# special trolltech configuration
CC="%{l_cc}" \
CXX="%{l_cxx}" \
CFLAGS="%{l_cflags -O}" \
CXXFLAGS="%{l_cxxflags -O}" \
echo "yes" | ./configure \
%if "%{with_pgsql}" == "yes"
-qt-sql-psql \
%endif
%if "%{with_mysql}" == "yes"
-qt-sql-mysql \
%endif
-platform $oscomp \
-prefix %{l_prefix} \
-docdir %{l_prefix}/share/qt/doc \
-datadir %{l_prefix}/share/qt/data \
-plugindir %{l_prefix}/share/qt/plugins \
-translationdir %{l_prefix}/share/qt/translations \
-sysconfdir %{l_prefix}/etc/qt \
-release -static -stl -sm -xrender -xft -no-dlopen-opengl \
-qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
-I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
-L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
-no-thread
%{l_make} %{l_mflags -O} \
MAKE="%{l_make} %{l_mflags -O}" \
%if "%{with_tools}" == "yes"
sub-src sub-tools
%else
sub-src
( cd tools/designer
%{l_make} %{l_mflags -O} \
MAKE="%{l_make} %{l_mflags -O}" \
sub-uic
) || exit $?
%endif
%if "%{with_threads}" == "yes"
# run configure a second time to get threaded libs as well
CC="%{l_cc}" \
CXX="%{l_cxx}" \
CFLAGS="%{l_cflags -O}" \
CXXFLAGS="%{l_cxxflags -O}" \
echo "yes" | ./configure \
%if "%{with_pgsql}" == "yes"
-qt-sql-psql \
%endif
%if "%{with_mysql}" == "yes"
-qt-sql-mysql \
%endif
-platform $oscomp \
-prefix %{l_prefix} \
-docdir %{l_prefix}/share/qt/doc \
-datadir %{l_prefix}/share/qt/data \
-plugindir %{l_prefix}/share/qt/plugins \
-translationdir %{l_prefix}/share/qt/translations \
-sysconfdir %{l_prefix}/etc/qt \
-release -static -stl -sm -xrender -xft -no-dlopen-opengl \
-qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
-I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
-L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
-thread
# make our targets a second time to get threaded libs, too
%{l_make} %{l_mflags -O} \
MAKE="%{l_make} %{l_mflags -O}" \
%if "%{with_tools}" == "yes"
sub-src sub-tools
%else
sub-src
( cd tools/designer
%{l_make} %{l_mflags -O} \
MAKE="%{l_make} %{l_mflags -O}" \
sub-uic
) || exit $?
%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
# calculate X11 lib directory in advance
l_x11_libdir=`%{l_rc} --query x11_libdir`
# make directory structure
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
%if "%{with_tools}" == "yes"
$RPM_BUILD_ROOT%{l_prefix}/share/qt/templates \
$RPM_BUILD_ROOT%{l_prefix}/share/qt/phrasebooks \
$RPM_BUILD_ROOT%{l_prefix}/share/qt/images \
%endif
$RPM_BUILD_ROOT%{l_prefix}/share/qt/doc/html \
$RPM_BUILD_ROOT%{l_prefix}/include/qt/private \
$RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig \
$RPM_BUILD_ROOT%{l_prefix}/man/man1 \
$RPM_BUILD_ROOT%{l_prefix}/man/man3
# copy binaries, headers, and then libraries to their target
%{l_shtool} install -c -s -m 755 \
bin/qmake bin/moc bin/uic \
$RPM_BUILD_ROOT%{l_prefix}/bin/
%if "%{with_tools}" == "yes"
%{l_shtool} install -c -s -m 755 \
bin/linguist bin/lrelease bin/lupdate \
bin/assistant bin/qtconfig bin/designer \
$RPM_BUILD_ROOT%{l_prefix}/bin/
%endif
# copy mkspecs directory for later portable use of qmake
cp -rp mkspecs $RPM_BUILD_ROOT%{l_prefix}/share/qt/mkspecs
# correct man suffix
for man in doc/man/man3/*.3qt; do
%{l_shtool} subst -e 's;\.3qt;.3;' $man
mv $man `echo $man | sed -e 's;\.3qt$;.3;'`
done
# copy files to their destinations
%{l_shtool} install -c -m 644 \
include/*.h $RPM_BUILD_ROOT%{l_prefix}/include/qt/
%{l_shtool} install -c -m 644 \
include/private/*.h $RPM_BUILD_ROOT%{l_prefix}/include/qt/private/
%{l_shtool} install -c -m 644 \
lib/*.a lib/*.prl $RPM_BUILD_ROOT%{l_prefix}/lib/
%{l_shtool} install -c -m 644 \
-e "s;\t; ;g" \
-e "s;\ \+; ;g" \
-e "s;\ *$;;g" \
-e "s;-[lL]\ *\-;\-;g" \
-e "s;-l\ *[^ ]*qt\.pc\ *;;g" \
-e "s;-L\ *.[^ ]*\ *;;g" \
-e "s;Libs:;Libs: %{l_ldflags} -L${l_x11_libdir};g" \
-e "s;\(\-l\);\-lqt \1;" \
lib/qt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
%if "%{with_threads}" == "yes"
%{l_shtool} install -c -m 644 \
-e "s;\t; ;g" \
-e "s;\ \+; ;g" \
-e "s;\ *$;;g" \
-e "s;-[lL]\ *\-;\-;g" \
-e "s;-l\ *[^ ]*qt\-mt\.pc\ *;;g" \
-e "s;-L\ *.[^ ]*\ *;;g" \
-e "s;Libs:;Libs: %{l_ldflags} -L${l_x11_libdir};g" \
-e "s;\(\-l\);\-lqt\-mt \1;" \
lib/qt-mt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
%endif
%if "%{with_tools}" == "yes"
%{l_shtool} install -c -m 644 \
tools/designer/templates/*.ui $RPM_BUILD_ROOT%{l_prefix}/share/qt/templates/
%{l_shtool} install -c -m 644 \
tools/linguist/phrasebooks/*.qph $RPM_BUILD_ROOT%{l_prefix}/share/qt/phrasebooks/
%{l_shtool} install -c -m 644 \
tools/designer/designer/images/* $RPM_BUILD_ROOT%{l_prefix}/share/qt/images/
%endif
%{l_shtool} install -c -m 644 \
doc/man/man3/*.3 $RPM_BUILD_ROOT%{l_prefix}/man/man3/
%{l_shtool} install -c -m 644 \
doc/man/man1/moc.1 doc/man/man1/uic.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
%{l_shtool} install -c -m 644 \
doc/html/* $RPM_BUILD_ROOT%{l_prefix}/share/qt/doc/html/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%doc %{l_prefix}/share/qt/doc/html/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT