void-packages/srcpkgs/ki18n/patches/musl.patch
2016-10-16 12:46:48 +04:00

89 lines
3 KiB
Diff

From: "A. Wilcox" <awilfox@adelielinux.org>
Date: Wed, 20 Jul 2016 21:19:14 -0500
Subject: [PATCH] Determine if _nl_msg_cat_cntr exists before use
GNU gettext does not guarantee that GNU libintl will be used. This
assumption breaks the build against the musl libc.
BUG: 365917
---
--- CMakeLists.txt.orig 2016-10-08 23:44:18.942470224 +0400
+++ CMakeLists.txt 2016-10-08 23:43:46.744119642 +0400
@@ -59,6 +59,9 @@
add_subdirectory(src)
add_subdirectory(autotests)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in"
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h")
+
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5I18n")
--- cmake/FindLibIntl.cmake.orig 2016-10-08 23:44:36.402660334 +0400
+++ cmake/FindLibIntl.cmake 2016-10-08 23:43:46.744119642 +0400
@@ -56,3 +56,6 @@
message(STATUS "libintl is a separate library.")
find_package_handle_standard_args(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS LibIntl_LIBRARIES)
endif()
+
+set(CMAKE_REQUIRED_LIBRARIES ${LibIntl_LIBRARIES})
+check_cxx_source_compiles("extern \"C\" int _nl_msg_cat_cntr; int main(void) { ++_nl_msg_cat_cntr; return 0; }" HAVE_NL_MSG_CAT_CNTR)
--- /dev/null 2016-10-06 19:10:07.556940908 +0400
+++ src/config.h.in 2016-10-08 23:43:46.744119642 +0400
@@ -0,0 +1,25 @@
+/* This file is part of the KDE libraries
+ Copyright (c) 2016 A. Wilcox <awilfox@adelielinux.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#cmakedefine HAS_NL_MSG_CAT_CNTR
+
+#endif
--- src/kcatalog.cpp.orig 2016-10-08 23:45:07.570999701 +0400
+++ src/kcatalog.cpp 2016-10-08 23:43:46.744119642 +0400
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <locale.h>
#include "gettext.h"
+#include "config.h"
#include <qstandardpaths.h>
#include <QByteArray>
@@ -41,7 +42,7 @@
#endif
#endif
-#if defined(__USE_GNU_GETTEXT)
+#if defined(HAS_NL_MSG_CAT_CNTR)
extern "C" int Q_DECL_IMPORT _nl_msg_cat_cntr;
#endif
@@ -171,9 +172,9 @@
//qDebug() << "bindtextdomain" << domain << localeDir;
bindtextdomain(domain, localeDir);
+#if defined(HAS_NL_MSG_CAT_CNTR)
// Magic to make sure GNU Gettext doesn't use stale cached translation
// from previous language.
-#if defined(__USE_GNU_GETTEXT)
++_nl_msg_cat_cntr;
#endif
}