From 273189b4212561bab7498fb55755dcd1ecfe9f12 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 12 Sep 2022 08:51:06 +0000
Subject: [PATCH] testing/maitreya: port to wxwidgets-3.2

---
 testing/maitreya/APKBUILD            |  14 ++--
 testing/maitreya/wxwidgets-3.2.patch | 108 +++++++++++++++++++++++++++
 2 files changed, 117 insertions(+), 5 deletions(-)
 create mode 100644 testing/maitreya/wxwidgets-3.2.patch

diff --git a/testing/maitreya/APKBUILD b/testing/maitreya/APKBUILD
index 07a2fca67bb1..7e0e57b71b84 100644
--- a/testing/maitreya/APKBUILD
+++ b/testing/maitreya/APKBUILD
@@ -4,23 +4,26 @@ pkgname=maitreya
 pkgver=8.0.1
 _majorver=${pkgver%%.*}
 _pkgname="$pkgname$_majorver"
-pkgrel=0
+pkgrel=1
 pkgdesc="Software for Vedic and western astrology"
 url="https://www.saravali.de/maitreya.html"
 arch="all"
 # Saravali.ttf is licensed under OFL-1.1-RFN
 # geonames1000.sql is licensed under CC-BY-4.0
 license="GPL-2.0-or-later AND OFL-1.1-RFN AND CC-BY-4.0"
-makedepends="wxgtk3-dev"
+makedepends="wxwidgets-dev"
 options="!check"
 subpackages="$pkgname-lang"
-source="https://github.com/martin-pe/maitreya8/releases/download/v$pkgver/$_pkgname-$pkgver.tar.bz2"
+source="https://github.com/martin-pe/maitreya8/releases/download/v$pkgver/$_pkgname-$pkgver.tar.bz2
+	wxwidgets-3.2.patch
+	"
 builddir="$srcdir/$_pkgname-$pkgver"
 
 build() {
 	./configure \
-		--prefix=/usr \
-		--with-wx-config=wx-config-gtk3
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr
 	make
 }
 
