qt.mk raw

   1  package=qt
   2  $(package)_version=5.15.18
   3  $(package)_download_path=https://download.qt.io/archive/qt/5.15/$($(package)_version)/submodules
   4  $(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz
   5  $(package)_file_name=qtbase-$($(package)_suffix)
   6  $(package)_sha256_hash=7b632550ea1048fc10c741e46e2e3b093e5ca94dfa6209e9e0848800e247023b
   7  $(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
   8  $(package)_qt_libs=corelib network widgets gui plugins testlib
   9  $(package)_linguist_tools = lrelease lupdate lconvert
  10  $(package)_patches = qt.pro
  11  $(package)_patches += qttools_src.pro
  12  $(package)_patches += mac-qmake.conf
  13  $(package)_patches += no-xlib.patch
  14  $(package)_patches += dont_hardcode_pwd.patch
  15  $(package)_patches += qdir_temppath.patch
  16  $(package)_patches += qtbase-moc-ignore-gcc-macro.patch
  17  $(package)_patches += no_warnings_for_symbols.patch
  18  $(package)_patches += rcc_hardcode_timestamp.patch
  19  $(package)_patches += duplicate_lcqpafonts.patch
  20  $(package)_patches += guix_cross_lib_path.patch
  21  $(package)_patches += memory_resource.patch
  22  $(package)_patches += clang_18_libpng.patch
  23  $(package)_patches += utc_from_string_no_optimize.patch
  24  $(package)_patches += windows_lto.patch
  25  $(package)_patches += darwin_no_libm.patch
  26  
  27  $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
  28  $(package)_qttranslations_sha256_hash=e5625757913caf66a9d702ba102ae92cb165d8dde17759b6de9fdea84a1f857f
  29  
  30  $(package)_qttools_file_name=qttools-$($(package)_suffix)
  31  $(package)_qttools_sha256_hash=931e0969d9f9d8f233e5e9bf9db0cea9ce9914d49982f1795fe6191010113568
  32  
  33  $(package)_extra_sources  = $($(package)_qttranslations_file_name)
  34  $(package)_extra_sources += $($(package)_qttools_file_name)
  35  
  36  define $(package)_set_vars
  37  $(package)_config_env = QT_MAC_SDK_NO_VERSION_CHECK=1
  38  $(package)_config_opts_release = -release
  39  $(package)_config_opts_release += -silent
  40  $(package)_config_opts_debug = -debug
  41  $(package)_config_opts_debug += -optimized-tools
  42  $(package)_config_opts += -bindir $(build_prefix)/bin
  43  $(package)_config_opts += -c++std c++2a
  44  $(package)_config_opts += -confirm-license
  45  $(package)_config_opts += -hostprefix $(build_prefix)
  46  $(package)_config_opts += -no-compile-examples
  47  $(package)_config_opts += -no-cups
  48  $(package)_config_opts += -no-egl
  49  $(package)_config_opts += -no-eglfs
  50  $(package)_config_opts += -no-evdev
  51  $(package)_config_opts += -no-gif
  52  $(package)_config_opts += -no-glib
  53  $(package)_config_opts += -no-icu
  54  $(package)_config_opts += -no-ico
  55  $(package)_config_opts += -no-iconv
  56  $(package)_config_opts += -no-kms
  57  $(package)_config_opts += -no-linuxfb
  58  $(package)_config_opts += -no-libjpeg
  59  $(package)_config_opts += -no-libproxy
  60  $(package)_config_opts += -no-libudev
  61  $(package)_config_opts += -no-mimetype-database
  62  $(package)_config_opts += -no-mtdev
  63  $(package)_config_opts += -no-openssl
  64  $(package)_config_opts += -no-openvg
  65  $(package)_config_opts += -no-pkg-config
  66  $(package)_config_opts += -no-reduce-relocations
  67  $(package)_config_opts += -no-schannel
  68  $(package)_config_opts += -no-sctp
  69  $(package)_config_opts += -no-securetransport
  70  $(package)_config_opts += -no-sql-db2
  71  $(package)_config_opts += -no-sql-ibase
  72  $(package)_config_opts += -no-sql-oci
  73  $(package)_config_opts += -no-sql-tds
  74  $(package)_config_opts += -no-sql-mysql
  75  $(package)_config_opts += -no-sql-odbc
  76  $(package)_config_opts += -no-sql-psql
  77  $(package)_config_opts += -no-sql-sqlite
  78  $(package)_config_opts += -no-sql-sqlite2
  79  $(package)_config_opts += -no-system-proxies
  80  $(package)_config_opts += -no-use-gold-linker
  81  $(package)_config_opts += -no-zstd
  82  $(package)_config_opts += -nomake examples
  83  $(package)_config_opts += -nomake tests
  84  $(package)_config_opts += -nomake tools
  85  $(package)_config_opts += -opensource
  86  $(package)_config_opts += -prefix $(host_prefix)
  87  $(package)_config_opts += -qt-libpng
  88  $(package)_config_opts += -qt-pcre
  89  $(package)_config_opts += -qt-harfbuzz
  90  $(package)_config_opts += -qt-zlib
  91  $(package)_config_opts += -static
  92  $(package)_config_opts += -v
  93  $(package)_config_opts += -no-feature-bearermanagement
  94  $(package)_config_opts += -no-feature-colordialog
  95  $(package)_config_opts += -no-feature-commandlineparser
  96  $(package)_config_opts += -no-feature-concurrent
  97  $(package)_config_opts += -no-feature-dial
  98  $(package)_config_opts += -no-feature-fontcombobox
  99  $(package)_config_opts += -no-feature-ftp
 100  $(package)_config_opts += -no-feature-http
 101  $(package)_config_opts += -no-feature-image_heuristic_mask
 102  $(package)_config_opts += -no-feature-keysequenceedit
 103  $(package)_config_opts += -no-feature-lcdnumber
 104  $(package)_config_opts += -no-feature-networkdiskcache
 105  $(package)_config_opts += -no-feature-networkproxy
 106  $(package)_config_opts += -no-feature-pdf
 107  $(package)_config_opts += -no-feature-printdialog
 108  $(package)_config_opts += -no-feature-printer
 109  $(package)_config_opts += -no-feature-printpreviewdialog
 110  $(package)_config_opts += -no-feature-printpreviewwidget
 111  $(package)_config_opts += -no-feature-sessionmanager
 112  $(package)_config_opts += -no-feature-socks5
 113  $(package)_config_opts += -no-feature-sql
 114  $(package)_config_opts += -no-feature-sqlmodel
 115  $(package)_config_opts += -no-feature-statemachine
 116  $(package)_config_opts += -no-feature-syntaxhighlighter
 117  $(package)_config_opts += -no-feature-textbrowser
 118  $(package)_config_opts += -no-feature-textmarkdownwriter
 119  $(package)_config_opts += -no-feature-textodfwriter
 120  $(package)_config_opts += -no-feature-topleveldomain
 121  $(package)_config_opts += -no-feature-udpsocket
 122  $(package)_config_opts += -no-feature-undocommand
 123  $(package)_config_opts += -no-feature-undogroup
 124  $(package)_config_opts += -no-feature-undostack
 125  $(package)_config_opts += -no-feature-undoview
 126  $(package)_config_opts += -no-feature-vnc
 127  $(package)_config_opts += -no-feature-wizard
 128  $(package)_config_opts += -no-feature-xml
 129  
 130  $(package)_config_opts_darwin = -no-dbus
 131  $(package)_config_opts_darwin += -no-opengl
 132  $(package)_config_opts_darwin += -pch
 133  $(package)_config_opts_darwin += -no-feature-corewlan
 134  $(package)_config_opts_darwin += -no-freetype
 135  $(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION)
 136  
 137  ifneq ($(build_os),darwin)
 138  $(package)_config_opts_darwin += -xplatform macx-clang-linux
 139  $(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(OSX_SDK)
 140  $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSION)
 141  $(package)_config_opts_darwin += -device-option CROSS_COMPILE="llvm-"
 142  $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
 143  $(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION)
 144  endif
 145  
 146  ifneq ($(build_arch),$(host_arch))
 147  $(package)_config_opts_aarch64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64
 148  $(package)_config_opts_x86_64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64
 149  endif
 150  
 151  $(package)_config_opts_linux = -xcb
 152  $(package)_config_opts_linux += -no-xcb-xlib
 153  $(package)_config_opts_linux += -no-feature-xlib
 154  $(package)_config_opts_linux += -system-freetype
 155  $(package)_config_opts_linux += -fontconfig
 156  $(package)_config_opts_linux += -no-opengl
 157  $(package)_config_opts_linux += -no-feature-vulkan
 158  $(package)_config_opts_linux += -dbus-runtime
 159  ifneq ($(LTO),)
 160  $(package)_config_opts_linux += -ltcg
 161  endif
 162  
 163  ifneq (,$(findstring clang,$($(package)_cxx)))
 164    ifneq (,$(findstring -stdlib=libc++,$($(package)_cxx)))
 165      $(package)_config_opts_linux += -platform linux-clang-libc++ -xplatform linux-clang-libc++
 166    else
 167      $(package)_config_opts_linux += -platform linux-clang -xplatform linux-clang
 168    endif
 169  else
 170    $(package)_config_opts_linux += -platform linux-g++ -xplatform limenka-linux-g++
 171  endif
 172  
 173  $(package)_config_opts_mingw32 = -no-opengl
 174  $(package)_config_opts_mingw32 += -no-dbus
 175  $(package)_config_opts_mingw32 += -no-freetype
 176  $(package)_config_opts_mingw32 += -xplatform win32-g++
 177  $(package)_config_opts_mingw32 += "QMAKE_CFLAGS = '$($(package)_cflags) $($(package)_cppflags)'"
 178  $(package)_config_opts_mingw32 += "QMAKE_CXX = '$($(package)_cxx)'"
 179  $(package)_config_opts_mingw32 += "QMAKE_CXXFLAGS = '$($(package)_cxxflags) $($(package)_cppflags)'"
 180  $(package)_config_opts_mingw32 += "QMAKE_LINK = '$($(package)_cxx)'"
 181  $(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'"
 182  $(package)_config_opts_mingw32 += "QMAKE_LIB = '$($(package)_ar) rc'"
 183  $(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-"
 184  $(package)_config_opts_mingw32 += -pch
 185  ifneq ($(LTO),)
 186  $(package)_config_opts_mingw32 += -ltcg
 187  endif
 188  endef
 189  
 190  define $(package)_fetch_cmds
 191  $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
 192  $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \
 193  $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash))
 194  endef
 195  
 196  define $(package)_extract_cmds
 197    mkdir -p $($(package)_extract_dir) && \
 198    echo "$($(package)_sha256_hash)  $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
 199    echo "$($(package)_qttranslations_sha256_hash)  $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
 200    echo "$($(package)_qttools_sha256_hash)  $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
 201    $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
 202    mkdir qtbase && \
 203    $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
 204    mkdir qttranslations && \
 205    $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
 206    mkdir qttools && \
 207    $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
 208  endef
 209  
 210  # Preprocessing steps work as follows:
 211  #
 212  # 1. Apply our patches to the extracted source. See each patch for more info.
 213  #
 214  # 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
 215  #
 216  # 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named
 217  #    limenka-linux-g++, replace tool names with $($($(package)_type)_TOOL).
 218  #
 219  # 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
 220  #
 221  # 5. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
 222  define $(package)_preprocess_cmds
 223    cp $($(package)_patch_dir)/qt.pro qt.pro && \
 224    cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
 225    patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
 226    patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
 227    patch -p1 -i $($(package)_patch_dir)/qdir_temppath.patch && \
 228    patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
 229    patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
 230    patch -p1 -i $($(package)_patch_dir)/no_warnings_for_symbols.patch && \
 231    patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
 232    patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
 233    patch -p1 -i $($(package)_patch_dir)/utc_from_string_no_optimize.patch && \
 234    patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
 235    patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
 236    patch -p1 -i $($(package)_patch_dir)/darwin_no_libm.patch && \
 237    mkdir -p qtbase/mkspecs/macx-clang-linux &&\
 238    cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
 239    cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
 240    cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/limenka-linux-g++ && \
 241    sed -i.old "s|arm-linux-gnueabi-gcc|$($($(package)_type)_CC)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 242    sed -i.old "s|arm-linux-gnueabi-g++|$($($(package)_type)_CXX)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 243    sed -i.old "s|arm-linux-gnueabi-ar|$($($(package)_type)_AR)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 244    sed -i.old "s|arm-linux-gnueabi-objcopy|$($($(package)_type)_OBJCOPY)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 245    sed -i.old "s|arm-linux-gnueabi-nm|$($($(package)_type)_NM)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 246    sed -i.old "s|arm-linux-gnueabi-strip|$($($(package)_type)_STRIP)|" qtbase/mkspecs/limenka-linux-g++/qmake.conf && \
 247    echo "!host_build: QMAKE_CFLAGS     += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
 248    echo "!host_build: QMAKE_CXXFLAGS   += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
 249    echo "!host_build: QMAKE_LFLAGS     += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
 250    sed -i.old "s|QMAKE_CC                = \$$$$\$$$${CROSS_COMPILE}clang|QMAKE_CC                = $($(package)_cc)|" qtbase/mkspecs/common/clang.conf && \
 251    sed -i.old "s|QMAKE_CXX               = \$$$$\$$$${CROSS_COMPILE}clang++|QMAKE_CXX               = $($(package)_cxx)|" qtbase/mkspecs/common/clang.conf
 252  endef
 253  
 254  define $(package)_config_cmds
 255    cd qtbase && \
 256    ./configure -top-level $($(package)_config_opts)
 257  endef
 258  
 259  define $(package)_build_cmds
 260    $(MAKE)
 261  endef
 262  
 263  # TODO: Investigate whether specific targets can be used here to minimize the amount of files/components installed.
 264  define $(package)_stage_cmds
 265    $(MAKE) -C qtbase INSTALL_ROOT=$($(package)_staging_dir) install && \
 266    $(MAKE) -C qttools INSTALL_ROOT=$($(package)_staging_dir) install && \
 267    $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
 268  endef
 269  
 270  define $(package)_postprocess_cmds
 271    rm -rf doc/ native/lib/ lib/pkgconfig/ && \
 272    rm -f lib/lib*.la lib/Qt5*.la
 273  endef
 274