fix build with libidn2

This commit is contained in:
Than Ngo 2017-06-21 13:35:23 +02:00
parent c17e2ce087
commit 7d92d7b924
2 changed files with 66 additions and 4 deletions

View File

@ -7,8 +7,8 @@ diff -up kdelibs-3.5.10/configure.in.than kdelibs-3.5.10/configure.in
if test "x$with_libidn" != xno; then
- AC_CHECK_HEADERS([idna.h punycode.h stringprep.h])
- KDE_CHECK_LIB(idn, idna_to_ascii_4i, [
+ AC_CHECK_HEADERS([idn2])
+ KDE_CHECK_LIB(idn2, idna_to_ascii_4i, [
+ AC_CHECK_HEADERS([idn2.h])
+ KDE_CHECK_LIB(idn2, idn2_to_ascii_4i, [
AC_DEFINE_UNQUOTED(HAVE_LIBIDN, 1, [Defined if you have libidn in your system])
- LIB_IDN=-lidn
+ LIB_IDN=-lidn2
@ -25,10 +25,69 @@ diff -up kdelibs-3.5.10/kdecore/configure.in.in.than kdelibs-3.5.10/kdecore/conf
- AC_CHECK_HEADERS([idna.h punycode.h stringprep.h])
- KDE_CHECK_LIB(idn, idna_to_ascii_4i, [
+ AC_CHECK_HEADERS([idn2.h])
+ KDE_CHECK_LIB(idn2, idna_to_ascii_4i, [
+ KDE_CHECK_LIB(idn2, idn2_to_ascii_4i, [
AC_DEFINE_UNQUOTED(HAVE_LIBIDN, 1, [Defined if you have libidn in your system])
- LIB_IDN=-lidn
+ LIB_IDN=-lidn2
])
if test "x$with_libidn" != xcheck && test -z "$LIB_IDN"; then
AC_MSG_ERROR([--with-libidn was given, but test for libidn failed])
diff -up kdelibs-3.5.10/kdecore/network/kresolver.cpp.than kdelibs-3.5.10/kdecore/network/kresolver.cpp
--- kdelibs-3.5.10/kdecore/network/kresolver.cpp.than 2017-06-21 12:55:55.733217103 +0200
+++ kdelibs-3.5.10/kdecore/network/kresolver.cpp 2017-06-21 13:27:38.956737181 +0200
@@ -49,8 +49,8 @@
#include <qguardedptr.h>
// IDN
-#ifdef HAVE_IDNA_H
-# include <idna.h>
+#ifdef HAVE_IDN2_H
+# include <idn2.h>
#endif
// KDE
@@ -1083,7 +1083,7 @@ static QStringList splitLabels(const QSt
static QCString ToASCII(const QString& label)
{
-#ifdef HAVE_IDNA_H
+#ifdef HAVE_IDN2_H
// We have idna.h, so we can use the idna_to_ascii
// function :)
@@ -1104,7 +1104,7 @@ static QCString ToASCII(const QString& l
ucs4[i] = (unsigned long)label[i].unicode();
ucs4[i] = 0; // terminate with NUL, just to be on the safe side
- if (idna_to_ascii_4i(ucs4, label.length(), buf, 0) == IDNA_SUCCESS)
+ if (idn2_to_ascii_4i(ucs4, label.length(), buf, 0|IDN2_NFC_INPUT|IDN2_NONTRANSITIONAL) == IDN2_OK)
// success!
retval = buf;
@@ -1117,7 +1117,7 @@ static QCString ToASCII(const QString& l
static QString ToUnicode(const QString& label)
{
-#ifdef HAVE_IDNA_H
+#ifdef HAVE_IDN2_H
// We have idna.h, so we can use the idna_to_unicode
// function :)
@@ -1131,7 +1131,7 @@ static QString ToUnicode(const QString&
// try the same length for output
ucs4_output = new Q_UINT32[outlen = label.length()];
- idna_to_unicode_44i(ucs4_input, label.length(),
+ idn2_to_unicode_44i(ucs4_input, label.length(),
ucs4_output, &outlen,
0);
@@ -1141,7 +1141,7 @@ static QString ToUnicode(const QString&
delete [] ucs4_output;
ucs4_output = new Q_UINT32[outlen];
- idna_to_unicode_44i(ucs4_input, label.length(),
+ idn2_to_unicode_44i(ucs4_input, label.length(),
ucs4_output, &outlen,
0);
}

View File

@ -18,7 +18,7 @@
Summary: KDE 3 Libraries
Name: kdelibs3
Version: 3.5.10
Release: 85%{?dist}
Release: 86%{?dist}
License: LGPLv2
Url: http://www.kde.org/
@ -652,6 +652,9 @@ touch --no-create %{_datadir}/icons/crystalsvg 2> /dev/null || :
%attr(4755,root,root) %{_bindir}/kpac_dhcp_helper
%changelog
* Wed Jun 21 2017 Than Ngo <than@redhat.com> - 3.5.10-86
- fix build with libidn2
* Wed May 10 2017 Than Ngo <than@redhat.com> - 3.5.10-85
- add support libidn2 for f27