qt/qt.spec

Wed, 14 Jan 2009 16:59:11 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 14 Jan 2009 16:59:11 +0100
changeset 87
7cedea33cc19
parent 86
78e7deb1d6ab
child 88
5eb8172041b5
permissions
-rw-r--r--

Correct path substitutions of pkgconfig files in dynamic directory.

     1 ##
     2 ##  qt.spec -- OpenPKG RPM Specification
     3 ##  Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   FIXME: MSvB: It appears that bugs in current versions of binutils
    25 #   FIXME: MSvB: fail to properly link Qt object code, resulting in
    26 #   FIXME: MSvB: 'ld: libQt*.so: pthread_mutex...: invalid version 6
    27 #   FIXME: MSvB: libQt*.so: could not read symbols: Bad value'
    28 #   FIXME: MSvB: The effects of these bugs are platform dependent.
    29 #   FIXME: MSvB: Solaris 11 IA-32 builds fail while Linux 2.6.25.18
    30 #   FIXME: MSvB: AMD64 builds succeed.
    31 #   FIXME: MSvB:
    32 #   FIXME: MSvB: The webkit is flawed in Qt 4.4.3, and has been disabled
    33 #   FIXME: MSvB: in this build until a new release corrects the problem.
    35 #   package information
    36 Name:         qt
    37 Summary:      Cross-platform Application Framework
    38 URL:          http://www.trolltech.com/products/qt/
    39 Vendor:       Nokia Corporation
    40 Packager:     Michael Schloh von Bennewitz
    41 Distribution: MSvB Recherche Production
    42 Class:        EVAL
    43 Group:        Development
    44 License:      GPL
    45 Version:      4.4.3
    46 Release:      20090106
    48 #   build options
    49 %option       with_tools     yes
    50 %option       with_mysql     no
    51 %option       with_pgsql     no
    52 %option       with_shared    no
    53 %option       with_examples  no
    55 #   list of sources
    56 Source0:      ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-%{version}.tar.gz
    58 #   build information
    59 Prefix:       %{l_prefix}
    60 BuildRoot:    %{l_buildroot}
    61 BuildPreReq:  OpenPKG, openpkg >= 20050726, make, gcc, pkgconfig
    62 PreReq:       OpenPKG, openpkg >= 20050726
    63 BuildPreReq:  X11, png, mng, jpeg, tiff, mesa, xrender
    64 PreReq:       X11, png, mng, jpeg, tiff, mesa, xrender
    65 BuildPreReq:  openssl, zlib, libiconv, sqlite, dbus
    66 PreReq:       openssl, zlib, libiconv, sqlite, dbus
    67 BuildPreReq:  fontconfig, freetype
    68 PreReq:       fontconfig, freetype
    69 %if "%{with_mysql}" == "yes"
    70 BuildPreReq:  mysql
    71 PreReq:       mysql
    72 %endif
    73 %if "%{with_pgsql}" == "yes"
    74 BuildPreReq:  postgresql
    75 PreReq:       postgresql
    76 %endif
    77 AutoReq:      no
    78 AutoReqProv:  no
    79 Provides:     QTSDK
    81 %description
    82     Qt is a comprehensive C++ framework for cross-platform application
    83     development. Using Qt, you can develop applications and user
    84     interfaces once, and deploy them across many desktop and embedded
    85     operating systems without rewriting the source code. This package
    86     distribution builds all modules of the Qt/X11 Open Source Edition.
    88 %track
    89     prog qt = {
    90         version   = %{version}
    91         url       = ftp://ftp.trolltech.com/qt/source/
    92         regex     = qt-x11-opensource-src-(__VER__)\.tar\.gz
    93     }
    95 %prep
    96     #   announce exceptional build requirements
    97     ( echo "This package has exceptional storage requirements:"
    98       echo "  qt-%{version}-root (2,5 Go)"
    99       echo "  qt-x11-opensource-src-%{version} (4,5 Go)"
   100       echo "  qt-%{version}-<date>.<arch>-<os>-<tag>.rpm (1 Go)"
   101       echo "Building with no options takes 0,5 hours on a dual core"
   102       echo "2 GHz CPU, or 2 hours with all build options enabled."
   103     ) | %{l_rpmtool} msg -b -t notice
   105     %setup -q -n qt-x11-opensource-src-%{version}
   106     x11_incdir=`%{l_rc} --query x11_incdir`
   107     x11_libdir=`%{l_rc} --query x11_libdir`
   108     fontconf=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
   109     loclibs=''
   110     case "%{l_platform -t}" in
   111         *-sunos* )
   112             loclibs='-lsocket -lnsl'
   113             ;;
   114     esac
   115     ( cd mkspecs/qws
   116       for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
   117       do 
   118           ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
   119       done
   120     ) || exit $?
   121     %{l_shtool} subst \
   122         -e 's;\(-z[ \t][ \t]*\)\([^ \t\"][^ \t\"]*\);\1"\2";g' \
   123         configure
   124     %{l_shtool} subst \
   125         -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconf;" \
   126         configure
   127     %{l_shtool} subst \
   128         -e 's;-silent|;-rpath|-silent|;' \
   129         -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
   130         -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
   131         configure
   132     %{l_shtool} subst \
   133         -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
   134         -e 's;/freetype2;/freetype;' \
   135         config.tests/unix/freetype/freetype.pri
   136     %{l_shtool} subst \
   137         -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconf;" \
   138         config.tests/x11/fontconfig/fontconfig.pro
   139     %{l_shtool} subst \
   140         -e "s;\(LIBS += -lpq\);\1 -lssl -lcrypto $loclibs;" \
   141         config.tests/unix/psql/psql.pro
   142     %{l_shtool} subst \
   143         -e 's;^mac:\(LIBS\);\1;' \
   144         config.tests/unix/iconv/iconv.pro
   145     %{l_shtool} subst \
   146         -e 's;LIBS .*= -lpq$;LIBS += -lpq -lssl -lcrypto;' \
   147         src/sql/drivers/drivers.pri
   148     %{l_shtool} subst \
   149         -e "s;QMAKE_CXXFLAGS += \$\$QT_CFLAGS_GLIB;INCPATH += `pkg-config --cflags-only-I glib-2.0 gthread-2.0 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   150         src/corelib/kernel/kernel.pri \
   151         src/gui/kernel/kernel.pri
   152     %{l_shtool} subst \
   153         -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_PSQL;INCPATH += `pg_config --includedir 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   154         -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_MYSQL;INCPATH += `mysql_config --include 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   155         -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_SQLITE;INCPATH += `pkg-config --cflags-only-I sqlite3 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   156         src/sql/drivers/drivers.pri
   157     %{l_shtool} subst \
   158         -e "s;QMAKE_CXXFLAGS += \$\$QT_CFLAGS_DBUS;INCPATH        += `pkg-config --cflags-only-I dbus-1 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   159         src/dbus/dbus.pro
   160     %{l_shtool} subst \
   161         -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
   162         -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
   163         -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
   164         -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2;" \
   165         -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
   166         mkspecs/qws/*/qmake.conf \
   167         mkspecs/*/*.conf
   168     %{l_shtool} subst \
   169         -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
   170         src/corelib/corelib.pro
   171     %{l_shtool} subst \
   172         -e "s;^\(QMAKE_INCDIR_X11[^=]*=\).*;\1 %{l_prefix}/include $x11_incdir;" \
   173         -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\).*;\1 %{l_prefix}/lib $x11_libdir;" \
   174         mkspecs/qws/solaris*/qmake.conf \
   175         mkspecs/solaris*/qmake.conf
   176     %{l_shtool} subst \
   177         -e 's; *\.\./3rdparty/freetype/.*;;g' \
   178         -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
   179         src/gui/text/text.pri
   180     %{l_shtool} subst \
   181         -e 's;\(#include  *"\)\(tiffio.h"\);\1tiff/\2;' \
   182         src/plugins/imageformats/tiff/qtiffhandler.cpp
   183 #    for projfile in `find examples/ -name '*.pro' -print`; do
   184 #        echo 'CONFIG += release' >>$projfile
   185 #    done
   187 %build
   188     #   protect against sloppy code inclusion of all unused subprojects
   189     rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
   191     case "%{l_platform -t}" in
   192         sun4[uv]-sunos* | amd64-sunos*  ) platcomp="solaris-g++-64" ;;
   193         i?86-sunos*                     ) platcomp="solaris-g++"    ;;
   194         amd64-linux*                    ) platcomp="linux-g++-64"   ;;
   195         i?86-linux*                     ) platcomp="linux-g++"      ;;
   196         amd64-freebsd* | i?86-freebsd*  ) platcomp="freebsd-g++"    ;;
   197         *-aix*                          ) platcomp="aix-g++"        ;;
   198         *-darwin*                       ) platcomp="macx-g++"       ;;
   199         *-hpux*                         ) platcomp="hpux-g++"       ;;
   200         *-irix*                         ) platcomp="irix-g++"       ;;
   201         *                               ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
   202     esac
   204 %if "%{with_shared}" == "yes"
   205     #   optional shared build (precedes mandatory static build)
   206     echo 'yes' | ./configure \
   207         -prefix %{l_prefix} \
   208         -bindir %{l_prefix}/bin \
   209         -libdir %{l_prefix}/lib/qt \
   210         -docdir %{l_prefix}/share/qt/doc \
   211         -headerdir %{l_prefix}/include \
   212         -plugindir %{l_prefix}/lib/qt/plugins \
   213         -datadir %{l_prefix}/share/qt \
   214         -translationdir %{l_prefix}/share/qt/translations \
   215         -sysconfdir %{l_prefix}/etc/qt \
   216         -examplesdir %{l_prefix}/share/qt/examples \
   217         -demosdir %{l_prefix}/share/qt/demos \
   218         -release \
   219         -shared \
   220         -platform $platcomp \
   221         -no-sql-ibase \
   222 %if "%{with_mysql}" == "yes"
   223         -qt-sql-mysql \
   224         -plugin-sql-mysql \
   225 %else
   226         -no-sql-mysql \
   227 %endif
   228 %if "%{with_pgsql}" == "yes"
   229         -qt-sql-psql \
   230         -plugin-sql-psql \
   231 %else
   232         -no-sql-psql \
   233 %endif
   234         -no-sql-odbc \
   235         -system-sqlite \
   236         -qt-sql-sqlite \
   237         -plugin-sql-sqlite \
   238         -no-sql-sqlite2 \
   239         -openssl-linked \
   240         -xmlpatterns \
   241         -svg \
   242         -no-webkit \
   243         -system-zlib \
   244         -qt-gif \
   245         -system-libpng \
   246         -system-libmng \
   247         -system-libjpeg \
   248         -system-libtiff \
   249         -rpath \
   250         -no-cups \
   251         -iconv \
   252         -pch \
   253         -dbus-linked \
   254         -opengl \
   255         -xrender \
   256         -fontconfig \
   257         -freetype \
   258         -no-glib
   260     #   default options are implicitly used, for example...
   261     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   262     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   264     #   carry out shared build procedure
   265     ( cd src
   266       %{l_make} %{l_mflags -O} \
   267           sub-moc sub-rcc sub-uic
   268       %{l_make} %{l_mflags -O} \
   269           sub-corelib sub-xml sub-network sub-gui sub-sql \
   270           sub-script sub-testlib sub-qt3support sub-dbus \
   271           sub-opengl sub-xmlpatterns sub-svg sub-plugins
   272     ) || exit $?
   274     #   cache shared libs and initialize the build configuration, which
   275     #   would otherwise still contain references to our shared libs build
   276     %{l_shtool} mkdir -f -p -m 755 dynamic
   277     mv lib/* dynamic/
   278     ( cd qmake
   279       %{l_make} %{l_mflags} distclean
   280     ) || exit $?
   281     rm -f .qmake.cache
   282 %endif
   284     #   mandatory static build (follows optional shared build)
   285     echo 'yes' | ./configure \
   286         -prefix %{l_prefix} \
   287         -bindir %{l_prefix}/bin \
   288         -libdir %{l_prefix}/lib \
   289         -docdir %{l_prefix}/share/qt/doc \
   290         -headerdir %{l_prefix}/include \
   291         -plugindir %{l_prefix}/lib/qt/plugins \
   292         -datadir %{l_prefix}/share/qt \
   293         -translationdir %{l_prefix}/share/qt/translations \
   294         -sysconfdir %{l_prefix}/etc/qt \
   295         -examplesdir %{l_prefix}/share/qt/examples \
   296         -demosdir %{l_prefix}/share/qt/demos \
   297         -release \
   298         -static \
   299         -platform $platcomp \
   300         -no-sql-ibase \
   301 %if "%{with_mysql}" == "yes"
   302         -qt-sql-mysql \
   303 %else
   304         -no-sql-mysql \
   305 %endif
   306 %if "%{with_pgsql}" == "yes"
   307         -qt-sql-psql \
   308 %else
   309         -no-sql-psql \
   310 %endif
   311         -no-sql-odbc \
   312         -system-sqlite \
   313         -qt-sql-sqlite \
   314         -no-sql-sqlite2 \
   315         -openssl-linked \
   316         -xmlpatterns \
   317         -svg \
   318         -no-webkit \
   319         -system-zlib \
   320         -qt-gif \
   321         -system-libpng \
   322         -system-libmng \
   323         -system-libjpeg \
   324         -system-libtiff \
   325         -rpath \
   326         -no-cups \
   327         -iconv \
   328         -pch \
   329         -dbus-linked \
   330         -opengl \
   331         -xrender \
   332         -fontconfig \
   333         -freetype \
   334         -no-glib
   336     #   default options are implicitly used, for example...
   337     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   338     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   340     #   carry out static build procedure
   341     %{l_make} %{l_mflags -O} sub-src
   342 %if "%{with_tools}" == "yes"
   343     %{l_make} %{l_mflags -O} sub-tools
   344 %endif
   345 %if "%{with_examples}" == "yes"
   346     %{l_make} %{l_mflags -O} \
   347         sub-demos-make_default-ordered \
   348         sub-examples-make_default-ordered
   349 %endif
   351 %install
   352     rm -rf $RPM_BUILD_ROOT
   354     #   carry out installation procedure
   355     targets="sub-moc-install_subtargets-ordered \
   356             sub-rcc-install_subtargets-ordered \
   357             sub-uic-install_subtargets-ordered \
   358             sub-corelib-install_subtargets-ordered \
   359             sub-xml-install_subtargets-ordered \
   360             sub-network-install_subtargets-ordered \
   361             sub-gui-install_subtargets-ordered \
   362             sub-sql-install_subtargets-ordered \
   363             sub-script-install_subtargets-ordered \
   364             sub-testlib-install_subtargets-ordered \
   365             sub-qt3support-install_subtargets-ordered \
   366             sub-dbus-install_subtargets-ordered \
   367             sub-uic3-install_subtargets-ordered \
   368             sub-opengl-install_subtargets-ordered \
   369             sub-xmlpatterns-install_subtargets-ordered \
   370             sub-svg-install_subtargets-ordered \
   371             sub-plugins-install_subtargets-ordered"
   372 %if "%{with_tools}" == "yes"
   373     targets="$targets sub-tools-install_subtargets-ordered"
   374 %endif
   375 %if "%{with_examples}" == "yes"
   376     targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
   377 %endif
   378     targets="$targets install_htmldocs install_qchdocs install_docimages install_translations install_qmake install_mkspecs"
   379     %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
   381 %if "%{with_shared}" == "yes"
   382     #   install shared libs and symlinks
   383     %{l_shtool} mkdir -f -p -m 755 \
   384         $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   385     %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   387     #   offer limited support of pkg-config(1) for shared libs
   388     #   substitution unfortunately only handles paths with no whitespace
   389     %{l_shtool} subst \
   390         -e "s;[\ \t][\ \t]*qt-x11-opensource-src-%{version};%{l_prefix};g" \
   391         $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/pkgconfig/*
   393     #   explain nonstandard shared library placement
   394     ( echo "This OpenPKG Qt build is using the with_shared option."
   395       echo ""
   396       echo "This directory contains optional shared libraries as"
   397       echo "defined by the OpenPKG build specification. Although"
   398       echo "shared libraries have been optionally built (see the"
   399       echo "build time 'with_shared yes' option), static libraries"
   400       echo "were built by default as usual, and installed in the"
   401       echo "standard library directory %{l_prefix}/lib."
   402       echo ""
   403       echo "To build applications using shared libraries instead,"
   404       echo "please direct pkg-config(1) to use the properdefinitions"
   405       echo "by setting the environment variable PKG_CONFIG_PATH to "
   406       echo "%{l_prefix}/lib/qt/dynamic/pkgconfig."
   407     ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
   409     #   remove temporary dynamic link paths
   410     %{l_shtool} subst \
   411         -e 's;\(QMAKE_PRL_BUILD_DIR[^=]*=\).*\(qt-x11-opensource-src.*\);\1 /tmp/\2;' \
   412         $RPM_BUILD_ROOT%{l_prefix}/lib/*.prl
   413 %endif
   415     #   determine internal file listing
   416     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   417         %{l_files_std} \
   418         '%doc %{l_prefix}/share/qt/doc/*/*' \
   419         '%not %dir %{l_prefix}/lib/pkgconfig'
   421 %files -f files
   423 %clean
   424     rm -rf $RPM_BUILD_ROOT

mercurial