Subject: [alpine-aports] [PATCH] testing/cppcheck: new aport

From: AmatCoder <[email-masked]>
Date: Thu, 22 Jan 2015 05:34:41 +0000

---
 testing/cppcheck/APKBUILD             | 76 +++++++++++++++++++++++++++++++++++
 testing/cppcheck/avoid_execinfo.patch | 11 +++++
 testing/cppcheck/set_datadir.patch    | 21 ++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 testing/cppcheck/APKBUILD
 create mode 100644 testing/cppcheck/avoid_execinfo.patch
 create mode 100644 testing/cppcheck/set_datadir.patch

diff --git a/testing/cppcheck/APKBUILD b/testing/cppcheck/APKBUILD
new file mode 100644
index 0000000..c4d1584
--- /dev/null
+++ b/testing/cppcheck/APKBUILD
@@ -0,0 +1,76 @@
+# Contributor: August Klein <[email-masked]>
+# Maintainer: August Klein <[email-masked]>
+pkgname=cppcheck
+pkgver=1.68
+pkgrel=0
+pkgdesc="A static analysis tool for C/C++ code"
+url="http://cppcheck.sourceforge.net"
+arch="all"
+license="GPL3"
+depends=""
+depends_dev=""
+makedepends="$depends_dev docbook-xsl pcre-dev qt5-qttools-dev"
+install=""
+subpackages="$pkgname-doc $pkgname-htmlreport $pkgname-gui"
+source="https://github.com/danmar/cppcheck/archive/$pkgver.tar.gz
+	avoid_execinfo.patch
+	set_datadir.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+	local i 
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	make DB2MAN=/usr/share/xml/docbook/xsl-stylesheets-*/manpages/docbook.xsl man || return 1
+
+	cd gui
+	lrelease gui.pro || return 1
+	qmake HAVE_RULES=yes || return 1
+	make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg HAVE_RULES=yes || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" CFGDIR=/usr/share/cppcheck/cfg HAVE_RULES=yes install || return 1
+	install -Dm644 cppcheck.1 "$pkgdir"/usr/share/man/man1/cppcheck.1 || return 1
+}
+
+htmlreport() {
+	pkgdesc="A utility to generate a html report of a XML file produced by cppcheck"
+	arch="noarch"
+	depends="cppcheck py-pygments"
+
+	cd "$_builddir"
+	mkdir -p "$subpkgdir"/usr/bin
+	mv "$pkgdir"/usr/bin/$subpkgname "$subpkgdir"/usr/bin/
+}
+
+gui() {
+	pkgdesc="A Qt gui for cppcheck"
+	depends="cppcheck"
+
+	cd "$_builddir"
+	mkdir -p "$subpkgdir"/usr/bin
+	mv gui/$subpkgname "$subpkgdir"/usr/bin/
+
+	mkdir -p "$subpkgdir"/usr/share/cppcheck/lang/
+	mv gui/cppcheck*.qm "$subpkgdir"/usr/share/cppcheck/lang/
+}
+
+md5sums="35c84962db9b01673d872fc4966aeb22  1.68.tar.gz
+f7543600f177495d19246934210df4c4  avoid_execinfo.patch
+9107713c930708436089b31eb3975de0  set_datadir.patch"
+sha256sums="fceac7e28783b55604a49504dfdbdbf8b9572eddaaacf3c87bc1600b086b5684  1.68.tar.gz
+d628da592fd6fce32d533a8333a20ea0bc273a1a21ed6057f0673678b6bdf4a5  avoid_execinfo.patch
+0f76926ea6baec00cad4e62ecb9215139cf8a1709c3ec613f494212e18ac5275  set_datadir.patch"
+sha512sums="8edee3589282a60e05a698837feea8ae1e5adea63ace2691667c57f6f8649f72f7873b712638377d4750667df3a052a81da15f1fcc5e068c7673f2e0799b046f  1.68.tar.gz
+0f8b62dfbef9305d7146adf14cd01e028e12a63f781d8f25e3e813ecbf98f8bc0c79b0085ec277a12bee8208abddc5520b51e64c5a3503dc77e52db95688c66d  avoid_execinfo.patch
+b3cdd52899c2e1633cd715243b285029a8e72aa3e745be04579677b572b569ef3616dbe98df11cc9a39bc9acd9c13cc43bc4d21edc7e7fde8b95a9903cdcd58e  set_datadir.patch"
diff --git a/testing/cppcheck/avoid_execinfo.patch b/testing/cppcheck/avoid_execinfo.patch
new file mode 100644
index 0000000..c77dbc2
--- /dev/null
+++ b/testing/cppcheck/avoid_execinfo.patch
@@ -0,0 +1,11 @@
+--- cppcheck-1.68-origin/cli/cppcheckexecutor.cpp
++++ cppcheck-1.68/cli/cppcheckexecutor.cpp
+@@ -51,7 +51,7 @@
+ #endif
+ #endif
+ 
+-#if !defined(NO_UNIX_BACKTRACE_SUPPORT) && defined(USE_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__NetBSD__) && !defined(__SVR4) && !defined(__QNX__)
++#if !defined(NO_UNIX_BACKTRACE_SUPPORT) && defined(USE_UNIX_SIGNAL_HANDLING) && defined (__GLIBC__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__NetBSD__) && !defined(__SVR4) && !defined(__QNX__)
+ #define USE_UNIX_BACKTRACE_SUPPORT
+ #include <cxxabi.h>
+ #include <execinfo.h>
diff --git a/testing/cppcheck/set_datadir.patch b/testing/cppcheck/set_datadir.patch
new file mode 100644
index 0000000..c00e543
--- /dev/null
+++ b/testing/cppcheck/set_datadir.patch
@@ -0,0 +1,21 @@
+--- cppcheck-1.68-origin/gui/main.cpp
++++ cppcheck-1.68/gui/main.cpp
+@@ -57,12 +57,18 @@
+     QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
+ 
+     // Set data dir..
++    if ((settings->value("DATADIR", QString()).toString()).isEmpty())
++        settings->setValue("DATADIR", "/usr/share/cppcheck");
++
+     foreach(const QString arg, app.arguments()) {
+         if (arg.startsWith("--data-dir=")) {
+             settings->setValue("DATADIR", arg.mid(11));
+             return 0;
+         }
+     }
++
++    if ((settings->value(SETTINGS_LANGUAGE, QString()).toString()).isEmpty())
++        settings->setValue(SETTINGS_LANGUAGE, "en");
+ 
+     TranslationHandler* th = new TranslationHandler(&app);
+     th->SetLanguage(settings->value(SETTINGS_LANGUAGE, th->SuggestLanguage()).toString());
-- 
2.2.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Orion <[email-masked]>
Date: Wed, 21 Jan 2015 22:14:40 -0800

Thanks a bunch. I have been wanting to port that for a little while now.

-- 
keybase.io/systmkor

---