qt.spec 13 KB

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