qt.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. ##
  2. ## qt.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: qt
  27. Summary: The Qt Toolkit
  28. URL: http://www.trolltech.com/products/qt/x11.html
  29. Vendor: TrollTech AS
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EVAL]
  32. Group: XWindow
  33. License: GPL
  34. Version: 3.2.3
  35. Release: 20031202
  36. # package library options (each 'yes' builds more libraries)
  37. %option with_shared no
  38. %option with_threads yes
  39. # package extra options (additional nonlibrary components)
  40. %option with_pgsql no
  41. %option with_mysql no
  42. %option with_tools no
  43. # list of sources
  44. Source0: ftp://ftp.trolltech.com/pub/qt/source/qt-x11-free-%{version}.tar.bz2
  45. Patch0: qt.patch
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20030909, X11, xft, gcc, sed
  50. PreReq: OpenPKG, openpkg >= 20030909, X11, xft
  51. %if "%{with_pgsql}" == "yes"
  52. BuildPreReq: postgresql
  53. PreReq: postgresql
  54. %endif
  55. %if "%{with_mysql}" == "yes"
  56. BuildPreReq: mysql
  57. PreReq: mysql
  58. %endif
  59. AutoReq: no
  60. AutoReqProv: no
  61. %description
  62. Qt is a GUI (graphical user interface) software toolkit which simplifies
  63. the task of writing and maintaining GUIs, and allows the developer to
  64. create prototypes and feature-rich applications quickly. Offering C++
  65. library bindings, Qt enables development in an object-oriented
  66. environment and appeals to developers with portability in mind. Qt's
  67. portable C++ library bindings allow for error-free recompiling on at
  68. least the three major platforms Unix (and Linux), Apple Macintosh, and
  69. Microsoft Windows. Its API architecture is designed to reduce complexity
  70. and increase reliability through a signal and slot mechanism, which is
  71. similar to templates in C++, but with influences from component
  72. technology.
  73. %prep
  74. %setup -q -n qt-x11-free-%{version}
  75. %patch -p1
  76. # avoid dependencies external to OpenPKG instance
  77. cp -rp mkspecs mkspecs.fresh
  78. %{l_shtool} subst \
  79. -e 's;[ \t]*-I/usr/local/include;;g' \
  80. -e 's;[ \t]*/usr/local/include;;g' \
  81. -e 's;[ \t]*-L/usr/local/lib;;g' \
  82. -e 's;[ \t]*/usr/local/lib;;g' \
  83. mkspecs/darwin-g++/qmake.conf \
  84. mkspecs/freebsd-g++/qmake.conf \
  85. mkspecs/netbsd-g++/qmake.conf \
  86. mkspecs/macx-pbuilder/qmake.conf \
  87. mkspecs/openbsd-g++/qmake.conf
  88. # correctly detect OpenPKG xrender and xft installations
  89. %{l_shtool} subst \
  90. -e 's;INCDIRS=";INCDIRS="%{l_prefix}/include ;g' \
  91. -e 's;LIBDIRS=";LIBDIRS="%{l_prefix}/lib ;g' \
  92. -e 's;freetype2/freetype/;freetype/;g' \
  93. -e 's;freetype2;freetype;g' \
  94. config.tests/x11/xfreetype.test \
  95. config.tests/x11/xrender.test
  96. # repair nonstandard posix thread test macro usage
  97. %{l_shtool} subst \
  98. -e 's/\(defined(_POSIX_THREAD_SAFE_FUNCTIONS)\)/(\1 \&\& _POSIX_THREAD_SAFE_FUNCTIONS-0>0)/g' \
  99. src/dialogs/qfiledialog.cpp src/kernel/qfont_x11.cpp \
  100. src/tools/qdatetime.cpp src/tools/qdir_unix.cpp
  101. %build
  102. # display a warning that this package is a beast
  103. ( echo "The qt package requires about 320 MB of temporary disk space"
  104. echo "and one to five hours (depending on options) to build on a"
  105. echo "800 MHz system. Therefore, please be prepared and be patient."
  106. ) | %{l_rpmtool} msg -b -t notice
  107. # set HOME to a writable directory for qsettings
  108. # and set QTDIR to just the source tree directory
  109. # and determine the target platform to build
  110. HOME=`pwd`
  111. QTDIR=`pwd`
  112. case "%{l_platform -t}" in
  113. *-freebsd* ) oscomp="freebsd-g++" ;;
  114. *-linux* ) oscomp="linux-g++" ;;
  115. *-sunos* ) oscomp="solaris-g++" ;;
  116. * ) echo "platform %{l_platform -t} not supported" 2>&1; exit 1 ;;
  117. esac
  118. # put in proper search paths for dynamic libraries
  119. rflags=`echo '%{l_ldflags}' | %{l_shtool} subst \
  120. -e 's;%{l_prefix}/lib;%{l_prefix}/lib/qtdyn;g' \
  121. -e 's;-L;-R;g'`
  122. # calculate X11 paths in advance
  123. l_x11_incdir=`%{l_prefix}/etc/rc --query x11_incdir`
  124. l_x11_libdir=`%{l_prefix}/etc/rc --query x11_libdir`
  125. %if "%{with_shared}" == "yes"
  126. # special trolltech configuration
  127. CC="%{l_cc}" \
  128. CXX="%{l_cxx}" \
  129. CFLAGS="%{l_cflags -O}" \
  130. CXXFLAGS="%{l_cxxflags -O}" \
  131. echo "yes" | ./configure \
  132. %if "%{with_pgsql}" == "yes"
  133. -qt-sql-psql \
  134. %endif
  135. %if "%{with_mysql}" == "yes"
  136. -qt-sql-mysql \
  137. %endif
  138. -platform $oscomp \
  139. -prefix %{l_prefix} \
  140. -docdir %{l_prefix}/share/qt/doc \
  141. -datadir %{l_prefix}/share/qt/data \
  142. -plugindir %{l_prefix}/share/qt/plugins \
  143. -translationdir %{l_prefix}/share/qt/translations \
  144. -sysconfdir %{l_prefix}/etc/qt \
  145. -release -shared -stl -sm -xrender -xft \
  146. -qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
  147. -I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
  148. -L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
  149. -R$rflags \
  150. -no-thread
  151. # make shared libs, but tools will be built statically later
  152. %{l_make} %{l_mflags -O} \
  153. MAKE="%{l_make} %{l_mflags -O}" \
  154. LD_LIBRARY_PATH=$QTDIR/lib \
  155. sub-src sub-plugins
  156. %if "%{with_threads}" == "yes"
  157. # run configure a second time to get threaded libs as well
  158. CC="%{l_cc}" \
  159. CXX="%{l_cxx}" \
  160. CFLAGS="%{l_cflags -O}" \
  161. CXXFLAGS="%{l_cxxflags -O}" \
  162. echo "yes" | ./configure \
  163. %if "%{with_pgsql}" == "yes"
  164. -qt-sql-psql \
  165. %endif
  166. %if "%{with_mysql}" == "yes"
  167. -qt-sql-mysql \
  168. %endif
  169. -platform $oscomp \
  170. -prefix %{l_prefix} \
  171. -docdir %{l_prefix}/share/qt/doc \
  172. -datadir %{l_prefix}/share/qt/data \
  173. -plugindir %{l_prefix}/share/qt/plugins \
  174. -translationdir %{l_prefix}/share/qt/translations \
  175. -sysconfdir %{l_prefix}/etc/qt \
  176. -release -shared -stl -sm -xrender -xft \
  177. -qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
  178. -I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
  179. -L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
  180. -R$rflags \
  181. -thread
  182. # make our targets a second time to get threaded libs, too
  183. %{l_make} %{l_mflags -O} \
  184. MAKE="%{l_make} %{l_mflags -O}" \
  185. LD_LIBRARY_PATH=$QTDIR/lib \
  186. sub-src sub-plugins
  187. %endif
  188. # already install our shared libs, and clear out the rest
  189. cp -rf lib dyn
  190. rm -f lib/*
  191. %endif
  192. # start of static lib build
  193. # special trolltech configuration
  194. CC="%{l_cc}" \
  195. CXX="%{l_cxx}" \
  196. CFLAGS="%{l_cflags -O}" \
  197. CXXFLAGS="%{l_cxxflags -O}" \
  198. echo "yes" | ./configure \
  199. %if "%{with_pgsql}" == "yes"
  200. -qt-sql-psql \
  201. %endif
  202. %if "%{with_mysql}" == "yes"
  203. -qt-sql-mysql \
  204. %endif
  205. -platform $oscomp \
  206. -prefix %{l_prefix} \
  207. -docdir %{l_prefix}/share/qt/doc \
  208. -datadir %{l_prefix}/share/qt/data \
  209. -plugindir %{l_prefix}/share/qt/plugins \
  210. -translationdir %{l_prefix}/share/qt/translations \
  211. -sysconfdir %{l_prefix}/etc/qt \
  212. -release -static -stl -sm -xrender -xft \
  213. -qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
  214. -I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
  215. -L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
  216. -no-thread
  217. %{l_make} %{l_mflags -O} \
  218. MAKE="%{l_make} %{l_mflags -O}" \
  219. %if "%{with_tools}" == "yes"
  220. sub-src sub-tools
  221. %else
  222. sub-src
  223. ( cd tools/designer
  224. %{l_make} %{l_mflags -O} \
  225. MAKE="%{l_make} %{l_mflags -O}" \
  226. sub-uic
  227. ) || exit $?
  228. %endif
  229. %if "%{with_threads}" == "yes"
  230. # run configure a second time to get threaded libs as well
  231. CC="%{l_cc}" \
  232. CXX="%{l_cxx}" \
  233. CFLAGS="%{l_cflags -O}" \
  234. CXXFLAGS="%{l_cxxflags -O}" \
  235. echo "yes" | ./configure \
  236. %if "%{with_pgsql}" == "yes"
  237. -qt-sql-psql \
  238. %endif
  239. %if "%{with_mysql}" == "yes"
  240. -qt-sql-mysql \
  241. %endif
  242. -platform $oscomp \
  243. -prefix %{l_prefix} \
  244. -docdir %{l_prefix}/share/qt/doc \
  245. -datadir %{l_prefix}/share/qt/data \
  246. -plugindir %{l_prefix}/share/qt/plugins \
  247. -translationdir %{l_prefix}/share/qt/translations \
  248. -sysconfdir %{l_prefix}/etc/qt \
  249. -release -static -stl -sm -xrender -xft \
  250. -qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-gif \
  251. -I$QTDIR/include %{l_cppflags} -I${l_x11_incdir} \
  252. -L$QTDIR/lib %{l_ldflags} -L${l_x11_libdir} \
  253. -thread
  254. # make our targets a second time to get threaded libs, too
  255. %{l_make} %{l_mflags -O} \
  256. MAKE="%{l_make} %{l_mflags -O}" \
  257. %if "%{with_tools}" == "yes"
  258. sub-src sub-tools
  259. %else
  260. sub-src
  261. ( cd tools/designer
  262. %{l_make} %{l_mflags -O} \
  263. MAKE="%{l_make} %{l_mflags -O}" \
  264. sub-uic
  265. ) || exit $?
  266. %endif
  267. %endif
  268. %install
  269. rm -rf $RPM_BUILD_ROOT
  270. # calculate X11 lib directory in advance
  271. l_x11_libdir=`%{l_prefix}/etc/rc --query x11_libdir`
  272. # make directory structure
  273. %{l_shtool} mkdir -f -p -m 755 \
  274. $RPM_BUILD_ROOT%{l_prefix}/bin \
  275. %if "%{with_shared}" == "yes"
  276. $RPM_BUILD_ROOT%{l_prefix}/lib/qtdyn \
  277. %endif
  278. %if "%{with_tools}" == "yes"
  279. $RPM_BUILD_ROOT%{l_prefix}/share/qt/templates \
  280. $RPM_BUILD_ROOT%{l_prefix}/share/qt/phrasebooks \
  281. $RPM_BUILD_ROOT%{l_prefix}/share/qt/images \
  282. %endif
  283. $RPM_BUILD_ROOT%{l_prefix}/share/qt/doc/html \
  284. $RPM_BUILD_ROOT%{l_prefix}/include/qt/private \
  285. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig \
  286. $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
  287. $RPM_BUILD_ROOT%{l_prefix}/man/man3
  288. # copy binaries, headers, and then libraries to their target
  289. %{l_shtool} install -c -s -m 755 \
  290. bin/qmake bin/moc bin/uic \
  291. $RPM_BUILD_ROOT%{l_prefix}/bin/
  292. %if "%{with_tools}" == "yes"
  293. %{l_shtool} install -c -s -m 755 \
  294. bin/linguist bin/lrelease bin/lupdate \
  295. bin/assistant bin/qtconfig bin/designer \
  296. $RPM_BUILD_ROOT%{l_prefix}/bin/
  297. %endif
  298. # copy mkspecs directory for later portable use of qmake
  299. cp -rp mkspecs.fresh $RPM_BUILD_ROOT%{l_prefix}/share/qt/mkspecs
  300. # correct man suffix
  301. for man in doc/man/man3/*.3qt; do
  302. %{l_shtool} subst -e 's;\.3qt;.3;' $man
  303. mv $man `echo $man | sed -e 's;\.3qt$;.3;'`
  304. done
  305. # copy files to their destinations
  306. %{l_shtool} install -c -m 644 \
  307. include/*.h $RPM_BUILD_ROOT%{l_prefix}/include/qt/
  308. %{l_shtool} install -c -m 644 \
  309. include/private/*.h $RPM_BUILD_ROOT%{l_prefix}/include/qt/private/
  310. %{l_shtool} install -c -m 644 \
  311. lib/*.a lib/*.prl $RPM_BUILD_ROOT%{l_prefix}/lib/
  312. %{l_shtool} install -c -m 644 \
  313. -e "s;\t; ;g" \
  314. -e "s;\ \+; ;g" \
  315. -e "s;\ *$;;g" \
  316. -e "s;-[lL]\ *\-;\-;g" \
  317. -e "s;-l\ *[^ ]*qt\.pc\ *;;g" \
  318. -e "s;-L\ *.[^ ]*\ *;;g" \
  319. -e "s;Libs:;Libs: %{l_ldflags} -L${l_x11_libdir};g" \
  320. -e "s;\(\-l\);\-lqt \1;" \
  321. lib/qt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  322. %if "%{with_threads}" == "yes"
  323. %{l_shtool} install -c -m 644 \
  324. -e "s;\t; ;g" \
  325. -e "s;\ \+; ;g" \
  326. -e "s;\ *$;;g" \
  327. -e "s;-[lL]\ *\-;\-;g" \
  328. -e "s;-l\ *[^ ]*qt\-mt\.pc\ *;;g" \
  329. -e "s;-L\ *.[^ ]*\ *;;g" \
  330. -e "s;Libs:;Libs: %{l_ldflags} -L${l_x11_libdir};g" \
  331. -e "s;\(\-l\);\-lqt\-mt \1;" \
  332. lib/qt-mt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  333. %endif
  334. %if "%{with_shared}" == "yes"
  335. %{l_shtool} install -c -m 644 \
  336. dyn/lib*.so* dyn/*.prl dyn/*.pc $RPM_BUILD_ROOT%{l_prefix}/lib/qtdyn/
  337. %endif
  338. %if "%{with_tools}" == "yes"
  339. %{l_shtool} install -c -m 644 \
  340. tools/designer/templates/*.ui $RPM_BUILD_ROOT%{l_prefix}/share/qt/templates/
  341. %{l_shtool} install -c -m 644 \
  342. tools/linguist/phrasebooks/*.qph $RPM_BUILD_ROOT%{l_prefix}/share/qt/phrasebooks/
  343. %{l_shtool} install -c -m 644 \
  344. tools/designer/designer/images/* $RPM_BUILD_ROOT%{l_prefix}/share/qt/images/
  345. %endif
  346. %{l_shtool} install -c -m 644 \
  347. doc/man/man3/*.3 $RPM_BUILD_ROOT%{l_prefix}/man/man3/
  348. %{l_shtool} install -c -m 644 \
  349. doc/man/man1/*.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  350. %{l_shtool} install -c -m 644 \
  351. doc/html/* $RPM_BUILD_ROOT%{l_prefix}/share/qt/doc/html/
  352. # determine installation files
  353. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  354. %{l_files_std} \
  355. '%not %dir %{l_prefix}/lib/pkgconfig'
  356. %files -f files
  357. %clean
  358. rm -rf $RPM_BUILD_ROOT