Skip to content

Commit

Permalink
First attempt at creating distinct package for platform plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk committed Feb 20, 2023
1 parent 39d3895 commit 7fc2ebf
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 0 deletions.
25 changes: 25 additions & 0 deletions recipes/qt-gtk-platformtheme/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set -ex

# This creates a standalone shared library that mimics the results
# of configuring qt with the flag `-gtk`
#
# By creating this standalone package, we simplify the proces of
# rebuilding qt due to requiring fewer dependencies for the main package
# requiring fewer bumps when the version changes.
# The CMakeLists.txt file was inspired by the one from Fedora
# https://github.com/FedoraQt/QGnomePlatform
# and is likely to work for qt6
cp -R src/plugins/platformthemes/gtk3/ qgtk3
cd qgtk3
cp ${RECIPE_DIR}/gtk_theme_CMakeLists.txt CMakeLists.txt

mkdir -p build
cd build

cmake ${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_PREFIX_PATH=${PREFIX} \
..

make -j${CPU_COUNT}
make install
72 changes: 72 additions & 0 deletions recipes/qt-gtk-platformtheme/gtk_theme_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
project(QtGTKPlatformTheme)

cmake_minimum_required(VERSION 3.16)

option(USE_QT6 "Use Qt6 instead of Qt5" OFF)

if (USE_QT6)
set(QT_MIN_VERSION "6.2.0")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_VERSION_MAJOR "6")
else()
set(QT_MIN_VERSION "5.15.2")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT_VERSION_MAJOR "5")
endif()

find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
DBus
Gui
Widgets
ThemeSupport
)

if (NOT QT_PLUGINS_DIR)
if (NOT USE_QT6)
get_target_property(REAL_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE}
IMPORTED_LOCATION)
execute_process(COMMAND "${REAL_QMAKE_EXECUTABLE}" -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
set(QT_PLUGINS_DIR ${QT6_INSTALL_PLUGINS})
endif()
endif()

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK+3 REQUIRED IMPORTED_TARGET gtk+-3.0)


find_package(X11 REQUIRED)

set(gtk_theme_SRCS
main.cpp
qgtk3dialoghelpers.cpp
qgtk3dialoghelpers.h
qgtk3menu.cpp
qgtk3menu.h
qgtk3theme.cpp
qgtk3theme.h
)

add_library(qgtk3 MODULE ${gtk_theme_SRCS})
target_compile_definitions(qgtk3 PRIVATE -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6)

target_link_libraries(qgtk3
PkgConfig::GTK+3
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::CorePrivate
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::GuiPrivate
)

if (NOT USE_QT6)
target_link_libraries(qgtk3 Qt5::ThemeSupportPrivate)
endif()
set_property(TARGET qgtk3 PROPERTY AUTOMOC ON)

install(TARGETS qgtk3 DESTINATION ${QT_PLUGINS_DIR}/platformthemes)

107 changes: 107 additions & 0 deletions recipes/qt-gtk-platformtheme/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{% set version = "5.15.6" %}
# {% set version = "5.15.8" %}

package:
name: qt-gtk-platformtheme
version: {{ version }}

source:
# We only need to download the smaller qt-base, not qt-main for this plugin
url: https://download.qt.io/official_releases/qt/{{ version.rpartition('.')[0] }}/{{ version }}/submodules/qtbase-everywhere-opensource-src-{{ version }}.tar.xz
sha256: 396bc6b0d773ac6a7c691a4c3d901999f571e3e7033d7fd6f65e4ef2b6eb7340 # 5.15.6
# sha256: bfb11126c7f3abc3fdf86425ce912988b864a7e79a606d77325cffdbacb4be9c # 5.15.8

build:
number: 0
skip: true # [not linux]
detect_binary_files_with_prefix: true
run_exports:
- {{ pin_subpackage('qt-gtk-platformtheme', max_pin='x.x') }}

requirements:
build:
- cmake
- make # [unix]
- jom # [win]
- ninja
- perl
- {{ compiler('cxx') }}
- {{ compiler('c') }}
# This could just depend on qt-base later
# https://github.com/conda-forge/staged-recipes/pull/21505
# - qt-base {{ version }} # [build_platform != target_platform]
- qt-main {{ version }} # [build_platform != target_platform]
- sysroot_linux-64 2.17 # [linux]
- {{ cdt('xorg-x11-proto-devel') }} # [linux]
- {{ cdt('libx11-devel') }} # [linux]
- {{ cdt('libxext') }} # [linux]
- {{ cdt('libxext-devel') }} # [linux]
- {{ cdt('libxrender-devel') }} # [linux]
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libxau-devel') }} # [linux]
- {{ cdt('alsa-lib-devel') }} # [linux]
- {{ cdt('gtk2-devel') }} # [linux]
- {{ cdt('gtkmm24-devel') }} # [linux]
- {{ cdt('libdrm-devel') }} # [linux]
- {{ cdt('libxcomposite-devel') }} # [linux]
- {{ cdt('libxcursor-devel') }} # [linux]
- {{ cdt('libxi-devel') }} # [linux]
- {{ cdt('libxrandr-devel') }} # [linux]
- {{ cdt('pciutils-devel') }} # [linux]
- {{ cdt('libxscrnsaver-devel') }} # [linux]
- {{ cdt('libxtst-devel') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libselinux-devel') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxdamage-devel') }} # [linux]
- {{ cdt('libxfixes') }} # [linux]
- {{ cdt('libxfixes-devel') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- {{ cdt('libxxf86vm-devel') }} # [linux]
- {{ cdt('libsm-devel') }} # [linux]
- {{ cdt('libice-devel') }} # [linux]
- {{ cdt('libxcb') }} # [linux]
- {{ cdt('libxcb-devel') }} # [linux]
- {{ cdt('expat-devel') }} # [linux]
- {{ cdt('pcre') }} # [linux]
- {{ cdt('libglvnd-glx') }} # [linux]
- {{ cdt('libglvnd-egl') }} # [linux]
- {{ cdt('libxkbcommon-devel') }} # [linux]
- {{ cdt('xcb-util-devel') }} # [linux]
- {{ cdt('xcb-util-image-devel') }} # [linux]
- {{ cdt('xcb-util-keysyms-devel') }} # [linux]
- {{ cdt('xcb-util-renderutil-devel') }} # [linux]
- {{ cdt('xcb-util-wm-devel') }} # [linux]
host:
# - qt-base {{ version }}
- qt-main {{ version }}
- glib
- gtk3
- pango
- atk
- cairo
- gdk-pixbuf
- xorg-libxinerama
run:
# We want to be pinned to the exact qt version
# - qt-base {{ version }}
- qt-main {{ version }}

test:
commands:
- test -f "${PREFIX}/plugins/platformthemes/libqgtk3${SHLIB_EXT}"

about:
home: http://qt-project.org
license: LGPL-3.0-only
license_file: LICENSE.LGPLv3
summary: Qt GTK3 platform theme
dev_url: https://github.com/qt/qtbase/tree/5.15/src/plugins/platformthemes/gtk3


extra:
recipe-maintainers:
- conda-forge/qt-main

0 comments on commit 7fc2ebf

Please sign in to comment.