@@ -30,4 +33,5 @@ package() {
 
 sha512sums="
 53fe5c7c5d83bc39884e09717189ac9548e6817c489d3dfd26edadda04af059fd5628ec263e61fc3541cde93d9ee1816969adaa3815baa8289776b4d0ac4742a  maitreya8-8.0.1.tar.bz2
+80516b8d37ae5051651e5541248920cfefa034696a45ad28d0a477feb7d39ee8d6bd61943a5850b8bee1506fdae93c45e2bf4afeb9ca6f0bcb9677b9824f5923  wxwidgets-3.2.patch
 "
diff --git a/testing/maitreya/wxwidgets-3.2.patch b/testing/maitreya/wxwidgets-3.2.patch
new file mode 100644
index 000000000000..eb32c73f30bf
--- /dev/null
+++ b/testing/maitreya/wxwidgets-3.2.patch
@@ -0,0 +1,108 @@
+diff --git a/src/base/Lang.cpp b/src/base/Lang.cpp
+index c3472c4..0527961 100644
+--- a/src/base/Lang.cpp
++++ b/src/base/Lang.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <wx/log.h>
+ #include <wx/string.h>
++#include <wx/wxcrtvararg.h>
+ 
+ #include "Calculator.h"
+ #include "Conf.h"
+diff --git a/src/gui/ToolPanel.cpp b/src/gui/ToolPanel.cpp
+index 226ad94..d98eb6f 100644
+--- a/src/gui/ToolPanel.cpp
++++ b/src/gui/ToolPanel.cpp
+@@ -392,7 +392,7 @@ void ToolbarFactory::createChoiceItem( wxToolBar *toolbar, const int &item )
+ 		label = _( "Sources" );
+ 		break;
+ 	case TBS_YOGAFIRSTHOUSE:
+-		control = new wxChoice( toolbar, item, wxDefaultPosition, wxSize( 120, -1 ), 15, first_house_choices, wxADJUST_MINSIZE );
++		control = new wxChoice( toolbar, item, wxDefaultPosition, wxSize( 120, -1 ), 15, first_house_choices, 0 );
+ 		label = _( "Ascendant" );
+ 		break;
+ 	case TBS_ANTARDASALEVEL:
+diff --git a/src/gui/TreeWidget.cpp b/src/gui/TreeWidget.cpp
+index b90fed1..ecb8464 100644
+--- a/src/gui/TreeWidget.cpp
++++ b/src/gui/TreeWidget.cpp
+@@ -333,28 +333,28 @@ public:
+ 
+ 	// attributes
+ 	// get them - may be NULL
+-	wxTreeItemAttr *GetAttributes() const {
++	wxTextAttr *GetAttributes() const {
+ 		return m_attr;
+ 	}
+ 	// get them ensuring that the pointer is not NULL
+-	wxTreeItemAttr& Attr()
++	wxTextAttr& Attr()
+ 	{
+ 		if ( !m_attr )
+ 		{
+-			m_attr = new wxTreeItemAttr;
++			m_attr = new wxTextAttr;
+ 			m_ownsAttr = TRUE;
+ 		}
+ 		return *m_attr;
+ 	}
+ 	// set them
+-	void SetAttributes(wxTreeItemAttr *attr)
++	void SetAttributes(wxTextAttr *attr)
+ 	{
+ 		if ( m_ownsAttr ) delete m_attr;
+ 		m_attr = attr;
+ 		m_ownsAttr = FALSE;
+ 	}
+ 	// set them and delete when done
+-	void AssignAttributes(wxTreeItemAttr *attr)
++	void AssignAttributes(wxTextAttr *attr)
+ 	{
+ 		SetAttributes(attr);
+ 		m_ownsAttr = TRUE;
+@@ -371,7 +371,7 @@ private:
+ 	MyArrayGenericTreeItems m_children; // list of children
+ 	MyGenericTreeItem  *m_parent;       // parent of this item
+ 
+-	wxTreeItemAttr     *m_attr;         // attributes???
++	wxTextAttr     *m_attr;         // attributes???
+ 
+ 	// tree ctrl images for the normal, selected, expanded and
+ 	// expanded+selected states
+@@ -610,7 +610,7 @@ MyGenericTreeItem::MyGenericTreeItem(MyGenericTreeItem *parent,
+ 
+ 	m_parent = parent;
+ 
+-	m_attr = (wxTreeItemAttr *)NULL;
++	m_attr = (wxTextAttr *)NULL;
+ 	m_ownsAttr = FALSE;
+ 
+ 	// We don't know the height here yet.
+@@ -2200,7 +2200,7 @@ void MyGenericTreeCtrl::PaintItem(MyGenericTreeItem *item, wxDC& dc)
+ 	// TODO implement "state" icon on items
+ 	if ( item->IsHidden() ) return;
+ 
+-	wxTreeItemAttr *attr = item->GetAttributes();
++	wxTextAttr *attr = item->GetAttributes();
+ 	if ( attr && attr->HasFont() )
+ 		dc.SetFont(attr->GetFont());
+ 	else if (item->IsBold())
+@@ -2364,7 +2364,7 @@ void MyGenericTreeCtrl::PaintLevel( MyGenericTreeItem *item, wxDC &dc, int level
+ 		}
+ 		else
+ 		{
+-			wxTreeItemAttr *attr = item->GetAttributes();
++			wxTextAttr *attr = item->GetAttributes();
+ 			if (attr && attr->HasTextColour())
+ 				colText = attr->GetTextColour();
+ 			else
+@@ -3224,7 +3224,7 @@ void MyGenericTreeCtrl::CalculateSize( MyGenericTreeItem *item, wxDC &dc )
+ 	wxCoord text_w = 0;
+ 	wxCoord text_h = 0;
+ 
+-	wxTreeItemAttr *attr = item->GetAttributes();
++	wxTextAttr *attr = item->GetAttributes();
+ 	if ( attr && attr->HasFont() )
+ 		dc.SetFont(attr->GetFont());
+ 	else if ( item->IsBold() )
-- 
GitLab