wok-current rev 21350
amule: add debian libupnp1.8.patch
author | Richard Dunbar <mojo@slitaz.org> |
---|---|
date | Sat Apr 20 15:44:26 2019 -0400 (2019-04-20) |
parents | b9fbde67970f |
children | f30d063d7a89 |
files | amule/receipt amule/stuff/libupnp1.8.patch |
line diff
1.1 --- a/amule/receipt Sat Apr 20 17:16:39 2019 +0100 1.2 +++ b/amule/receipt Sat Apr 20 15:44:26 2019 -0400 1.3 @@ -19,6 +19,8 @@ 1.4 # Rules to configure and make the package. 1.5 compile_rules() 1.6 { 1.7 + patch -p1 < $stuff/libupnp1.8.patch || exit 1 1.8 + 1.9 # What works for imule (see https://aur.archlinux.org/packages/imule) 1.10 # might work for amule also: 1.11 sed -i 's/pubkey.DEREncode(asink);/pubkey.AccessMaterial().Save(asink);/g' \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/amule/stuff/libupnp1.8.patch Sat Apr 20 15:44:26 2019 -0400 2.3 @@ -0,0 +1,241 @@ 2.4 +--- a/src/UPnPBase.cpp 2.5 ++++ b/src/UPnPBase.cpp 2.6 +@@ -29,22 +29,12 @@ 2.7 + 2.8 + #ifdef ENABLE_UPNP 2.9 + 2.10 +-// check for broken Debian-hacked libUPnP 2.11 + #include <upnp.h> 2.12 +-#ifdef STRING_H // defined in UpnpString.h Yes, I would have liked UPNPSTRING_H much better. 2.13 +-#define BROKEN_DEBIAN_LIBUPNP 2.14 +-#endif 2.15 + 2.16 + #include "UPnPBase.h" 2.17 + 2.18 + #include <algorithm> // For transform() 2.19 + 2.20 +-#ifdef BROKEN_DEBIAN_LIBUPNP 2.21 +- #define GET_UPNP_STRING(a) UpnpString_get_String(a) 2.22 +-#else 2.23 +- #define GET_UPNP_STRING(a) (a) 2.24 +-#endif 2.25 +- 2.26 + std::string stdEmptyString; 2.27 + 2.28 + const char s_argument[] = "argument"; 2.29 +@@ -1127,7 +1117,7 @@ bool CUPnPControlPoint::PrivateDeletePor 2.30 + 2.31 + 2.32 + // This function is static 2.33 +-int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*Cookie*/) 2.34 ++int CUPnPControlPoint::Callback(Upnp_EventType EventType, const void *Event, void * /*Cookie*/) 2.35 + { 2.36 + std::ostringstream msg; 2.37 + std::ostringstream msg2; 2.38 +@@ -1149,24 +1139,24 @@ int CUPnPControlPoint::Callback(Upnp_Eve 2.39 + msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: "; 2.40 + // UPnP Discovery 2.41 + upnpDiscovery: 2.42 +- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event; 2.43 ++ UpnpDiscovery *d_event = (UpnpDiscovery *)Event; 2.44 + IXML_Document *doc = NULL; 2.45 + int ret; 2.46 +- if (d_event->ErrCode != UPNP_E_SUCCESS) { 2.47 +- msg << UpnpGetErrorMessage(d_event->ErrCode) << "."; 2.48 ++ if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) { 2.49 ++ msg << UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)) << "."; 2.50 + AddDebugLogLineC(logUPnP, msg); 2.51 + } 2.52 + // Get the XML tree device description in doc 2.53 +- ret = UpnpDownloadXmlDoc(d_event->Location, &doc); 2.54 ++ ret = UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(d_event), &doc); 2.55 + if (ret != UPNP_E_SUCCESS) { 2.56 + msg << "Error retrieving device description from " << 2.57 +- d_event->Location << ": " << 2.58 ++ UpnpDiscovery_get_Location_cstr(d_event) << ": " << 2.59 + UpnpGetErrorMessage(ret) << 2.60 + "(" << ret << ")."; 2.61 + AddDebugLogLineC(logUPnP, msg); 2.62 + } else { 2.63 + msg2 << "Retrieving device description from " << 2.64 +- d_event->Location << "."; 2.65 ++ UpnpDiscovery_get_Location_cstr(d_event) << "."; 2.66 + AddDebugLogLineN(logUPnP, msg2); 2.67 + } 2.68 + if (doc) { 2.69 +@@ -1195,7 +1185,7 @@ upnpDiscovery: 2.70 + } 2.71 + // Add the root device to our list 2.72 + upnpCP->AddRootDevice(rootDevice, urlBase, 2.73 +- d_event->Location, d_event->Expires); 2.74 ++ UpnpDiscovery_get_Location_cstr(d_event), UpnpDiscovery_get_Expires(d_event)); 2.75 + } 2.76 + // Free the XML doc tree 2.77 + IXML::Document::Free(doc); 2.78 +@@ -1216,28 +1206,28 @@ upnpDiscovery: 2.79 + case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: { 2.80 + //fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n"); 2.81 + // UPnP Device Removed 2.82 +- struct Upnp_Discovery *dab_event = (struct Upnp_Discovery *)Event; 2.83 +- if (dab_event->ErrCode != UPNP_E_SUCCESS) { 2.84 ++ UpnpDiscovery *dab_event = (UpnpDiscovery *)Event; 2.85 ++ if (UpnpDiscovery_get_ErrCode(dab_event) != UPNP_E_SUCCESS) { 2.86 + msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " << 2.87 +- UpnpGetErrorMessage(dab_event->ErrCode) << 2.88 ++ UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(dab_event)) << 2.89 + "."; 2.90 + AddDebugLogLineC(logUPnP, msg); 2.91 + } 2.92 +- std::string devType = dab_event->DeviceType; 2.93 ++ std::string devType = UpnpDiscovery_get_DeviceType_cstr(dab_event); 2.94 + // Check for an InternetGatewayDevice and removes it from the list 2.95 + std::transform(devType.begin(), devType.end(), devType.begin(), tolower); 2.96 + if (stdStringIsEqualCI(devType, UPnP::Device::IGW)) { 2.97 +- upnpCP->RemoveRootDevice(dab_event->DeviceId); 2.98 ++ upnpCP->RemoveRootDevice(UpnpDiscovery_get_DeviceID_cstr(dab_event)); 2.99 + } 2.100 + break; 2.101 + } 2.102 + case UPNP_EVENT_RECEIVED: { 2.103 + //fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n"); 2.104 + // Event reveived 2.105 +- struct Upnp_Event *e_event = (struct Upnp_Event *)Event; 2.106 +- const std::string Sid = e_event->Sid; 2.107 ++ UpnpEvent *e_event = (UpnpEvent *)Event; 2.108 ++ const std::string Sid = UpnpEvent_get_SID_cstr(e_event); 2.109 + // Parses the event 2.110 +- upnpCP->OnEventReceived(Sid, e_event->EventKey, e_event->ChangedVariables); 2.111 ++ upnpCP->OnEventReceived(Sid, UpnpEvent_get_EventKey(e_event), UpnpEvent_get_ChangedVariables(e_event)); 2.112 + break; 2.113 + } 2.114 + case UPNP_EVENT_SUBSCRIBE_COMPLETE: 2.115 +@@ -1252,16 +1242,15 @@ upnpDiscovery: 2.116 + //fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n"); 2.117 + msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): "; 2.118 + upnpEventRenewalComplete: 2.119 +- struct Upnp_Event_Subscribe *es_event = 2.120 +- (struct Upnp_Event_Subscribe *)Event; 2.121 +- if (es_event->ErrCode != UPNP_E_SUCCESS) { 2.122 ++ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event; 2.123 ++ if (UpnpEventSubscribe_get_ErrCode(es_event) != UPNP_E_SUCCESS) { 2.124 + msg << "Error in Event Subscribe Callback"; 2.125 + UPnP::ProcessErrorMessage( 2.126 +- msg.str(), es_event->ErrCode, NULL, NULL); 2.127 ++ msg.str(), UpnpEventSubscribe_get_ErrCode(es_event), NULL, NULL); 2.128 + } else { 2.129 + #if 0 2.130 + TvCtrlPointHandleSubscribeUpdate( 2.131 +- GET_UPNP_STRING(es_event->PublisherUrl), 2.132 ++ UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), 2.133 + es_event->Sid, 2.134 + es_event->TimeOut ); 2.135 + #endif 2.136 +@@ -1280,29 +1269,29 @@ upnpEventRenewalComplete: 2.137 + msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): "; 2.138 + msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: "; 2.139 + upnpEventSubscriptionExpired: 2.140 +- struct Upnp_Event_Subscribe *es_event = 2.141 +- (struct Upnp_Event_Subscribe *)Event; 2.142 ++ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event; 2.143 + Upnp_SID newSID; 2.144 + memset(newSID, 0, sizeof(Upnp_SID)); 2.145 + int TimeOut = 1801; 2.146 + int ret = UpnpSubscribe( 2.147 + upnpCP->m_UPnPClientHandle, 2.148 +- GET_UPNP_STRING(es_event->PublisherUrl), 2.149 ++ 2.150 ++ UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), 2.151 + &TimeOut, 2.152 + newSID); 2.153 + if (ret != UPNP_E_SUCCESS) { 2.154 + msg << "Error Subscribing to EventURL"; 2.155 + UPnP::ProcessErrorMessage( 2.156 +- msg.str(), es_event->ErrCode, NULL, NULL); 2.157 ++ msg.str(), UpnpEventSubscribe_get_ErrCode(es_event), NULL, NULL); 2.158 + } else { 2.159 + ServiceMap::iterator it = 2.160 +- upnpCP->m_ServiceMap.find(GET_UPNP_STRING(es_event->PublisherUrl)); 2.161 ++ upnpCP->m_ServiceMap.find(UpnpEventSubscribe_get_PublisherUrl_cstr(es_event)); 2.162 + if (it != upnpCP->m_ServiceMap.end()) { 2.163 + CUPnPService &service = *(it->second); 2.164 + service.SetTimeout(TimeOut); 2.165 + service.SetSID(newSID); 2.166 + msg2 << "Re-subscribed to EventURL '" << 2.167 +- GET_UPNP_STRING(es_event->PublisherUrl) << 2.168 ++ UpnpEventSubscribe_get_PublisherUrl_cstr(es_event) << 2.169 + "' with SID == '" << 2.170 + newSID << "'."; 2.171 + AddDebugLogLineC(logUPnP, msg2); 2.172 +@@ -1321,17 +1310,16 @@ upnpEventSubscriptionExpired: 2.173 + case UPNP_CONTROL_ACTION_COMPLETE: { 2.174 + //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n"); 2.175 + // This is here if we choose to do this asynchronously 2.176 +- struct Upnp_Action_Complete *a_event = 2.177 +- (struct Upnp_Action_Complete *)Event; 2.178 +- if (a_event->ErrCode != UPNP_E_SUCCESS) { 2.179 ++ UpnpActionComplete *a_event = (UpnpActionComplete *)Event; 2.180 ++ if (UpnpActionComplete_get_ErrCode(a_event) != UPNP_E_SUCCESS) { 2.181 + UPnP::ProcessErrorMessage( 2.182 + "UpnpSendActionAsync", 2.183 +- a_event->ErrCode, NULL, 2.184 +- a_event->ActionResult); 2.185 ++ UpnpActionComplete_get_ErrCode(a_event), NULL, 2.186 ++ UpnpActionComplete_get_ActionResult(a_event)); 2.187 + } else { 2.188 + // Check the response document 2.189 + UPnP::ProcessActionResponse( 2.190 +- a_event->ActionResult, 2.191 ++ UpnpActionComplete_get_ActionResult(a_event), 2.192 + "<UpnpSendActionAsync>"); 2.193 + } 2.194 + /* No need for any processing here, just print out results. 2.195 +@@ -1342,12 +1330,11 @@ upnpEventSubscriptionExpired: 2.196 + case UPNP_CONTROL_GET_VAR_COMPLETE: { 2.197 + //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n"); 2.198 + msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): "; 2.199 +- struct Upnp_State_Var_Complete *sv_event = 2.200 +- (struct Upnp_State_Var_Complete *)Event; 2.201 +- if (sv_event->ErrCode != UPNP_E_SUCCESS) { 2.202 ++ UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event; 2.203 ++ if (UpnpStateVarComplete_get_ErrCode(sv_event) != UPNP_E_SUCCESS) { 2.204 + msg << "m_UpnpGetServiceVarStatusAsync"; 2.205 + UPnP::ProcessErrorMessage( 2.206 +- msg.str(), sv_event->ErrCode, NULL, NULL); 2.207 ++ msg.str(), UpnpStateVarComplete_get_ErrCode(sv_event), NULL, NULL); 2.208 + } else { 2.209 + #if 0 2.210 + // Warning: The use of UpnpGetServiceVarStatus and 2.211 +--- a/src/UPnPBase.h 2.212 ++++ b/src/UPnPBase.h 2.213 +@@ -490,9 +490,19 @@ public: 2.214 + // Callback function 2.215 + static int Callback( 2.216 + Upnp_EventType EventType, 2.217 +- void* Event, 2.218 ++ const void* Event, 2.219 + void* Cookie); 2.220 + 2.221 ++#if UPNP_VERSION < 10800 2.222 ++ /* in libupnp 1.6 Event is not const */ 2.223 ++ static int Callback( 2.224 ++ Upnp_EventType EventType, 2.225 ++ void* Event, 2.226 ++ void* Cookie) { 2.227 ++ return Callback(EventType, (const void *)Event, Cookie); 2.228 ++ } 2.229 ++#endif 2.230 ++ 2.231 + private: 2.232 + void OnEventReceived( 2.233 + const std::string &Sid, 2.234 +--- a/configure.in 2.235 ++++ b/configure.in 2.236 +@@ -220,7 +220,7 @@ MULE_ARG_ENABLE([upnp], [yes], [do not c 2.237 + MULE_IF_ENABLED_ANY([monolithic, amule-daemon],, [MULE_ENABLEVAR([upnp])=no]) 2.238 + MULE_IF_ENABLED([upnp], [ 2.239 + LIBUPNP_CHECK( 2.240 +- [1.6.6], 2.241 ++ [1.6.24], 2.242 + [MULE_APPEND([LIBUPNP_CPPFLAGS], [-DENABLE_UPNP=1])], 2.243 + [MULE_ENABLEVAR([upnp])=disabled 2.244 + MULE_WARNING([UPnP code has been disabled because ${libupnp_error}.])]