qt/qt.spec

Mon, 06 Apr 2009 12:42:11 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 06 Apr 2009 12:42:11 +0200
changeset 140
d51e263e607b
parent 92
645923d1e875
child 205
a7c3336b8dc2
permissions
-rw-r--r--

Correct path to perl(1) and integrate mrtg-traffic-sum(1) logic.

     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     fontconflibs=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
   109     openssllibs=`%{l_prefix}/bin/pkg-config --libs --static openssl`
   111     loclibs=''
   112     case "%{l_platform -t}" in
   113         *-sunos* )
   114             loclibs='-lsocket -lnsl'
   115             ;;
   116     esac
   117     ( cd mkspecs/qws
   118       for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
   119       do 
   120           ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
   121       done
   122     ) || exit $?
   123     %{l_shtool} subst \
   124         -e 's;\(-z[\t ][\t ]*\)\([^\t \"][^\t \"]*\);\1"\2";g' \
   125         configure
   126     %{l_shtool} subst \
   127         -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconflibs;" \
   128         configure
   129     %{l_shtool} subst \
   130         -e "s;\(OPENSSL_LIBS *=\) *-lssl -lcrypto;\1 $openssllibs;" \
   131         configure
   132     %{l_shtool} subst \
   133         -e 's;-silent|;-rpath|-silent|;' \
   134         -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
   135         -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
   136         configure
   137     %{l_shtool} subst \
   138         -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
   139         -e 's;/freetype2;/freetype;' \
   140         config.tests/unix/freetype/freetype.pri
   141     %{l_shtool} subst \
   142         -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconflibs;" \
   143         config.tests/x11/fontconfig/fontconfig.pro
   144     %{l_shtool} subst \
   145         -e "s;\(LIBS += -lpq\);\1 -lssl -lcrypto $loclibs;" \
   146         config.tests/unix/psql/psql.pro
   147     %{l_shtool} subst \
   148         -e 's;^mac:\(LIBS\);\1;' \
   149         config.tests/unix/iconv/iconv.pro
   150     %{l_shtool} subst \
   151         -e 's;LIBS .*= -lpq$;LIBS += -lpq -lssl -lcrypto;' \
   152         src/sql/drivers/drivers.pri
   153     %{l_shtool} subst \
   154         -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" \
   155         src/corelib/kernel/kernel.pri \
   156         src/gui/kernel/kernel.pri
   157     %{l_shtool} subst \
   158         -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_PSQL;INCPATH += `pg_config --includedir 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   159         -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_MYSQL;INCPATH += `mysql_config --include 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
   160         -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" \
   161         src/plugins/sqldrivers/mysql/mysql.pro \
   162         src/plugins/sqldrivers/psql/psql.pro \
   163         src/plugins/sqldrivers/sqlite/sqlite.pro \
   164         src/sql/drivers/drivers.pri
   165     %{l_shtool} subst \
   166         -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" \
   167         src/dbus/dbus.pro
   168     %{l_shtool} subst \
   169         -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
   170         -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
   171         -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
   172         -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2;" \
   173         -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
   174         mkspecs/qws/*/qmake.conf \
   175         mkspecs/*/*.conf
   176     %{l_shtool} subst \
   177         -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
   178         src/corelib/corelib.pro
   179     %{l_shtool} subst \
   180         -e "s;^\(QMAKE_INCDIR_X11[^=]*=\).*;\1 %{l_prefix}/include $x11_incdir;" \
   181         -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\).*;\1 %{l_prefix}/lib $x11_libdir;" \
   182         mkspecs/qws/solaris*/qmake.conf \
   183         mkspecs/solaris*/qmake.conf
   184     %{l_shtool} subst \
   185         -e 's; *\.\./3rdparty/freetype/.*;;g' \
   186         -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
   187         src/gui/text/text.pri
   188     %{l_shtool} subst \
   189         -e 's;\(#include  *"\)\(tiffio.h"\);\1tiff/\2;' \
   190         src/plugins/imageformats/tiff/qtiffhandler.cpp
   191     %{l_shtool} subst \
   192         -e 's;\(CONFIG[\t ]*+=[\t ]*qt\);\1 x11;' \
   193         tools/qtconfig/qtconfig.pro
   194 #    for projfile in `find examples/ -name '*.pro' -print`; do
   195 #        echo 'CONFIG += release' >>$projfile
   196 #    done
   198 %build
   199     #   protect against sloppy code inclusion of all unused subprojects
   200     rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
   202     #   detect which platform for which to build
   203     case "%{l_platform -t}" in
   204         sun4[uv]-sunos* | amd64-sunos*  ) platcomp="solaris-g++-64" ;;
   205         i?86-sunos*                     ) platcomp="solaris-g++"    ;;
   206         amd64-linux*                    ) platcomp="linux-g++-64"   ;;
   207         i?86-linux*                     ) platcomp="linux-g++"      ;;
   208         amd64-freebsd* | i?86-freebsd*  ) platcomp="freebsd-g++"    ;;
   209         *-aix*                          ) platcomp="aix-g++"        ;;
   210         *-darwin*                       ) platcomp="macx-g++"       ;;
   211         *-hpux*                         ) platcomp="hpux-g++"       ;;
   212         *-irix*                         ) platcomp="irix-g++"       ;;
   213         *                               ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
   214     esac
   216     #   detect which architecture extensions are available
   217     archflags=''
   218     case "%{l_platform -t}" in
   219         amd64-* )
   220             break
   221             ;;
   222         * )
   223             archflags='-no-sse2 -no-3dnow'
   224             ;;
   225     esac
   227 %if "%{with_shared}" == "yes"
   228     #   optional shared build (precedes mandatory static build)
   229     echo 'yes' | ./configure \
   230         $archflags \
   231         -prefix %{l_prefix} \
   232         -bindir %{l_prefix}/bin \
   233         -libdir %{l_prefix}/lib/qt \
   234         -docdir %{l_prefix}/share/qt/doc \
   235         -headerdir %{l_prefix}/include \
   236         -plugindir %{l_prefix}/lib/qt/plugins \
   237         -datadir %{l_prefix}/share/qt \
   238         -translationdir %{l_prefix}/share/qt/translations \
   239         -sysconfdir %{l_prefix}/etc/qt \
   240         -examplesdir %{l_prefix}/share/qt/examples \
   241         -demosdir %{l_prefix}/share/qt/demos \
   242         -release \
   243         -shared \
   244         -platform $platcomp \
   245         -no-sql-ibase \
   246 %if "%{with_mysql}" == "yes"
   247         -qt-sql-mysql \
   248         -plugin-sql-mysql \
   249 %else
   250         -no-sql-mysql \
   251 %endif
   252 %if "%{with_pgsql}" == "yes"
   253         -qt-sql-psql \
   254         -plugin-sql-psql \
   255 %else
   256         -no-sql-psql \
   257 %endif
   258         -no-sql-odbc \
   259         -system-sqlite \
   260         -qt-sql-sqlite \
   261         -plugin-sql-sqlite \
   262         -no-sql-sqlite2 \
   263         -openssl-linked \
   264         -xmlpatterns \
   265         -svg \
   266         -no-webkit \
   267         -system-zlib \
   268         -qt-gif \
   269         -system-libpng \
   270         -system-libmng \
   271         -system-libjpeg \
   272         -system-libtiff \
   273         -rpath \
   274         -no-cups \
   275         -iconv \
   276         -pch \
   277         -dbus-linked \
   278         -opengl \
   279         -xrender \
   280         -fontconfig \
   281         -freetype \
   282         -no-glib
   284     #   default options are implicitly used, for example...
   285     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   286     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   288     #   carry out shared build procedure
   289     ( cd src
   290       %{l_make} %{l_mflags -O} \
   291           sub-moc sub-rcc sub-uic
   292       %{l_make} %{l_mflags -O} \
   293           sub-corelib sub-xml sub-network sub-gui sub-sql \
   294           sub-script sub-testlib sub-qt3support sub-dbus \
   295           sub-opengl sub-xmlpatterns sub-svg sub-plugins
   296     ) || exit $?
   297     ( cd demos
   298       %{l_make} %{l_mflags -O} sub-arthurplugin
   299     ) || exit $?
   301     #   cache shared libs and initialize the build configuration, which
   302     #   would otherwise still contain references to our shared libs build
   303     %{l_shtool} mkdir -f -p -m 755 dynamic
   304     mv lib/* dynamic/
   305     ( cd qmake
   306       %{l_make} %{l_mflags} distclean
   307     ) || exit $?
   308     rm -f .qmake.cache
   309 %endif
   311     #   mandatory static build (follows optional shared build)
   312     echo 'yes' | ./configure \
   313         $archflags \
   314         -prefix %{l_prefix} \
   315         -bindir %{l_prefix}/bin \
   316         -libdir %{l_prefix}/lib \
   317         -docdir %{l_prefix}/share/qt/doc \
   318         -headerdir %{l_prefix}/include \
   319         -plugindir %{l_prefix}/lib/qt/plugins \
   320         -datadir %{l_prefix}/share/qt \
   321         -translationdir %{l_prefix}/share/qt/translations \
   322         -sysconfdir %{l_prefix}/etc/qt \
   323         -examplesdir %{l_prefix}/share/qt/examples \
   324         -demosdir %{l_prefix}/share/qt/demos \
   325         -release \
   326         -static \
   327         -platform $platcomp \
   328         -no-sql-ibase \
   329 %if "%{with_mysql}" == "yes"
   330         -qt-sql-mysql \
   331 %else
   332         -no-sql-mysql \
   333 %endif
   334 %if "%{with_pgsql}" == "yes"
   335         -qt-sql-psql \
   336 %else
   337         -no-sql-psql \
   338 %endif
   339         -no-sql-odbc \
   340         -system-sqlite \
   341         -qt-sql-sqlite \
   342         -no-sql-sqlite2 \
   343         -openssl-linked \
   344         -xmlpatterns \
   345         -svg \
   346         -no-webkit \
   347         -system-zlib \
   348         -qt-gif \
   349         -system-libpng \
   350         -system-libmng \
   351         -system-libjpeg \
   352         -system-libtiff \
   353         -rpath \
   354         -no-cups \
   355         -iconv \
   356         -pch \
   357         -dbus-linked \
   358         -opengl \
   359         -xrender \
   360         -fontconfig \
   361         -freetype \
   362         -no-glib
   364     #   default options are implicitly used, for example...
   365     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   366     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   368     #   carry out static build procedure
   369     %{l_make} %{l_mflags -O} sub-src
   370 %if "%{with_tools}" == "yes"
   371     %{l_make} %{l_mflags -O} sub-tools
   372 %endif
   373 %if "%{with_examples}" == "yes"
   374     %{l_make} %{l_mflags -O} \
   375         sub-demos-make_default-ordered \
   376         sub-examples-make_default-ordered
   377 %endif
   379 %install
   380     rm -rf $RPM_BUILD_ROOT
   382     #   carry out installation procedure
   383     targets="sub-moc-install_subtargets-ordered \
   384             sub-rcc-install_subtargets-ordered \
   385             sub-uic-install_subtargets-ordered \
   386             sub-corelib-install_subtargets-ordered \
   387             sub-xml-install_subtargets-ordered \
   388             sub-network-install_subtargets-ordered \
   389             sub-gui-install_subtargets-ordered \
   390             sub-sql-install_subtargets-ordered \
   391             sub-script-install_subtargets-ordered \
   392             sub-testlib-install_subtargets-ordered \
   393             sub-qt3support-install_subtargets-ordered \
   394             sub-dbus-install_subtargets-ordered \
   395             sub-uic3-install_subtargets-ordered \
   396             sub-opengl-install_subtargets-ordered \
   397             sub-xmlpatterns-install_subtargets-ordered \
   398             sub-svg-install_subtargets-ordered \
   399             sub-plugins-install_subtargets-ordered"
   400 %if "%{with_tools}" == "yes"
   401     targets="$targets sub-tools-install_subtargets-ordered"
   402 %endif
   403 %if "%{with_examples}" == "yes"
   404     targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
   405 %endif
   406     targets="$targets install_htmldocs install_qchdocs install_docimages install_translations install_qmake install_mkspecs"
   407     %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
   409 %if "%{with_shared}" == "yes"
   410     #   install shared libs and symlinks
   411     %{l_shtool} mkdir -f -p -m 755 \
   412         $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   413     %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   415     #   offer limited support of pkg-config(1) for shared libs
   416     #   substitution unfortunately only handles paths with no whitespace
   417     %{l_shtool} subst \
   418         -e "s;[^\t ][^\t ]*qt-x11-opensource-src-%{version};%{l_prefix};g" \
   419         $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/pkgconfig/*
   421     #   explain nonstandard shared library placement
   422     ( echo "This OpenPKG Qt build is using the with_shared option."
   423       echo ""
   424       echo "This directory contains optional shared libraries as"
   425       echo "defined by the OpenPKG build specification. Although"
   426       echo "shared libraries have been optionally built (see the"
   427       echo "build time 'with_shared yes' option), static libraries"
   428       echo "were built by default as usual, and installed in the"
   429       echo "standard library directory %{l_prefix}/lib."
   430       echo ""
   431       echo "To build applications using shared libraries instead,"
   432       echo "please direct pkg-config(1) to use the properdefinitions"
   433       echo "by setting the environment variable PKG_CONFIG_PATH to "
   434       echo "%{l_prefix}/lib/qt/dynamic/pkgconfig."
   435     ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
   437     #   remove unbuilt component link files
   438     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/libQtWebKit*
   439     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/pkgconfig/QtWebKit*
   441     #   remove temporary dynamic link paths
   442     %{l_shtool} subst \
   443         -e "s;-L\([\t ]*\)[^\t ][^\t ]*qt-x11-opensource-src-%{version}\(/[^\t ][^\t ]*\);-L\1%{l_prefix}\2;g" \
   444         -e "s;\([\t ][\t ]*\)[^\t ][^\t ]*\(qt-x11-opensource-src-%{version}.*\);\1/tmp/\2;" \
   445         $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.prl \
   446         $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.la
   447 %endif
   449     #   determine internal file listing
   450     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   451         %{l_files_std} \
   452         '%doc %{l_prefix}/share/qt/doc/*/*' \
   453         '%not %dir %{l_prefix}/lib/pkgconfig'
   455 %files -f files
   457 %clean
   458     rm -rf $RPM_BUILD_ROOT

mercurial