development/cppcheck: Add doinst, fix translations.

Signed-off-by: B. Watson <yalhcru@gmail.com>
This commit is contained in:
B. Watson 2022-04-06 11:07:05 -04:00
parent b83041c697
commit 830a31bbbb
4 changed files with 68 additions and 8 deletions

View File

@ -22,11 +22,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20220405 bkw: Modified by SlackBuilds.org, BUILD=2:
# - add doinst.sh, because we have icons and a .desktop.
# - install translations (*.qm) in usr/share/Cppcheck/lang/, not /usr/bin.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=cppcheck
VERSION=${VERSION:-2.6}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -74,9 +78,14 @@ cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
# 20220406 bkw: these patches from Debian install the translations
# to the correct /usr/share directory instead of in /usr/bin.
patch -p1 < $CWD/fix-default-settings.diff
patch -p1 < $CWD/install-translations-in-filesdir-lang.diff
mkdir -p build
cd build
@ -97,11 +106,6 @@ cd ..
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHORS COPYING readme.{md,txt} \
@ -110,6 +114,7 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,9 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
fi
fi

View File

@ -0,0 +1,30 @@
Description: Set configuration directory and python version
Author: Joachim Reichel <reichel@debian.org>
Index: cppcheck/gui/main.cpp
===================================================================
--- cppcheck.orig/gui/main.cpp
+++ cppcheck/gui/main.cpp
@@ -55,6 +55,12 @@ int main(int argc, char *argv[])
QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
+ // Set some default settings
+ if( settings->value("DATADIR", QString()).toString().isEmpty())
+ settings->setValue("DATADIR", FILESDIR);
+ if( settings->value(SETTINGS_PYTHON_PATH, QString()).toString().isEmpty())
+ settings->setValue(SETTINGS_PYTHON_PATH, QString("/usr/bin/python3"));
+
// Set data dir..
foreach (const QString arg, app.arguments()) {
if (arg.startsWith("--data-dir=")) {
Index: cppcheck/htmlreport/cppcheck-htmlreport
===================================================================
--- cppcheck.orig/htmlreport/cppcheck-htmlreport
+++ cppcheck/htmlreport/cppcheck-htmlreport
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import unicode_literals

View File

@ -0,0 +1,16 @@
Description: Install the translations in $FILESDIR/lang instead of /usr/bin
Author: Joachim Reichel <reichel@debian.org>
Index: cppcheck/gui/CMakeLists.txt
===================================================================
--- cppcheck.orig/gui/CMakeLists.txt
+++ cppcheck/gui/CMakeLists.txt
@@ -51,7 +51,7 @@ if (BUILD_GUI)
endif()
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
- install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
+ install(FILES ${qms} DESTINATION ${FILESDIR}/lang COMPONENT applications)
install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)