wxGTK-3.0.5.1-r1.ebuild 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. # Copyright 1999-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit multilib-minimal
  5. WXSUBVERSION="${PV}-gtk3" # 3.2.1-gtk3
  6. WXVERSION="$(ver_cut 1-3)" # 3.2.1
  7. # Make sure that this matches the number of components in ${PV}
  8. WXRELEASE="$(ver_cut 1-2)-gtk3" # 3.2-gtk3
  9. WXRELEASE_NODOT=${WXRELEASE//./} # 32-gtk3
  10. DESCRIPTION="GTK version of wxWidgets, a cross-platform C++ GUI toolkit"
  11. HOMEPAGE="https://wxwidgets.org/"
  12. SRC_URI="
  13. https://github.com/wxWidgets/wxWidgets/releases/download/v${PV}/wxWidgets-${PV}.tar.bz2
  14. https://dev.gentoo.org/~leio/distfiles/wxGTK-3.0.5_p20210214.tar.xz
  15. doc? ( https://github.com/wxWidgets/wxWidgets/releases/download/v${WXVERSION}/wxWidgets-${WXVERSION}-docs-html.tar.bz2 )"
  16. S="${WORKDIR}/wxWidgets-${PV}"
  17. LICENSE="wxWinLL-3 GPL-2 doc? ( wxWinFDL-3 )"
  18. SLOT="${WXRELEASE}"
  19. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
  20. IUSE="+gui curl doc debug gnome-keyring gstreamer libnotify +lzma opengl pch sdl +spell test tiff wayland webkit"
  21. REQUIRED_USE="test? ( tiff ) tiff? ( gui ) spell? ( gui ) gnome-keyring? ( gui )"
  22. RESTRICT="!test? ( test )"
  23. RDEPEND="
  24. >=app-eselect/eselect-wxwidgets-20131230
  25. dev-libs/expat[${MULTILIB_USEDEP}]
  26. dev-libs/libpcre2[pcre16,pcre32,unicode]
  27. sdl? ( media-libs/libsdl2[${MULTILIB_USEDEP}] )
  28. curl? ( net-misc/curl )
  29. lzma? ( app-arch/xz-utils )
  30. gui? (
  31. >=dev-libs/glib-2.22:2[${MULTILIB_USEDEP}]
  32. media-libs/libjpeg-turbo:=[${MULTILIB_USEDEP}]
  33. media-libs/libpng:0=[${MULTILIB_USEDEP}]
  34. sys-libs/zlib[${MULTILIB_USEDEP}]
  35. x11-libs/cairo[${MULTILIB_USEDEP}]
  36. x11-libs/gtk+:3[wayland?,${MULTILIB_USEDEP}]
  37. x11-libs/gdk-pixbuf:2[${MULTILIB_USEDEP}]
  38. media-libs/fontconfig
  39. x11-libs/pango[${MULTILIB_USEDEP}]
  40. gnome-keyring? ( app-crypt/libsecret )
  41. gstreamer? (
  42. media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
  43. media-libs/gst-plugins-base:1.0[${MULTILIB_USEDEP}]
  44. media-libs/gst-plugins-bad:1.0[${MULTILIB_USEDEP}]
  45. )
  46. libnotify? ( x11-libs/libnotify[${MULTILIB_USEDEP}] )
  47. opengl? (
  48. virtual/opengl[${MULTILIB_USEDEP}]
  49. )
  50. spell? ( app-text/gspell:= )
  51. tiff? ( media-libs/tiff:=[${MULTILIB_USEDEP}] )
  52. wayland? ( dev-libs/wayland )
  53. webkit? ( net-libs/webkit-gtk:4= )
  54. )"
  55. DEPEND="${RDEPEND}
  56. opengl? ( virtual/glu[${MULTILIB_USEDEP}] )"
  57. BDEPEND="
  58. test? ( >=dev-util/cppunit-1.8.0 )
  59. >=app-eselect/eselect-wxwidgets-20131230
  60. virtual/pkgconfig"
  61. # Note about the gst-plugin-base dep: The build system queries for it,
  62. # but doesn't link it for some reason? Either way - probably best to
  63. # depend on it anyway.
  64. # Note about the wayland dep: Appears to be only required for the OpenGL
  65. # canvas, and it seems impossible to disable the X dependency, unless
  66. # I'm missing something. This is an automagic header dep, though.
  67. PATCHES=(
  68. "${WORKDIR}"/wxGTK-3.0.5_p20210214/
  69. "${FILESDIR}"/${PN}-${SLOT}-translation-domain.patch
  70. "${FILESDIR}"/${PN}-ignore-c++-abi.patch #676878
  71. "${FILESDIR}"/${PN}-configure-tests.patch
  72. "${FILESDIR}"/${PN}-3.0.5.1-configure-modern-c.patch
  73. #"${FILESDIR}"/${PN}-3.2.1-wayland-control.patch
  74. #"${FILESDIR}"/${PN}-3.2.1-prefer-lib64-in-tests.patch
  75. #"${FILESDIR}"/${PN}-3.2.2.1-dont-break-flags.patch
  76. )
  77. src_prepare() {
  78. default
  79. # find . -iname Makefile.in -not -path ./samples'/*' \
  80. # | xargs grep -l WX_RELEASE
  81. local versioned_makefiles=(
  82. ./tests/benchmarks/Makefile.in
  83. ./tests/Makefile.in
  84. ./utils/emulator/src/Makefile.in
  85. ./utils/execmon/Makefile.in
  86. ./utils/wxrc/Makefile.in
  87. ./utils/helpview/src/Makefile.in
  88. ./utils/hhp2cached/Makefile.in
  89. ./utils/screenshotgen/src/Makefile.in
  90. ./utils/ifacecheck/src/Makefile.in
  91. ./Makefile.in
  92. ./demos/life/Makefile.in
  93. ./demos/bombs/Makefile.in
  94. ./demos/fractal/Makefile.in
  95. ./demos/forty/Makefile.in
  96. ./demos/poem/Makefile.in
  97. )
  98. # Versionating
  99. sed -i \
  100. -e "s:\(WX_RELEASE = \).*:\1${WXRELEASE}:"\
  101. -e "s:\(WX_RELEASE_NODOT = \).*:\1${WXRELEASE_NODOT}:"\
  102. -e "s:\(WX_VERSION = \).*:\1${WXVERSION}:"\
  103. -e "s:aclocal):aclocal/wxwin${WXRELEASE_NODOT}.m4):" \
  104. -e "s:wxstd.mo:wxstd${WXRELEASE_NODOT}.mo:" \
  105. -e "s:wxmsw.mo:wxmsw${WXRELEASE_NODOT}.mo:" \
  106. "${versioned_makefiles[@]}" || die
  107. sed -i \
  108. -e "s:\(WX_VERSION=\).*:\1${WXVERSION}:" \
  109. -e "s:\(WX_RELEASE=\).*:\1${WXRELEASE}:" \
  110. -e "s:\(WX_SUBVERSION=\).*:\1${WXSUBVERSION}:" \
  111. -e '/WX_VERSION_TAG=/ s:${WX_RELEASE}:3.0:' \
  112. configure || die
  113. }
  114. multilib_src_configure() {
  115. # X independent options
  116. local myeconfargs=(
  117. --with-zlib=sys
  118. --with-expat=sys
  119. --enable-compat28
  120. --enable-xrc
  121. $(use_with sdl)
  122. $(use_with lzma liblzma)
  123. # Currently defaults to curl, could change. Watch the VDB!
  124. $(use_enable curl webrequest)
  125. # PCHes are unstable and are disabled in-tree where possible
  126. # See bug #504204
  127. # Commits 8c4774042b7fdfb08e525d8af4b7912f26a2fdce, fb809aeadee57ffa24591e60cfb41aecd4823090
  128. $(use_enable pch precomp-headers)
  129. # Don't hard-code libdir's prefix for wx-config
  130. --libdir='${prefix}'/$(get_libdir)
  131. )
  132. # debug in >=2.9
  133. # there is no longer separate debug libraries (gtk2ud)
  134. # wxDEBUG_LEVEL=1 is the default and we will leave it enabled
  135. # wxDEBUG_LEVEL=2 enables assertions that have expensive runtime costs.
  136. # apps can disable these features by building w/ -NDEBUG or wxDEBUG_LEVEL_0.
  137. # http://docs.wxwidgets.org/3.0/overview_debugging.html
  138. # https://groups.google.com/group/wx-dev/browse_thread/thread/c3c7e78d63d7777f/05dee25410052d9c
  139. use debug && myeconfargs+=( --enable-debug=max )
  140. # wxGTK options
  141. # --enable-graphics_ctx - needed for webkit, editra
  142. # --without-gnomevfs - bug #203389
  143. use gui && myeconfargs+=(
  144. --enable-graphics_ctx
  145. --with-gtkprint
  146. --enable-gui
  147. --with-gtk=3
  148. --with-libpng=sys
  149. --with-libjpeg=sys
  150. # Choosing to enable this unconditionally seems fair, pcre2 is
  151. # almost certain to be installed.
  152. --with-regex=sys
  153. --without-gnomevfs
  154. $(use_enable gstreamer mediactrl)
  155. $(multilib_native_use_enable webkit webview)
  156. $(use_with libnotify)
  157. $(use_with opengl)
  158. $(use_with tiff libtiff sys)
  159. $(use_enable gnome-keyring secretstore)
  160. $(use_enable spell spellcheck)
  161. $(use_enable test tests)
  162. $(use_enable wayland)
  163. )
  164. # wxBase options
  165. ! use gui && myeconfargs+=( --disable-gui )
  166. ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
  167. }
  168. multilib_src_test() {
  169. emake -C tests
  170. (cd tests && ./test '~[.]~[net]') || die
  171. }
  172. multilib_src_install_all() {
  173. cd docs || die
  174. dodoc changes.txt readme.txt
  175. newdoc base/readme.txt base_readme.txt
  176. newdoc gtk/readme.txt gtk_readme.txt
  177. use doc && HTML_DOCS=( "${WORKDIR}"/wxWidgets-${PV}-docs-html/. )
  178. einstalldocs
  179. # Unversioned links
  180. rm "${ED}"/usr/bin/wx-config || die
  181. use gui && { rm "${ED}"/usr/bin/wxrc || die; }
  182. # version bakefile presets
  183. pushd "${ED}"/usr/share/bakefile/presets >/dev/null || die
  184. local f
  185. for f in wx*; do
  186. mv "${f}" "${f/wx/wx30gtk3}" || die
  187. done
  188. popd >/dev/null || die
  189. }
  190. pkg_postinst() {
  191. has_version -b app-eselect/eselect-wxwidgets \
  192. && eselect wxwidgets update
  193. }
  194. pkg_postrm() {
  195. has_version -b app-eselect/eselect-wxwidgets \
  196. && eselect wxwidgets update
  197. }