qt.spec 14 KB

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