Advertisement
Guest User

(almost) Build Script for qt 5.2.1 on CentOS 5.7

a guest
Jul 16th, 2014
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.54 KB | None | 0 0
  1. #!/bin/bash
  2. set -ex
  3. # script based off of https://qt-project.org/forums/viewthread/38354
  4. if gcc --version | grep -q 4\.1 ; then
  5. mkdir -p /tmp/gcc
  6. ln -fs /usr/bin/gcc44 /tmp/gcc/gcc
  7. ln -fs /usr/bin/g++44 /tmp/gcc/g++
  8. export PATH=/tmp/gcc:$PATH
  9. hash -r
  10. fi
  11.  
  12. # Download packages (versions may vary)
  13. for i in \
  14. https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz \
  15. http://sqlite.org/2014/sqlite-autoconf-3080300.tar.gz \
  16. http://download.icu-project.org/files/icu4c/50.1.2/icu4c-50_1_2-src.tgz \
  17. http://heanet.dl.sourceforge.net/project/flex/flex-2.5.37.tar.gz \
  18. http://ftp.gnu.org/gnu/gperf/gperf-3.0.4.tar.gz \
  19. http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz \
  20. http://xcb.freedesktop.org/dist/xcb-proto-1.10.tar.gz \
  21. http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.gz \
  22. http://xorg.freedesktop.org/archive/individual/proto/xproto-7.0.25.tar.gz \
  23. http://xcb.freedesktop.org/dist/libxcb-1.10.tar.gz \
  24. http://xcb.freedesktop.org/dist/xcb-util-0.3.9.tar.gz \
  25. http://xcb.freedesktop.org/dist/xcb-util-image-0.3.9.tar.gz \
  26. http://xcb.freedesktop.org/dist/xcb-util-keysyms-0.3.9.tar.gz \
  27. http://xcb.freedesktop.org/dist/xcb-util-wm-0.4.0.tar.gz \
  28. http://xcb.freedesktop.org/dist/xcb-util-renderutil-0.3.8.tar.gz \
  29. http://xcb.freedesktop.org/dist/xcb-util-cursor-0.1.1.tar.gz \
  30. ; do
  31. test -f ${i##*/} || wget $i --no-check-certificate
  32. done
  33.  
  34. mv Python-2.6.9.tgz Python-2.6.9.tar.gz # rename or we break for loop
  35.  
  36. TARGET=$PWD/qt5-install
  37. export PYTHON=${TARGET}/usr/local/bin/python2.6
  38. export PATH=${TARGET}/usr/local/bin:$PATH
  39. export LD_LIBRARY_PATH=${TARGET}/usr/local/lib
  40.  
  41. # Build ICU
  42. tar xvf icu4c-50_1_2-src.tgz
  43. cd icu/source
  44. ./configure && make -j16 && make install DESTDIR=${TARGET}
  45. cd ../..
  46.  
  47. # Build the rest
  48. configopt=()
  49. configopt['libxml2']="--without-python"
  50. for i in \
  51. Python-2.6.9.tar.gz \
  52. sqlite-autoconf-3080300.tar.gz \
  53. flex-2.5.37.tar.gz \
  54. gperf-3.0.4.tar.gz \
  55. libxml2-2.9.1.tar.gz \
  56. xcb-proto-1.10.tar.gz \
  57. libpthread-stubs-0.1.tar.gz \
  58. xproto-7.0.25.tar.gz \
  59. libxcb-1.10.tar.gz \
  60. xcb-util-0.3.9.tar.gz \
  61. xcb-util-image-0.3.9.tar.gz \
  62. xcb-util-keysyms-0.3.9.tar.gz \
  63. xcb-util-wm-0.4.0.tar.gz \
  64. xcb-util-renderutil-0.3.8.tar.gz \
  65. xcb-util-cursor-0.1.1.tar.gz \
  66. ; do
  67. test -d ${i%.*.*} && continue
  68. log=${i%.*.*}.log
  69. printf "*** Building $i ... " >&2
  70. if ( \
  71. tar xvf $i \
  72. && cd ${i%.*.*} \
  73. && PKG_CONFIG_PATH="${TARGET}/usr/local/lib/pkgconfig" \
  74. ./configure -prefix ${TARGET}/usr/local ${configopt[${i%%-*}]} \
  75. && make \
  76. && make install \
  77. && cd .. \
  78. || exit 1 ) >${log} 2>&1 ; then
  79. echo "OK" >&2
  80. else
  81. echo "ERROR" >&2
  82. cat ${log}
  83. exit 1
  84. fi
  85. done
  86. echo "All done" >&2
  87. wget http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.tar.gz
  88. tar xvfz qt-everywhere-opensource-src-5.2.1.tar.gz
  89. cd qt-everywhere-opensource-src-5.2.1
  90.  
  91. patch -p0 << EOF
  92. --- ./qtbase/src/testlib/3rdparty/linux_perf_event_p.h.orig 2014-02-01 20:35:39.000000000 +0100
  93. +++ ./qtbase/src/testlib/3rdparty/linux_perf_event_p.h 2014-02-06 14:25:38.000000000 +0100
  94. @@ -14,6 +14,7 @@
  95. #ifndef _UAPI_LINUX_PERF_EVENT_H
  96. #define _UAPI_LINUX_PERF_EVENT_H
  97.  
  98. +#undef __STRICT_ANSI__
  99. #include <linux/types.h>
  100. #include <linux/ioctl.h>
  101. #include <asm/byteorder.h>
  102. EOF
  103.  
  104. patch -p0 << EOF
  105. --- ./qtbase/src/network/ssl/qsslcontext.cpp.orig 2014-02-06 14:30:24.000000000 +0100
  106. +++ ./qtbase/src/network/ssl/qsslcontext.cpp 2014-02-06 14:30:35.000000000 +0100
  107. @@ -311,7 +311,7 @@
  108. unsigned char *data = reinterpret_cast<unsigned char *>(m_sessionASN1.data());
  109. if (!q_i2d_SSL_SESSION(session, &data))
  110. qWarning("could not store persistent version of SSL session");
  111. - m_sessionTicketLifeTimeHint = session->tlsext_tick_lifetime_hint;
  112. + //m_sessionTicketLifeTimeHint = session->tlsext_tick_lifetime_hint;
  113. }
  114. }
  115. EOF
  116.  
  117. patch -p0 << EOF
  118. --- ./qtbase/src/network/ssl/qsslsocket_openssl.cpp.orig 2014-02-06 14:47:04.000000000 +0100
  119. +++ ./qtbase/src/network/ssl/qsslsocket_openssl.cpp 2014-02-06 14:47:19.000000000 +0100
  120. @@ -1431,8 +1431,8 @@
  121. if (readBufferMaxSize)
  122. plainSocket->setReadBufferSize(readBufferMaxSize);
  123.  
  124. - if (q_SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL))
  125. - configuration.peerSessionShared = true;
  126. + //if (q_SSL_ctrl((ssl), SSL_CTRL_GET_SESSION_REUSED, 0, NULL))
  127. + // configuration.peerSessionShared = true;
  128.  
  129. #ifdef QT_DECRYPT_SSL_TRAFFIC
  130. if (ssl->session && ssl->s3) {
  131. EOF
  132.  
  133. patch -p0 << EOF
  134. --- ./qtbase/src/3rdparty/xcb/include/xcb/xcb_pixel.h.orig 2014-02-01 20:35:35.000000000 +0100
  135. +++ ./qtbase/src/3rdparty/xcb/include/xcb/xcb_pixel.h 2014-02-11 11:11:18.000000000 +0100
  136. @@ -33,6 +33,9 @@
  137. #include <xcb/xcb_image.h>
  138. #endif
  139.  
  140. +#undef _X_INLINE
  141. +#define _X_INLINE
  142. +
  143. /**
  144. * XCB Image fast pixel ops.
  145. *
  146. EOF
  147.  
  148. patch -p0 << EOF
  149. --- ./qtbase/src/3rdparty/xcb/include/xcb/xcb_bitops.h.orig 2014-02-01 20:35:35.000000000 +0100
  150. +++ ./qtbase/src/3rdparty/xcb/include/xcb/xcb_bitops.h 2014-02-11 11:10:48.000000000 +0100
  151. @@ -38,6 +38,9 @@
  152. * @{
  153. */
  154.  
  155. +#undef _X_INLINE
  156. +#define _X_INLINE
  157. +
  158.  
  159. /**
  160. * Create a low-order bitmask.
  161. EOF
  162.  
  163. patch -p0 << EOF
  164. --- ./qtbase/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp.orig 2014-02-01 20:35:39.000000000 +0100
  165. +++ ./qtbase/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp 2014-02-13 08:06:37.043558016 +0100
  166. @@ -52,6 +52,8 @@
  167. #include <qpa/qplatformsurface.h>
  168. #include <qsurface.h>
  169.  
  170. +#include <stdio.h>
  171. +
  172. QT_BEGIN_NAMESPACE
  173.  
  174. QOffscreenIntegration *QOffscreenIntegration::createOffscreenIntegration()
  175. @@ -231,7 +233,9 @@
  176.  
  177. void (*QOffscreenX11GLXContext::getProcAddress(const QByteArray &procName)) ()
  178. {
  179. - return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData()));
  180. + //return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData()));
  181. + fprintf(stderr, "** QOffscreenX11GLXContext::getProcAddress() called, but no support compiled\n");
  182. + return NULL;
  183. }
  184.  
  185. QSurfaceFormat QOffscreenX11GLXContext::format() const
  186. EOF
  187.  
  188. # hardcoded libxml2 include directory, sheesh
  189. patch -p0 << EOF
  190. --- ./qtwebkit/Tools/qmake/config.tests/libxml2/libxml2.pro.orig 2014-02-01 20:35:44.000000000 +0100
  191. +++ ./qtwebkit/Tools/qmake/config.tests/libxml2/libxml2.pro 2014-02-12 08:09:27.000000000 +0100
  192. @@ -1,9 +1,11 @@
  193. CONFIG -= qt
  194. SOURCES = libxml2.cpp
  195. mac {
  196. - QMAKE_CXXFLAGS += -iwithsysroot /usr/include/libxml2
  197. + QMAKE_CXXFLAGS += -iwithsysroot ${TARGET}/usr/local/include/libxml2
  198. LIBS += -lxml2
  199. } else {
  200. + QMAKE_CXXFLAGS += -I ${TARGET}/usr/local/include/libxml2
  201. + QMAKE_LFLAGS += -L ${TARGET}/usr/local/lib
  202. PKGCONFIG += libxml-2.0
  203. CONFIG += link_pkgconfig
  204. }
  205. EOF
  206.  
  207. patch -p0 << EOF
  208. --- ./qtwebkit/Tools/qmake/config.tests/libxslt/libxslt.pro.orig 2014-02-01 20:35:44.000000000 +0100
  209. +++ ./qtwebkit/Tools/qmake/config.tests/libxslt/libxslt.pro 2014-02-12 08:09:59.000000000 +0100
  210. @@ -1,9 +1,11 @@
  211. CONFIG -= qt
  212. SOURCES = libxslt.cpp
  213. mac {
  214. - QMAKE_CXXFLAGS += -iwithsysroot /usr/include/libxslt -iwithsysroot /usr/include/libxml2
  215. + QMAKE_CXXFLAGS += -iwithsysroot /usr/include/libxslt -iwithsysroot ${TARGET}/usr/local/include/libxml2
  216. LIBS += -lxslt
  217. } else {
  218. + QMAKE_CXXFLAGS += -I ${TARGET}/usr/local/include/libxml2
  219. + QMAKE_LFLAGS += -L ${TARGET}/usr/local/lib
  220. PKGCONFIG += libxslt
  221. CONFIG += link_pkgconfig
  222. }
  223. EOF
  224.  
  225. patch -p0 << EOF
  226. --- qtwebkit/Source/WebCore/WebCore.pri.orig 2014-02-01 20:35:46.000000000 +0100
  227. +++ qtwebkit/Source/WebCore/WebCore.pri 2014-02-12 08:10:37.000000000 +0100
  228. @@ -112,9 +112,11 @@
  229. enable?(XSLT) {
  230. use?(LIBXML2) {
  231. mac {
  232. - QMAKE_CXXFLAGS += -iwithsysroot /usr/include/libxslt -iwithsysroot /usr/include/libxml2
  233. + QMAKE_CXXFLAGS += -iwithsysroot /usr/include/libxslt -iwithsysroot ${TARGET}/usr/local/include/libxml2
  234. LIBS += -lxml2 -lxslt
  235. } else {
  236. + QMAKE_CXXFLAGS += -I ${TARGET}/usr/local/include/libxml2
  237. + QMAKE_LFLAGS += -L ${TARGET}/usr/local/lib
  238. PKGCONFIG += libxslt libxml-2.0
  239. }
  240. } else {
  241. EOF
  242.  
  243. patch -p0 << EOF
  244. --- qtwebkit/Source/WebCore/Configurations/WebCore.xcconfig.orig 2014-02-01 20:35:54.000000000 +0100
  245. +++ qtwebkit/Source/WebCore/Configurations/WebCore.xcconfig 2014-02-11 17:11:11.000000000 +0100
  246. @@ -46,7 +46,7 @@
  247. STAGED_FRAMEWORKS_SEARCH_PATH = \$(STAGED_FRAMEWORKS_SEARCH_PATH_\$(USE_STAGING_INSTALL_PATH));
  248. STAGED_FRAMEWORKS_SEARCH_PATH_YES = \$(NEXT_ROOT)\$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
  249.  
  250. -HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 "\${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "\${BUILT_PRODUCTS_DIR}/usr/local/include" \$(HEADER_SEARCH_PATHS);
  251. +HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt ${TARGET}/usr/local/include/libxml2 "\${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "\${BUILT_PRODUCTS_DIR}/usr/local/include" \$(HEADER_SEARCH_PATHS);
  252. INFOPLIST_FILE = Info.plist;
  253. INSTALL_PATH = \$(INSTALL_PATH_\$(PLATFORM_NAME));
  254. INSTALL_PATH_iphoneos = \$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
  255. EOF
  256.  
  257. # ar/binutils is too old on RH5 to support the 'T' flag
  258. patch -p0 << EOF
  259. --- qtwebkit/Source/WebKit2/GNUmakefile.am.orig 2014-02-01 20:35:59.000000000 +0100
  260. +++ qtwebkit/Source/WebKit2/GNUmakefile.am 2014-02-12 11:17:13.000000000 +0100
  261. @@ -588,7 +588,7 @@
  262. WebCoreLayerGtk2.a: \$(webcore_layer_gtk2_deps)
  263. \$(AM_V_GEN)
  264. \$(AM_V_at)\$(shell rm -f \$@)
  265. - \$(AM_V_at)\$(foreach archive, \$(webcore_layer_gtk2_archives), \$(shell ar t \$(archive) | xargs -n50 ar cruT \$@))
  266. + \$(AM_V_at)\$(foreach archive, \$(webcore_layer_gtk2_archives), \$(shell ar t \$(archive) | xargs -n50 ar cru \$@))
  267.  
  268. DISTCLEANFILES += \
  269. \$(top_builddir)/WebCoreLayerGtk2.a
  270. EOF
  271.  
  272. patch -p0 << EOF
  273. --- qtwebkit/Tools/TestWebKitAPI/GNUmakefile.am.orig 2014-02-01 20:35:44.000000000 +0100
  274. +++ qtwebkit/Tools/TestWebKitAPI/GNUmakefile.am 2014-02-12 11:18:28.000000000 +0100
  275. @@ -122,7 +122,7 @@
  276. WebCoreLayer.a: \$(webcore_layer_deps)
  277. \$(AM_V_GEN)
  278. \$(AM_V_at)\$(shell rm -f \$@)
  279. - \$(AM_V_at)\$(foreach archive, \$(webcore_layer_archives), \$(shell ar t \$(archive) | xargs -n50 ar cruT \$@))
  280. + \$(AM_V_at)\$(foreach archive, \$(webcore_layer_archives), \$(shell ar t \$(archive) | xargs -n50 ar cru \$@))
  281.  
  282. DISTCLEANFILES += \
  283. \$(top_builddir)/WebCoreLayer.a
  284. EOF
  285.  
  286. patch -p0 << EOF
  287. --- qtwebkit/Tools/qmake/mkspecs/features/default_post.prf.orig 2014-02-01 20:35:44.000000000 +0100
  288. +++ qtwebkit/Tools/qmake/mkspecs/features/default_post.prf 2014-02-12 11:22:10.000000000 +0100
  289. @@ -275,7 +275,7 @@
  290. # Replace the hardcoded archiver command line
  291. # options to use GNU ar's thin archive format.
  292. AR_COMMAND = \$\$split(QMAKE_AR, " ")
  293. - QMAKE_AR = \$\$member(AR_COMMAND, 0) cruT
  294. + QMAKE_AR = \$\$member(AR_COMMAND, 0) cru
  295. }
  296.  
  297. isEmpty(DESTDIR): DESTDIR = \$\$targetSubDir()
  298. EOF
  299.  
  300. patch -p0 << EOF
  301. --- qtwebkit/Source/autotools/SetupLibtool.m4.orig 2014-02-01 20:35:58.000000000 +0100
  302. +++ qtwebkit/Source/autotools/SetupLibtool.m4 2014-02-12 11:23:09.000000000 +0100
  303. @@ -6,7 +6,7 @@
  304. AC_SUBST([LIBWEBKIT2GTK_VERSION])
  305.  
  306. if test -z "\$AR_FLAGS"; then
  307. - AR_FLAGS="cruT"
  308. + AR_FLAGS="cru"
  309. fi
  310.  
  311. DOLT
  312. EOF
  313.  
  314. # missing O_CLOEXEC/FD_CLOEXEC
  315. patch -p0 << EOF
  316. --- qtwebkit/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp.orig 2014-02-01 20:35:59.000000000 +0100
  317. +++ qtwebkit/Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp 2014-02-12 14:54:53.357149313 +0100
  318. @@ -48,6 +48,13 @@
  319. #include <linux/ashmem.h>
  320. #endif
  321.  
  322. +#ifndef O_CLOEXEC
  323. +#define O_CLOEXEC 02000000 /* set close_on_exec */
  324. +#endif
  325. +#ifndef FD_CLOEXEC
  326. +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
  327. +#endif
  328. +
  329. namespace WebKit {
  330.  
  331. SharedMemory::Handle::Handle()
  332. EOF
  333.  
  334. # being able to use --disable-rpath in configure scripts
  335. patch -p0 << EOF
  336. --- qtbase/mkspecs/linux-g++/qmake.conf.orig 2014-02-01 20:35:40.000000000 +0100
  337. +++ qtbase/mkspecs/linux-g++/qmake.conf 2014-02-13 10:38:31.000000000 +0100
  338. @@ -6,6 +6,8 @@
  339. CONFIG += incremental gdb_dwarf_index
  340. QMAKE_INCREMENTAL_STYLE = sublib
  341.  
  342. +QMAKE_LFLAGS = -Wl,-rpath-link=${TARGET}/usr/local/lib
  343. +
  344. include(../common/linux.conf)
  345. include(../common/gcc-base-unix.conf)
  346. include(../common/g++-unix.conf)
  347. EOF
  348. patch -p0 << EOF
  349. --- qtbase/mkspecs/linux-g++-64/qmake.conf.orig 2014-02-01 20:35:40.000000000 +0100
  350. +++ qtbase/mkspecs/linux-g++-64/qmake.conf 2014-02-13 10:36:00.000000000 +0100
  351. @@ -10,7 +10,7 @@
  352. QMAKE_INCREMENTAL_STYLE = sublib
  353.  
  354. QMAKE_CFLAGS = -m64
  355. -QMAKE_LFLAGS = -m64
  356. +QMAKE_LFLAGS = -m64 -Wl,-rpath-link=${TARGET}/usr/local/lib
  357.  
  358. include(../common/linux.conf)
  359. include(../common/gcc-base-unix.conf)
  360. EOF
  361.  
  362. # fixing GCC weird issue (possible bug)
  363. patch -p0 << EOF
  364. --- ./qtbase/src/corelib/tools/qmap.h.orig 2014-02-01 20:35:38.000000000 +0100
  365. +++ ./qtbase/src/corelib/tools/qmap.h 2014-02-13 11:42:06.000000000 +0100
  366. @@ -131,8 +131,10 @@
  367. QMapNode<Key, T> *lowerBound(const Key &key);
  368. QMapNode<Key, T> *upperBound(const Key &key);
  369.  
  370. -private:
  371. +//private:
  372. +///QtCore/qmap.h:112: error: 'struct QMapNode<Key, T>' only defines private constructors and has no friends
  373. QMapNode() Q_DECL_EQ_DELETE;
  374. +private:
  375. Q_DISABLE_COPY(QMapNode)
  376. };
  377.  
  378. EOF
  379.  
  380. cat << EOF > ${TARGET}/usr/local/include/pthread.h
  381. #ifndef X_PTHREAD_PRIVATE_OVERRIDE
  382. #define X_PTHREAD_PRIVATE_OVERRIDE
  383. /* Override pthread_equal() to avoid missing symbol at link.
  384. * Possibly related to <https://bugzilla.redhat.com/show_bug.cgi?id=102098>
  385. */
  386. #include "/usr/include/pthread.h"
  387. #undef pthread_equal
  388. #define pthread_equal pthread_equal_inlined
  389. static int pthread_equal (pthread_t thread1, pthread_t thread2) __attribute__ ((unused));
  390. static int pthread_equal (pthread_t thread1, pthread_t thread2) {
  391. return thread1 == thread2;
  392. }
  393. #endif
  394. EOF
  395.  
  396. # configure
  397. ./configure -v -shared -opensource -release -optimized-qmake -separate-debug-info -fontconfig -qt-libjpeg -qt-libpng -no-audio-backend -no-compile-examples -no-c++11 -icu -xcb -xcb-xlib \
  398. -prefix ${TARGET} \
  399. -I ${TARGET}/usr/local/include \
  400. -I ${TARGET}/usr/local/include/libxml2 \
  401. -L ${TARGET}/usr/local/lib
  402.  
  403. # build
  404. make -j16 && make install || echo "failed to build"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement