File indexing completed on 2024-12-22 05:27:22
0001 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 0002 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 0003 <head> 0004 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 0005 <title>ROSA Image Writer Deployment Notes</title> 0006 <style type="text/css"> 0007 body { 0008 margin: 1em 4em; 0009 font-family: sans-serif; 0010 font-size: 11pt; 0011 line-height: 125%; 0012 } 0013 h1, h2 { 0014 margin-top: 2em; 0015 text-decoration: underline; 0016 } 0017 code, .code { 0018 font-family: Courier New, monospace; 0019 font-size: 10pt; 0020 border: dashed gray 1px; 0021 background-color: #f5f5ff; 0022 padding: 0px 4px; 0023 } 0024 div.code { 0025 display: inline-block; 0026 } 0027 table.collapsed { 0028 border: solid 1px gray; 0029 border-collapse: collapse; 0030 } 0031 table.collapsed > tbody > tr { 0032 border: none; 0033 } 0034 table.collapsed > tbody > tr > td { 0035 border: solid 1px #c0c0c0; 0036 padding: 2px 4px; 0037 } 0038 </style> 0039 </head> 0040 <body> 0041 <h1>Preface</h1> 0042 <p>This document contains instructions on how to build and package ROSA ImageWriter (further referred to as <i>RIW</i>) as portable application.</p> 0043 <p>Generally, the process looks like this:</p> 0044 <ol> 0045 <li>Compile Qt from sources with static linking.</li> 0046 <li>Build RIW using this Qt version, thus having a single executable binary.</li> 0047 <li>Build the RIW translation files from TS sources.</li> 0048 <li>Put these translations into the <code>lang</code> subdirectory near the RIW executable.</li> 0049 <li>Also copy the same languages from Qt translations into <code>lang</code>.</li> 0050 <li>Add the <code>LICENSE.html</code> and <code>README.html</code> files.</li> 0051 <li>Package the result into appropriate distributable archive.</li> 0052 </ol> 0053 <p>However, some actions may differ depending on the operating system you are working with. Refer to one of the following sections for details.</p> 0054 0055 <h2>Windows</h2> 0056 <p>This scenario was tested under Windows 7 SP1 Pro x64, using SDK from Microsoft Visual Studio 2015 Community Edition Update 3.</p> 0057 <h3>Configuring and building Qt</h3> 0058 <p>Here we suppose that the following paths are used:</p> 0059 <table class="collapsed"> 0060 <tr><td>Qt sources:</td><td class="code">C:\Programs\Qt-static\5.6.1-src\</td></tr> 0061 <tr><td>Qt build directory:</td><td class="code">C:\Programs\Qt-static\5.6.1-build\</td></tr> 0062 <tr><td>Qt installation directory:</td><td class="code">C:\Programs\Qt-static\5.6.1\</td></tr> 0063 </table> 0064 <p>From further on we will omit the prefix <code>C:\Programs\Qt-static\</code>.</p> 0065 <ol> 0066 <!--li>Since Qt 5.5 there is a configure option -static-runtime which makes msvcrt linked statically. For the former Qt versions, special compiler flags are required for that (otherwise, the binary will require <code>msvcrNNN.dll</code> and <code>msvcpNNN.dll</code> which may not be present on all systems). Open the file <code>5.x.y-src\qtbase\mkspecs\win32-msvc2013\qmake.conf</code> and replace the <code>-MD</code> and <code>-MDd</code> flags with <code>-MT</code> and <code>-MTd</code>, respectively (there should be 3 instances). If you are using different version of Visual Studio/SDK, use the file from the correct toolchain subdirectory (e.g. <code>win32-msvc2010</code> for VS2010).</li--> 0067 <li>Open the 32-bit SDK command prompt, change directory to <code>5.6.1-build\</code>.</li> 0068 <li> 0069 Configure the Qt. For decreasing RIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:<br/> 0070 <div class="code">..\5.6.1-src\configure -prefix C:\Programs\Qt-static\5.6.1 -opensource -confirm-license -release -static -static-runtime -target xp -qmake -gui -widgets -accessibility -no-angle -no-audio-backend -no-dbus -no-direct2d -no-directwrite -no-evdev -no-eventfd -no-fontconfig -no-freetype -no-gif -no-harfbuzz -no-iconv -no-icu -no-inotify -largefile -no-libjpeg -qt-libpng -mp -no-mtdev -no-native-gestures -no-nis -no-opengl -no-openssl -no-openvg -qt-pcre -no-plugin-manifests -no-qml-debug -qreal double -rtti -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -no-ssl -strip -no-style-fusion -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -no-system-proxies -no-use-gold-linker -warnings-are-errors -no-wmf-backend -qt-zlib -nomake examples -nomake tests -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns</div> 0071 </li> 0072 <li>When configuring completes, check carefully the status information. Particularly, make sure that correct toolchain is used, otherwise you'll have to specify the toolchain manually (using the <code>QMAKESPEC</code> variable) and reconfigure Qt.</li> 0073 <li>Now run <code>nmake</code> and then <code>nmake install</code>.</li> 0074 <li> 0075 Add Qt binaries path to the environment variable PATH:<br/> 0076 <div class="code">set PATH=C:\Programs\Qt-static\5.6.1\bin;%PATH%</div> 0077 </li> 0078 </ol> 0079 <h3>Building RIW</h3> 0080 <p>Now we can build RIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.</p> 0081 <ol> 0082 <li>Create a new directory and go there. Here we suppose that it is subdirectory <code>build\</code> in RIW sources.</li> 0083 <li> 0084 Run the commands:<br/> 0085 <div class="code"> 0086 qmake ..\RosaImageWriter.pro<br/> 0087 nmake Release<br/> 0088 lrelease ..\RosaImageWriter.pro 0089 </div> 0090 </li> 0091 <li>If you have digital certificate you can sign the executable file <code>release\RosaImageWriter.exe</code> to allow validation and improve Windows UAC prompt displayed when RIW is started.</li> 0092 <li> 0093 All files are now ready, we can package them:<br/> 0094 <div class="code"> 0095 mkdir pkg\RosaImageWriter\lang<br/> 0096 copy release\RosaImageWriter.exe pkg\RosaImageWriter\<br/> 0097 copy ..\doc\README.html pkg\RosaImageWriter\<br/> 0098 copy ..\doc\LICENSE.html pkg\RosaImageWriter\<br/> 0099 copy ..\lang\*.qm pkg\RosaImageWriter\lang\<br/> 0100 copy C:\Programs\Qt-static\5.6.1\translations\qtbase_ru.qm pkg\RosaImageWriter\lang\<br/> 0101 copy C:\Programs\Qt-static\5.6.1\translations\qtbase_de.qm pkg\RosaImageWriter\lang\<br/> 0102 copy C:\Programs\Qt-static\5.6.1\translations\qtbase_fr.qm pkg\RosaImageWriter\lang\<br/> 0103 cd pkg<br/> 0104 7z a RosaImageWriter-win.zip RosaImageWriter 0105 </div><br/> 0106 Please, keep in mind that if new RIW translations appear, the commands given above should be amended to also include Qt translations on the same languages. If translation is split into separate files you need only the <code>qtbase_xx.qm</code> file, otherwise get the main <code>qt_xx.qm</code> file.<br/> 0107 The last command uses 7-Zip archiver to create ZIP archive; you can use any other tool for that purpose. ZIP format is recommended for distributing the application: though it is not the best one in terms of compression, it's supported by all decompressors and even by Windows itself, so users will have no trouble unpacking it. 0108 </li> 0109 <li>The file <code>RosaImageWriter-win.zip</code> is ready for publishing.</li> 0110 </ol> 0111 0112 <h2>Linux</h2> 0113 <p>This scenario was tested under ROSA Desktop Fresh R5 i586 and x86_64, using gcc 4.9.2.</p> 0114 <h3>Configuring and building Qt</h3> 0115 <p>Here we suppose that the following paths are used:</p> 0116 <table class="collapsed"> 0117 <tr><td>Qt sources:</td><td class="code">~/Qt-static/5.6.1-src/</td></tr> 0118 <tr><td>Qt build directory:</td><td class="code">~/Qt-static/5.6.1-build/</td></tr> 0119 <tr><td>Qt installation directory:</td><td class="code">~/Qt-static/5.6.1/</td></tr> 0120 </table> 0121 <p>From further on we will omit the prefix <code>~/Qt-static/</code>.</p> 0122 <ol> 0123 <li> 0124 First, you might want to fix the default build flags. There are two issues in sight: 0125 <ul> 0126 <li>Some debug information remains in the executables even with debug options turned off and executable stripped.</li> 0127 <li><code>libstdc++</code> library uses symbol versions massively. So, the executable we get may not run on a different operating system because of the version mismatch. If you want to avoid this you can use static linking for <code>libstdc++</code>. Of course, you'll need a static version of it (e.g. in ROSA the package <code>libstdc++-static-devel</code> or <code>lib64stdc++-static-devel</code> should be installed).</li> 0128 </ul> 0129 To fix these two issues, open the file <code>5.6.1-src/qtbase/mkspecs/linux-g++/qmake.conf</code> and add the following directives to the end of the file:<br/> 0130 <div class="code"> 0131 QMAKE_CFLAGS += -fno-asynchronous-unwind-tables<br/> 0132 QMAKE_CXXFLAGS += -fno-asynchronous-unwind-tables<br/> 0133 QMAKE_LFLAGS += -static-libstdc++ 0134 </div> 0135 </li> 0136 <li>Now, open terminal, change directory to <code>5.6.1-build/</code>.</li> 0137 <li> 0138 Configure the Qt. For decreasing RIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:<br/> 0139 <div class="code">../5.6.1-src/configure -prefix ~/Qt-static/5.6.1 -opensource -confirm-license -release -static -optimized-qmake -gui -widgets -accessibility -no-alsa -no-cups -no-dbus -no-directfb -no-eglfs -no-evdev -fontconfig -qt-freetype -no-gif -no-glib -no-gtkstyle -qt-harfbuzz -no-iconv -no-icu -no-journald -no-kms -largefile -no-libjpeg -qt-libpng -no-linuxfb -no-mtdev -no-nis -no-opengl -no-openssl -no-pch -qt-pcre -no-pkg-config -no-pulseaudio -no-qml-debug -qreal double -reduce-relocations -no-rpath -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -strip -no-system-proxies -use-gold-linker -no-warnings-are-errors -xcb -qt-xcb -no-xcb-xlib -xinput2 -qt-xkbcommon -qt-zlib -nomake examples -nomake tests -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtxmlpatterns -no-libudev</div> 0140 </li> 0141 <li>When configuring completes, check carefully the status information. Particularly, make sure that correct toolchain is used, otherwise you'll have to specify the toolchain manually (using the <code>QMAKESPEC</code> variable) and reconfigure Qt.</li> 0142 <li>Now run <code>make</code> and then <code>make install</code>.</li> 0143 <li> 0144 Add Qt binaries path to the environment variable PATH:<br/> 0145 <div class="code">export PATH=~/Qt-static/5.6.1/bin:$PATH</div> 0146 </li> 0147 </ol> 0148 <h3>Building RIW</h3> 0149 <p>Now we can build RIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.</p> 0150 <ol> 0151 <li>Create a new directory and go there. Here we suppose that it is subdirectory <code>build/</code> in RIW sources.</li> 0152 <li> 0153 Run the commands:<br/> 0154 <div class="code"> 0155 qmake ../RosaImageWriter.pro<br/> 0156 make<br/> 0157 lrelease ../RosaImageWriter.pro 0158 </div> 0159 </li> 0160 <li> 0161 All files are now ready, we can package them:<br/> 0162 <div class="code"> 0163 mkdir -p pkg/RosaImageWriter/lang<br/> 0164 cp RosaImageWriter ../doc/README.html ../doc/LICENSE.html pkg/RosaImageWriter/<br/> 0165 cp ../lang/*.qm ~/Qt-static/5.6.1/translations/{qtbase_ru,qtbase_de,qtbase_fr}.qm pkg/RosaImageWriter/lang/<br/> 0166 cd pkg<br/> 0167 tar cJf RosaImageWriter-lin.tar.xz RosaImageWriter 0168 </div><br/> 0169 Please, keep in mind that if new RIW translations appear, the commands given above should be amended to also include Qt translations on the same languages. If translation is split into separate files you need only the <code>qtbase_xx.qm</code> file, otherwise get the main <code>qt_xx.qm</code> file.<br/> 0170 </li> 0171 <li>The file <code>RosaImageWriter-lin.tar.xz</code> is ready for publishing.</li> 0172 </ol> 0173 0174 <h2>Mac OS X</h2> 0175 <p>This scenario was tested under OS X 10.8.5 Mountain Lion with Xcode 5.1.1, and OS X 10.10.4 Yosemite with Xcode 6.4.</p> 0176 <h3>Configuring and building Qt</h3> 0177 <p>Here we suppose that the following paths are used:</p> 0178 <table class="collapsed"> 0179 <tr><td>Qt sources:</td><td class="code">~/Qt-static/5.6.1-src/</td></tr> 0180 <tr><td>Qt build directory:</td><td class="code">~/Qt-static/5.6.1-build/</td></tr> 0181 <tr><td>Qt installation directory:</td><td class="code">~/Qt-static/5.6.1/</td></tr> 0182 </table> 0183 <p>From further on we will omit the prefix <code>~/Qt-static/</code>.</p> 0184 <ol> 0185 <li>If you installed Xcode first time you need to start it and accept the license agreement. Otherwise command-line build tools will not work.</li> 0186 <li>Open terminal, change directory to <code>5.6.1-build/</code>.</li> 0187 <li> 0188 Configure the Qt. For decreasing RIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:<br/> 0189 <div class="code">../5.6.1-src/configure -prefix ~/Qt-static/5.6.1 -opensource -confirm-license -release -static -optimized-qmake -gui -widgets -accessibility -no-alsa -no-cups -no-dbus -no-directfb -no-eglfs -no-evdev -no-fontconfig -no-freetype -no-gif -no-glib -no-gtkstyle -qt-harfbuzz -no-iconv -no-icu -no-journald -no-kms -largefile -no-libjpeg -qt-libpng -no-linuxfb -no-mtdev -no-nis -no-opengl -no-openssl -no-pch -qt-pcre -no-pkg-config -no-pulseaudio -no-qml-debug -qreal double -no-reduce-relocations -no-rpath -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -strip -no-system-proxies -no-use-gold-linker -no-warnings-are-errors -no-xcb -no-xcb-xlib -no-xinput2 -qt-xkbcommon -qt-zlib -nomake examples -nomake tests -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -no-libudev -no-framework</div> 0190 </li> 0191 <li>When configuring completes, check carefully the status information.</li> 0192 <li>Now run <code>make</code> and then <code>make install</code>.</li> 0193 <li> 0194 Add Qt binaries path to the environment variable PATH:<br/> 0195 <div class="code">export PATH=~/Qt-static/5.6.1/bin:$PATH</div> 0196 </li> 0197 </ol> 0198 <h3>Building RIW</h3> 0199 <p>Now we can build RIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.</p> 0200 <ol> 0201 <li>Create a new directory and go there. Here we suppose that it is subdirectory <code>build/</code> in RIW sources.</li> 0202 <li> 0203 Run the commands:<br/> 0204 <div class="code"> 0205 qmake ../RosaImageWriter.pro<br/> 0206 make<br/> 0207 lrelease ../RosaImageWriter.pro 0208 </div> 0209 </li> 0210 <li> 0211 The application bundle is now ready, we can supply it with additional files and package it:<br/> 0212 <div class="code"> 0213 mkdir pkg<br/> 0214 mv RosaImageWriter.app pkg/<br/> 0215 mkdir pkg/RosaImageWriter.app/Contents/MacOS/lang<br/> 0216 cp ../doc/README.html ../doc/LICENSE.html pkg/<br/> 0217 cp ../lang/*.qm ~/Qt-static/5.6.1/translations/{qtbase_ru,qtbase_de,qtbase_fr}.qm pkg/RosaImageWriter.app/Contents/MacOS/lang/<br/> 0218 hdiutil create -format UDBZ -volname 'ROSA ImageWriter' -scrub -srcfolder pkg/ temp.dmg<br/> 0219 hdiutil convert temp.dmg -format UDBZ -o RosaImageWriter-osx.dmg<br/> 0220 rm -f temp.dmg 0221 </div><br/> 0222 (Converting from UDBZ to UDBZ is not required but, though it looks strange, it might decrease the DMG image size by 4%.)<br/> 0223 Please, keep in mind that if new RIW translations appear, the commands given above should be amended to also include Qt translations on the same languages. If translation is split into separate files you need only the <code>qtbase_xx.qm</code> file, otherwise get the main <code>qt_xx.qm</code> file.<br/> 0224 </li> 0225 <li>The file <code>RosaImageWriter-osx.dmg</code> is ready for publishing.</li> 0226 </ol> 0227 <!-- 0228 Some outdated command lines from OS X build process (Qt 5.1.0 bundle from official site, packaging RIW with all the necessary Qt DLLs and plugins): 0229 0230 /Users/rosa/Qt5.1.0/5.1.0/clang_64/bin/macdeployqt /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app 0231 mkdir /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app/Contents/MacOS/lang 0232 /Users/rosa/Qt5.1.0/5.1.0/clang_64/bin/lrelease /Users/rosa/Documents/devel/rosa-image-writer/RosaImageWriter.pro 0233 cp /Users/rosa/Qt5.1.0/5.1.0/clang_64/translations/{qtbase_ru.qm,qtbase_fr.qm} /Users/rosa/Documents/devel/rosa-image-writer/lang/*.qm /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app/Contents/MacOS/lang/ 0234 echo 'Translations = MacOS/lang' >> /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app/Contents/Resources/qt.conf 0235 rm -f /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app/Contents/PlugIns/imageformats/lib{qgif,qjpeg,qmng,qtga,qtiff,qwbmp}.dylib 0236 rm -rf /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/{temp,temp.dmg,RosaImageWriter.dmg} 0237 mkdir /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp 0238 mv /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.app /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp/ 0239 cp /Users/rosa/Documents/devel/rosa-image-writer/doc/{LICENSE.html,README.html} /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp/ 0240 hdiutil create -size 32m -fs HFS+ -volname 'ROSA ImageWriter' -scrub -srcfolder /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp/ /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp.dmg 0241 hdiutil convert /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/temp.dmg -format UDZO -o /Users/rosa/Documents/devel/build-RosaImageWriter-Desktop_Qt_5_1_0_clang_64bit-Release/RosaImageWriter.dmg 0242 0243 # Deployment: 0244 for f in MacOS/RosaImageWriter Frameworks/QtCore.framework/Versions/5/QtCore Frameworks/QtGui.framework/Versions/5/QtGui Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport Frameworks/QtWidgets.framework/Versions/5/QtWidgets PlugIns/accessible/libqtaccessiblewidgets.dylib PlugIns/imageformats/libqico.dylib PlugIns/platforms/libqcocoa.dylib PlugIns/printsupport/libcocoaprintersupport.dylib; do install_name_tool -change /Users/rosa/Qt5.1.0//5.1.0/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore -change /Users/rosa/Qt5.1.0//5.1.0/clang_64/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui -change /Users/rosa/Qt5.1.0//5.1.0/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport @executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport -change /Users/rosa/Qt5.1.0//5.1.0/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets $f; done 0245 --> 0246 0247 <hr style="width: 75%;" /> 0248 <p style="font-size: 75%; text-align: center;"><i>Copyright © 2016 NTC IT ROSA LLC</i></p> 0249 0250 </body> 0251 </html>