qt/qt.spec

Sat, 10 Jan 2009 08:57:33 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 10 Jan 2009 08:57:33 +0100
changeset 65
caa04e02b103
parent 29
cc49f73ee7de
child 86
78e7deb1d6ab
permissions
-rw-r--r--

Correct PostgreSQL build logic and make MySQL and PostgreSQL optional.

     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 ##
    25 #   package information
    26 Name:         qt
    27 Summary:      Cross-platform Application Framework
    28 URL:          http://www.trolltech.com/products/qt/
    29 Vendor:       Nokia Corporation
    30 Packager:     Michael Schloh von Bennewitz
    31 Distribution: MSvB Recherche Production
    32 Class:        EVAL
    33 Group:        Development
    34 License:      GPL
    35 Version:      4.4.3
    36 Release:      20090106
    38 #   build options
    39 %option       with_tools     yes
    40 %option       with_mysql     no
    41 %option       with_pgsql     no
    42 %option       with_shared    no
    43 %option       with_examples  no
    45 #   list of sources
    46 Source0:      ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-%{version}.tar.gz
    48 #   build information
    49 Prefix:       %{l_prefix}
    50 BuildRoot:    %{l_buildroot}
    51 BuildPreReq:  OpenPKG, openpkg >= 20050726, make, gcc, pkgconfig
    52 PreReq:       OpenPKG, openpkg >= 20050726
    53 BuildPreReq:  X11, png, mng, jpeg, tiff, mesa, xrender
    54 PreReq:       X11, png, mng, jpeg, tiff, mesa, xrender
    55 BuildPreReq:  openssl, zlib, libiconv, sqlite, dbus
    56 PreReq:       openssl, zlib, libiconv, sqlite, dbus
    57 BuildPreReq:  fontconfig, freetype
    58 PreReq:       fontconfig, freetype
    59 %if "%{with_mysql}" == "yes"
    60 BuildPreReq:  mysql
    61 PreReq:       mysql
    62 %endif
    63 %if "%{with_pgsql}" == "yes"
    64 BuildPreReq:  postgresql
    65 PreReq:       postgresql
    66 %endif
    67 AutoReq:      no
    68 AutoReqProv:  no
    69 Provides:     QTSDK
    71 %description
    72     Qt is a comprehensive C++ framework for cross-platform application
    73     development. Using Qt, you can develop applications and user
    74     interfaces once, and deploy them across many desktop and embedded
    75     operating systems without rewriting the source code.
    77 %track
    78     prog qt = {
    79         version   = %{version}
    80         url       = ftp://ftp.trolltech.com/qt/source/
    81         regex     = qt-x11-opensource-src-(__VER__)\.tar\.gz
    82     }
    84 %prep
    85     #   announce exceptional build requirements
    86     ( echo "This package has exceptional storage requirements:"
    87       echo "  qt-%{version}-root (2,5 Go)"
    88       echo "  qt-x11-opensource-src-%{version} (4,5 Go)"
    89       echo "  qt-%{version}-<date>.<arch>-<os>-<tag>.rpm (1 Go)"
    90       echo "Building with no options takes 0,5 hours on a dual core"
    91       echo "2 GHz CPU, or 2 hours with all build options enabled."
    92     ) | %{l_rpmtool} msg -b -t notice
    94     %setup -q -n qt-x11-opensource-src-%{version}
    95     x11_incdir=`%{l_rc} --query x11_incdir`
    96     x11_libdir=`%{l_rc} --query x11_libdir`
    97     fontconf=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
    98     loclibs=''
    99     x11_supdir=''
   100     case "%{l_platform -t}" in
   101         *-sunos* )
   102             loclibs='-lsocket -lnsl'
   103             [ -d /usr/X/sfw/lib ] && x11_supdir=/usr/X/sfw/lib
   104             ;;
   105     esac
   106     ( cd mkspecs/qws
   107       for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
   108       do 
   109           ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
   110       done
   111     ) || exit $?
   112     %{l_shtool} subst \
   113         -e 's;\(-z[ \t][ \t]*\)\([^ \t\"][^ \t\"]*\);\1"\2";g' \
   114         configure
   115     %{l_shtool} subst \
   116         -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconf;" \
   117         configure
   118     %{l_shtool} subst \
   119         -e 's;-silent|;-rpath|-silent|;' \
   120         -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
   121         -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
   122         configure
   123     if [ ".$x11_supdir" != . -a -d "$x11_supdir" ]; then
   124         %{l_shtool} subst \
   125             -e "s;\(echo.*QMAKE_RPATHDIR += \)\($x11_libdir\\\"\)\( >> \\\"\$QTCONFIG\.tmp\\\"\);\1\2\3 \&\& \1$x11_supdir\"\3;" \
   126             configure
   127     fi
   128     %{l_shtool} subst \
   129         -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
   130         -e 's;/freetype2;/freetype;' \
   131         config.tests/unix/freetype/freetype.pri
   132     %{l_shtool} subst \
   133         -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconf;" \
   134         config.tests/x11/fontconfig/fontconfig.pro
   135     %{l_shtool} subst \
   136         -e "s;\(LIBS += -lpq\);\1 -lssl -lcrypto $loclibs;" \
   137         config.tests/unix/psql/psql.pro
   138     %{l_shtool} subst \
   139         -e 's;^mac:\(LIBS\);\1;' \
   140         config.tests/unix/iconv/iconv.pro
   141     %{l_shtool} subst \
   142         -e 's;LIBS .*= -lpq$;LIBS += -lpq -lssl -lcrypto;' \
   143         src/sql/drivers/drivers.pri
   144     %{l_shtool} subst \
   145         -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
   146         -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
   147         -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
   148         -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2 $x11_supdir;" \
   149         -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
   150         mkspecs/qws/*/qmake.conf \
   151         mkspecs/*/*.conf
   152     %{l_shtool} subst \
   153         -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
   154         src/corelib/corelib.pro
   155     %{l_shtool} subst \
   156         -e "s;^\(QMAKE_INCDIR_X11[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
   157         -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2 $x11_supdir;" \
   158         mkspecs/qws/solaris*/qmake.conf \
   159         mkspecs/solaris*/qmake.conf
   160     %{l_shtool} subst \
   161         -e 's; *\.\./3rdparty/freetype/.*;;g' \
   162         -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
   163         src/gui/text/text.pri
   164     %{l_shtool} subst \
   165         -e 's;\(#include  *"\)\(tiffio.h"\);\1tiff/\2;' \
   166         src/plugins/imageformats/tiff/qtiffhandler.cpp
   167 #    for projfile in `find examples/ -name '*.pro' -print`; do
   168 #        echo 'CONFIG += release' >>$projfile
   169 #    done
   171 %build
   172     #   protect against sloppy code inclusion of all unused subprojects
   173     rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
   175     case "%{l_platform -t}" in
   176         *-aix*     ) platcomp="aix-g++"      ;;
   177         *-freebsd* ) platcomp="freebsd-g++"  ;;
   178         *-hpux*    ) platcomp="hpux-g++"     ;;
   179         *-irix*    ) platcomp="irix-g++"     ;;
   180         *64-linux* ) platcomp="linux-g++-64" ;;
   181         *-linux*   ) platcomp="linux-g++"    ;;
   182         *-darwin*  ) platcomp="macx-g++"     ;;
   183         *-sunos*   ) platcomp="solaris-g++"  ;;
   184         *          ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
   185     esac
   187 %if "%{with_shared}" == "yes"
   188     #   optional shared build (precedes mandatory static build)
   189     echo 'yes' | ./configure \
   190         -prefix %{l_prefix} \
   191         -bindir %{l_prefix}/bin \
   192         -libdir %{l_prefix}/lib/qt \
   193         -docdir %{l_prefix}/share/qt/doc \
   194         -headerdir %{l_prefix}/include \
   195         -plugindir %{l_prefix}/share/qt/plugins \
   196         -datadir %{l_prefix}/share/qt \
   197         -translationdir %{l_prefix}/share/qt/translations \
   198         -sysconfdir %{l_prefix}/etc/qt \
   199         -examplesdir %{l_prefix}/share/qt/examples \
   200         -demosdir %{l_prefix}/share/qt/demos \
   201         -release \
   202         -shared \
   203         -platform $platcomp \
   204         -no-sql-ibase \
   205 %if "%{with_mysql}" == "yes"
   206         -qt-sql-mysql \
   207 %else
   208         -no-sql-mysql \
   209 %endif
   210 %if "%{with_pgsql}" == "yes"
   211         -qt-sql-psql \
   212 %else
   213         -no-sql-psql \
   214 %endif
   215         -no-sql-odbc \
   216         -system-sqlite \
   217         -qt-sql-sqlite \
   218         -no-sql-sqlite2 \
   219         -openssl-linked \
   220         -xmlpatterns \
   221         -svg \
   222         -no-webkit \
   223         -system-zlib \
   224         -qt-gif \
   225         -system-libpng \
   226         -system-libmng \
   227         -system-libjpeg \
   228         -system-libtiff \
   229         -rpath \
   230         -no-cups \
   231         -iconv \
   232         -pch \
   233         -dbus-linked \
   234         -opengl \
   235         -xrender \
   236         -fontconfig \
   237         -freetype \
   238         -no-glib
   240     #   sadly, the webkit is broken in Qt 4.4.3.
   241     #   default options are implicitly used, und zwar...
   242     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   243     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   245     #   carry out shared build procedure
   246     ( cd src
   247       %{l_make} %{l_mflags -O} \
   248           sub-moc sub-rcc sub-uic
   249       %{l_make} %{l_mflags -O} \
   250           sub-corelib sub-xml sub-network sub-gui sub-sql \
   251           sub-script sub-testlib sub-qt3support sub-dbus \
   252           sub-opengl sub-xmlpatterns sub-svg sub-plugins
   253     ) || exit $?
   255     #   cache shared libs and initialize the build configuration, which
   256     #   would otherwise still contain references to our shared libs build
   257     %{l_shtool} mkdir -f -p -m 755 dynamic
   258     mv lib/* dynamic/
   259     ( cd qmake
   260       %{l_make} %{l_mflags} distclean
   261     ) || exit $?
   262     rm -f .qmake.cache
   263 %endif
   265     #   mandatory static build (follows optional shared build)
   266     echo 'yes' | ./configure \
   267         -prefix %{l_prefix} \
   268         -bindir %{l_prefix}/bin \
   269         -libdir %{l_prefix}/lib \
   270         -docdir %{l_prefix}/share/qt/doc \
   271         -headerdir %{l_prefix}/include \
   272         -plugindir %{l_prefix}/share/qt/plugins \
   273         -datadir %{l_prefix}/share/qt \
   274         -translationdir %{l_prefix}/share/qt/translations \
   275         -sysconfdir %{l_prefix}/etc/qt \
   276         -examplesdir %{l_prefix}/share/qt/examples \
   277         -demosdir %{l_prefix}/share/qt/demos \
   278         -release \
   279         -static \
   280         -platform $platcomp \
   281         -no-sql-ibase \
   282 %if "%{with_mysql}" == "yes"
   283         -qt-sql-mysql \
   284 %else
   285         -no-sql-mysql \
   286 %endif
   287 %if "%{with_pgsql}" == "yes"
   288         -qt-sql-psql \
   289 %else
   290         -no-sql-psql \
   291 %endif
   292         -no-sql-odbc \
   293         -system-sqlite \
   294         -qt-sql-sqlite \
   295         -no-sql-sqlite2 \
   296         -openssl-linked \
   297         -xmlpatterns \
   298         -svg \
   299         -no-webkit \
   300         -system-zlib \
   301         -qt-gif \
   302         -system-libpng \
   303         -system-libmng \
   304         -system-libjpeg \
   305         -system-libtiff \
   306         -rpath \
   307         -no-cups \
   308         -iconv \
   309         -pch \
   310         -dbus-linked \
   311         -opengl \
   312         -xrender \
   313         -fontconfig \
   314         -freetype \
   315         -no-glib
   317     #   default options are implicitly used, und zwar...
   318     #-no-fast -exceptions -accessibility -stl -qt3support -nis
   319     #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
   321     #   carry out static build procedure
   322     %{l_make} %{l_mflags -O} sub-src
   323 %if "%{with_tools}" == "yes"
   324     %{l_make} %{l_mflags -O} sub-tools
   325 %endif
   326 %if "%{with_examples}" == "yes"
   327     %{l_make} %{l_mflags -O} \
   328         sub-demos-make_default-ordered \
   329         sub-examples-make_default-ordered
   330 %endif
   332 %install
   333     rm -rf $RPM_BUILD_ROOT
   335     #   carry out installation procedure
   336     targets="sub-moc-install_subtargets-ordered \
   337             sub-rcc-install_subtargets-ordered \
   338             sub-uic-install_subtargets-ordered \
   339             sub-corelib-install_subtargets-ordered \
   340             sub-xml-install_subtargets-ordered \
   341             sub-network-install_subtargets-ordered \
   342             sub-gui-install_subtargets-ordered \
   343             sub-sql-install_subtargets-ordered \
   344             sub-script-install_subtargets-ordered \
   345             sub-testlib-install_subtargets-ordered \
   346             sub-qt3support-install_subtargets-ordered \
   347             sub-dbus-install_subtargets-ordered \
   348             sub-uic3-install_subtargets-ordered \
   349             sub-opengl-install_subtargets-ordered \
   350             sub-xmlpatterns-install_subtargets-ordered \
   351             sub-svg-install_subtargets-ordered \
   352             sub-plugins-install_subtargets-ordered"
   353 %if "%{with_tools}" == "yes"
   354     targets="$targets sub-tools-install_subtargets-ordered"
   355 %endif
   356 %if "%{with_examples}" == "yes"
   357     targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
   358 %endif
   359     targets="$targets install_htmldocs install_qchdocs install_docimages install_translations install_qmake install_mkspecs"
   360     %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
   362 %if "%{with_shared}" == "yes"
   363     #   install shared libs and symlinks
   364     %{l_shtool} mkdir -f -p -m 755 \
   365         $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   366     %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
   368     #   explain nonstandard shared library placement
   369     ( echo "This directory contains optional shared libraries as"
   370       echo "defined by the OpenPKG build specification. Although"
   371       echo "shared libraries are only optionally built (see the"
   372       echo "build time 'with_shared yes' option), static libraries"
   373       echo "are built and installed in the parent 'lib' directory."
   374     ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
   376     #   do not support pkg-config(1) with shared libs
   377     rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/qt/pkgconfig
   379     #   remove temporary dynamic link paths
   380     %{l_shtool} subst \
   381         -e 's;\(QMAKE_PRL_BUILD_DIR[^=][^=]*=\).*\(qt-x11-opensource-src.*\);\1 /tmp/\2;' \
   382         $RPM_BUILD_ROOT%{l_prefix}/lib/*.prl
   383 %endif
   385     #   determine internal file listing
   386     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   387         %{l_files_std} \
   388         '%doc %{l_prefix}/share/qt/doc/*' \
   389         '%not %dir %{l_prefix}/lib/pkgconfig'
   391 %files -f files
   393 %clean
   394     rm -rf $RPM_BUILD_ROOT

mercurial