logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

wxwidgets.eclass (3106B)


  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: wxwidgets.eclass
  4. # @MAINTAINER:
  5. # wxwidgets@gentoo.org
  6. # @SUPPORTED_EAPIS: 7 8
  7. # @BLURB: Manages build configuration for wxGTK-using packages.
  8. # @DESCRIPTION:
  9. # This eclass sets up the proper environment for ebuilds using the wxGTK
  10. # libraries. Ebuilds using wxPython do not need to inherit this eclass.
  11. #
  12. # More specifically, this eclass controls the configuration chosen by the
  13. # ${ESYSROOT}/usr/bin/wx-config wrapper.
  14. #
  15. # Using the eclass is simple:
  16. #
  17. # - set WX_GTK_VER equal to a SLOT of wxGTK
  18. # - call setup-wxwidgets()
  19. #
  20. # The configuration chosen is based on the version required and the flags
  21. # wxGTK was built with.
  22. case ${EAPI} in
  23. 7|8) ;;
  24. *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
  25. esac
  26. if [[ -z ${_WXWIDGETS_ECLASS} ]]; then
  27. _WXWIDGETS_ECLASS=1
  28. # @ECLASS-VARIABLE: WX_GTK_VER
  29. # @PRE_INHERIT
  30. # @REQUIRED
  31. # @DESCRIPTION:
  32. # The SLOT of the x11-libs/wxGTK you're targeting. Needs to be defined before
  33. # inheriting the eclass. Can be either "3.0" or "3.0-gtk3".
  34. case ${WX_GTK_VER} in
  35. 3.0-gtk3) ;;
  36. 3.1) ;;
  37. 3.0)
  38. if [[ ${EAPI} != 7 ]]; then
  39. die "${ECLASS}: GTK 2 no longer supported in EAPI ${EAPI}"
  40. fi
  41. ;;
  42. "") die "WX_GTK_VER not declared" ;;
  43. *) die "Invalid WX_GTK_VER: must be set to a valid wxGTK SLOT ('3.0' or '3.0-gtk3')" ;;
  44. esac
  45. readonly WX_GTK_VER
  46. inherit flag-o-matic
  47. # @FUNCTION: setup-wxwidgets
  48. # @DESCRIPTION:
  49. # Call this in your ebuild to set up the environment for wxGTK in src_configure.
  50. # Besides controlling the wx-config wrapper, this exports WX_CONFIG containing
  51. # the path to the config in case it needs to be passed to the build system.
  52. #
  53. # This function also controls the level of debugging output from the libraries.
  54. # Debugging features are enabled by default and need to be disabled at the
  55. # package level. Because this causes many warning dialogs to pop up during
  56. # runtime, we add -DNDEBUG to CPPFLAGS to disable debugging features (unless
  57. # your ebuild has a debug USE flag and it's enabled). If you don't like this
  58. # behavior, you can set WX_DISABLE_NDEBUG to override it.
  59. #
  60. # See: https://docs.wxwidgets.org/trunk/overview_debugging.html
  61. setup-wxwidgets() {
  62. local w wxtoolkit wxconf
  63. case ${WX_GTK_VER} in
  64. 3.1) wxtoolkit=gtk3 ;;
  65. 3.0-gtk3) wxtoolkit=gtk3 ;;
  66. 3.0) wxtoolkit=gtk2
  67. eqawarn "This package relies on the deprecated GTK 2 slot, which will go away soon (https://bugs.gentoo.org/618642)"
  68. ;;
  69. esac
  70. if [[ -z ${WX_DISABLE_NDEBUG} ]]; then
  71. { in_iuse debug && use debug; } || append-cppflags -DNDEBUG
  72. fi
  73. wxconf="${wxtoolkit}-unicode-${WX_GTK_VER}"
  74. for w in "${CHOST:-${CBUILD}}-${wxconf}" "${wxconf}"; do
  75. [[ -f ${ESYSROOT}/usr/$(get_libdir)/wx/config/${w} ]] && wxconf=${w} && break
  76. done || die "Failed to find configuration ${wxconf}"
  77. export WX_CONFIG="${ESYSROOT}/usr/$(get_libdir)/wx/config/${wxconf}"
  78. export WX_ECLASS_CONFIG="${WX_CONFIG}"
  79. einfo
  80. einfo "Requested wxWidgets: ${WX_GTK_VER}"
  81. einfo "Using wxWidgets: ${wxconf}"
  82. einfo
  83. }
  84. fi