Preface

This document contains instructions on how to build and package OpenMandriva ImageWriter (further referred to as OMIW) as portable application.

Generally, the process looks like this:

  1. Compile Qt from sources with static linking.
  2. Build OMIW using this Qt version, thus having a single executable binary.
  3. Build the OMIW translation files from TS sources.
  4. Put these translations into the lang subdirectory near the OMIW executable.
  5. Also copy the same languages from Qt translations into lang.
  6. Add the LICENSE.html and README.html files.
  7. Package the result into appropriate distributable archive.

However, some actions may differ depending on the operating system you are working with. Refer to one of the following sections for details.

Windows

This scenario was tested under Windows 7 SP1 Pro x64, using SDK from Microsoft Visual Studio 2015 Community Edition Update 3.

Configuring and building Qt

Here we suppose that the following paths are used:

From further on we will omit the prefix C:\Programs\Qt-static\.

  1. Open the 32-bit SDK command prompt, change directory to 5.6.1-build\.
  2. Configure the Qt. For decreasing OMIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:
    ..\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
  3. 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 QMAKESPEC variable) and reconfigure Qt.
  4. Now run nmake and then nmake install.
  5. Add Qt binaries path to the environment variable PATH:
    set PATH=C:\Programs\Qt-static\5.6.1\bin;%PATH%

Building OMIW

Now we can build OMIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.

  1. Create a new directory and go there. Here we suppose that it is subdirectory build\ in OMIW sources.
  2. Run the commands:
    qmake ..\OMImageWriter.pro
    nmake Release
    lrelease ..\OMImageWriter.pro
  3. If you have digital certificate you can sign the executable file release\OMImageWriter.exe to allow validation and improve Windows UAC prompt displayed when OMIW is started.
  4. All files are now ready, we can package them:
    mkdir pkg\OMImageWriter\lang
    copy release\OMImageWriter.exe pkg\OMImageWriter\
    copy ..\doc\README.html pkg\OMImageWriter\
    copy ..\doc\LICENSE.html pkg\OMImageWriter\
    copy ..\lang\*.qm pkg\OMImageWriter\lang\
    copy C:\Programs\Qt-static\5.6.1\translations\qtbase_ru.qm pkg\OMImageWriter\lang\
    copy C:\Programs\Qt-static\5.6.1\translations\qtbase_de.qm pkg\OMImageWriter\lang\
    copy C:\Programs\Qt-static\5.6.1\translations\qtbase_fr.qm pkg\OMImageWriter\lang\
    cd pkg
    7z a OMImageWriter-win.zip OMImageWriter

    Please, keep in mind that if new OMIW 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 qtbase_xx.qm file, otherwise get the main qt_xx.qm file.
    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.
  5. The file OMImageWriter-win.zip is ready for publishing.

Linux

This scenario was tested under OpenMandriva ROMS 2024.07 x86_64 and znver1, using clang 18.1.8.

Configuring and building Qt

Here we suppose that the following paths are used:

From further on we will omit the prefix ~/Qt-static/.

  1. First, you might want to fix the default build flags. There are two issues in sight: To fix these two issues, open the file 6.7.2-src/qtbase/mkspecs/linux-clang++/qmake.conf and add the following directives to the end of the file:
    QMAKE_CFLAGS += -fno-asynchronous-unwind-tables
    QMAKE_CXXFLAGS += -fno-asynchronous-unwind-tables
    QMAKE_LFLAGS += -static-libstdc++
  2. Now, open terminal, change directory to 6.7.2-build/.
  3. Configure the Qt. For decreasing OMIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:
    ../6.7.2-src/configure -prefix ~/Qt-static/6.7.2 -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
  4. 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 QMAKESPEC variable) and reconfigure Qt.
  5. Now run make and then make install.
  6. Add Qt binaries path to the environment variable PATH:
    export PATH=~/Qt-static/6.7.2/bin:$PATH

Building OMIW

Now we can build OMIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.

  1. Create a new directory and go there. Here we suppose that it is subdirectory build/ in OMIW sources.
  2. Run the commands:
    qmake ../OMImageWriter.pro
    make
    lrelease ../OMImageWriter.pro
  3. All files are now ready, we can package them:
    mkdir -p pkg/OMImageWriter/lang
    cp OMImageWriter ../doc/README.html ../doc/LICENSE.html pkg/OMImageWriter/
    cp ../lang/*.qm ~/Qt-static/5.6.1/translations/{qtbase_ru,qtbase_de,qtbase_fr}.qm pkg/OMImageWriter/lang/
    cd pkg
    tar cJf OMImageWriter-lin.tar.xz OMImageWriter

    Please, keep in mind that if new OMIW 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 qtbase_xx.qm file, otherwise get the main qt_xx.qm file.
  4. The file OMImageWriter-lin.tar.xz is ready for publishing.

Mac OS X

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.

Configuring and building Qt

Here we suppose that the following paths are used:

From further on we will omit the prefix ~/Qt-static/.

  1. If you installed Xcode first time you need to start it and accept the license agreement. Otherwise command-line build tools will not work.
  2. Open terminal, change directory to 5.6.1-build/.
  3. Configure the Qt. For decreasing OMIW executable size and speed up Qt build process, we recommend to turn off all unused features and modules. The following command can be used:
    ../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
  4. When configuring completes, check carefully the status information.
  5. Now run make and then make install.
  6. Add Qt binaries path to the environment variable PATH:
    export PATH=~/Qt-static/5.6.1/bin:$PATH

Building OMIW

Now we can build OMIW. It is better to do it in a separate subdirectory to avoid polluting the sources with temporary files.

  1. Create a new directory and go there. Here we suppose that it is subdirectory build/ in OMIW sources.
  2. Run the commands:
    qmake ../OMImageWriter.pro
    make
    lrelease ../OMImageWriter.pro
  3. The application bundle is now ready, we can supply it with additional files and package it:
    mkdir pkg
    mv OMImageWriter.app pkg/
    mkdir pkg/OMImageWriter.app/Contents/MacOS/lang
    cp ../doc/README.html ../doc/LICENSE.html pkg/
    cp ../lang/*.qm ~/Qt-static/5.6.1/translations/{qtbase_ru,qtbase_de,qtbase_fr}.qm pkg/OMImageWriter.app/Contents/MacOS/lang/
    hdiutil create -format UDBZ -volname 'OpenMandriva ImageWriter' -scrub -srcfolder pkg/ temp.dmg
    hdiutil convert temp.dmg -format UDBZ -o OMImageWriter-osx.dmg
    rm -f temp.dmg

    (Converting from UDBZ to UDBZ is not required but, though it looks strange, it might decrease the DMG image size by 4%.)
    Please, keep in mind that if new OMIW 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 qtbase_xx.qm file, otherwise get the main qt_xx.qm file.
  4. The file OMImageWriter-osx.dmg is ready for publishing.

Copyright © 2016 NTC IT ROSA LLC; 2024 OpenMandriva Association