qt4-r2.eclass 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: qt4-r2.eclass
  4. # @MAINTAINER:
  5. # qt@gentoo.org
  6. # @BLURB: Eclass for Qt4-based packages, second edition.
  7. # @DESCRIPTION:
  8. # This eclass contains various functions that may be useful when
  9. # dealing with packages using Qt4 libraries. Supports only EAPIs
  10. # 2, 3, 4, and 5. Use qmake-utils.eclass in EAPI 6 and later.
  11. case ${EAPI} in
  12. 2|3|4|5) : ;;
  13. 6) die "qt4-r2.eclass is banned in EAPI 6 and later" ;;
  14. *) die "qt4-r2.eclass: unsupported EAPI=${EAPI:-0}" ;;
  15. esac
  16. inherit base eutils qmake-utils
  17. export XDG_CONFIG_HOME="${T}"
  18. # @ECLASS-VARIABLE: DOCS
  19. # @DEFAULT_UNSET
  20. # @DESCRIPTION:
  21. # Array containing documents passed to dodoc command.
  22. # Paths can be absolute or relative to ${S}.
  23. #
  24. # Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
  25. # @ECLASS-VARIABLE: HTML_DOCS
  26. # @DEFAULT_UNSET
  27. # @DESCRIPTION:
  28. # Array containing documents passed to dohtml command.
  29. # Paths can be absolute or relative to ${S}.
  30. #
  31. # Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/" )
  32. # @ECLASS-VARIABLE: LANGS
  33. # @DEFAULT_UNSET
  34. # @DESCRIPTION:
  35. # In case your Qt4 application provides various translations, use this variable
  36. # to specify them in order to populate "linguas_*" IUSE automatically. Make sure
  37. # that you set this variable before inheriting qt4-r2 eclass.
  38. #
  39. # Example: LANGS="de el it ja"
  40. for x in ${LANGS}; do
  41. IUSE+=" linguas_${x}"
  42. done
  43. # @ECLASS-VARIABLE: LANGSLONG
  44. # @DEFAULT_UNSET
  45. # @DESCRIPTION:
  46. # Same as LANGS, but this variable is for LINGUAS that must be in long format.
  47. # Remember to set this variable before inheriting qt4-r2 eclass.
  48. # Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
  49. #
  50. # Example: LANGSLONG="en_GB ru_RU"
  51. for x in ${LANGSLONG}; do
  52. IUSE+=" linguas_${x%_*}"
  53. done
  54. unset x
  55. # @ECLASS-VARIABLE: PATCHES
  56. # @DEFAULT_UNSET
  57. # @DESCRIPTION:
  58. # Array variable containing all the patches to be applied. This variable
  59. # is expected to be defined in the global scope of ebuilds. Make sure to
  60. # specify the full path. This variable is used in src_prepare phase.
  61. #
  62. # Example:
  63. # @CODE
  64. # PATCHES=(
  65. # "${FILESDIR}/mypatch.patch"
  66. # "${FILESDIR}/mypatch2.patch"
  67. # )
  68. # @CODE
  69. # @FUNCTION: qt4-r2_src_unpack
  70. # @DESCRIPTION:
  71. # Default src_unpack function for packages that depend on qt4. If you have to
  72. # override src_unpack in your ebuild (probably you don't need to), call
  73. # qt4-r2_src_unpack in it.
  74. qt4-r2_src_unpack() {
  75. debug-print-function $FUNCNAME "$@"
  76. base_src_unpack "$@"
  77. }
  78. # @FUNCTION: qt4-r2_src_prepare
  79. # @DESCRIPTION:
  80. # Default src_prepare function for packages that depend on qt4. If you have to
  81. # override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
  82. # otherwise autopatcher will not work!
  83. qt4-r2_src_prepare() {
  84. debug-print-function $FUNCNAME "$@"
  85. base_src_prepare "$@"
  86. }
  87. # @FUNCTION: qt4-r2_src_configure
  88. # @DESCRIPTION:
  89. # Default src_configure function for packages that depend on qt4. If you have to
  90. # override src_configure in your ebuild, call qt4-r2_src_configure in it.
  91. qt4-r2_src_configure() {
  92. debug-print-function $FUNCNAME "$@"
  93. local project_file=$(qmake-utils_find_pro_file)
  94. if [[ -n ${project_file} ]]; then
  95. eqmake4 "${project_file}"
  96. else
  97. base_src_configure "$@"
  98. fi
  99. }
  100. # @FUNCTION: qt4-r2_src_compile
  101. # @DESCRIPTION:
  102. # Default src_compile function for packages that depend on qt4. If you have to
  103. # override src_compile in your ebuild (probably you don't need to), call
  104. # qt4-r2_src_compile in it.
  105. qt4-r2_src_compile() {
  106. debug-print-function $FUNCNAME "$@"
  107. base_src_compile "$@"
  108. }
  109. # @FUNCTION: qt4-r2_src_install
  110. # @DESCRIPTION:
  111. # Default src_install function for qt4-based packages. Installs compiled code,
  112. # and documentation (via DOCS and HTML_DOCS variables).
  113. qt4-r2_src_install() {
  114. debug-print-function $FUNCNAME "$@"
  115. base_src_install INSTALL_ROOT="${D}" "$@"
  116. einstalldocs
  117. }
  118. EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install