office/zathura-cb: Added (comic book plugin for zathura)

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
B. Watson 2012-07-29 23:14:20 -05:00 committed by Robby Workman
parent c45dac6ecf
commit 4259b6fb38
5 changed files with 168 additions and 0 deletions

5
office/zathura-cb/README Normal file
View File

@ -0,0 +1,5 @@
zathura-cb (comic book plugin for zathura)
Adds support for cbz, cbr, cb7, cbt files to the zathura document viewer.
This requires zathura, unrar, and p7zip.

View File

@ -0,0 +1,59 @@
diff -Naur zathura-cb-0.1.0/cb.c zathura-cb-0.1.0.patched/cb.c
--- zathura-cb-0.1.0/cb.c 2012-06-09 17:48:13.000000000 -0400
+++ zathura-cb-0.1.0.patched/cb.c 2012-07-22 15:06:18.000000000 -0400
@@ -1,7 +1,9 @@
/* See LICENSE file for license and copyright information */
-#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
@@ -11,7 +13,7 @@
#include "utils.h"
struct cb_document_s {
- char* directory; /**< Path to the directory */
+ char directory[4096]; /**< Path to the directory */
girara_list_t* page_paths; /**< List of page paths */
};
@@ -58,8 +60,8 @@
cb_document_t* cb_document = g_malloc0(sizeof(cb_document));
/* create temp directory */
- cb_document->directory = g_dir_make_tmp("zathura-cb-XXXXXX", NULL);
- if (cb_document->directory == NULL) {
+ sprintf(cb_document->directory, "%s/zathura-cb-XXXXXX", g_get_tmp_dir());
+ if(mkdtemp(cb_document->directory) == NULL) {
goto error_free;
}
@@ -148,18 +150,18 @@
return ZATHURA_ERROR_INVALID_ARGUMENTS;
}
- /* remove temp directory */
- if (cb_document->directory != NULL) {
- g_remove(cb_document->directory);
- }
-
/* remove page list */
if (cb_document->page_paths != NULL) {
+ char *path;
+ GIRARA_LIST_FOREACH(cb_document->page_paths, char*, iter, path)
+ g_remove(path);
+ GIRARA_LIST_FOREACH_END(cb_document->page_paths, char*, iter, path);
girara_list_free(cb_document->page_paths);
}
+ /* remove temp directory */
if (cb_document->directory != NULL) {
- g_free(cb_document->directory);
+ g_remove(cb_document->directory);
}
g_free(cb_document);

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
zathura-cb: zathura-cb (comic book plugin for zathura)
zathura-cb:
zathura-cb: Adds support for cbz, cbr, cb7, cbt files to the zathura document
zathura-cb: viewer.
zathura-cb:
zathura-cb:
zathura-cb:
zathura-cb:
zathura-cb:
zathura-cb:
zathura-cb:

View File

@ -0,0 +1,75 @@
#!/bin/bash
# Slackware build script for zathura-cb
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://sam.zoy.org/wtfpl/ for details.
PRGNAM=zathura-cb
VERSION=${VERSION:-0.1.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# as shipped, the source uses g_dir_make_tmp(), which was introduced in
# glib-2.30. Slack 13.37 ships with glib-2.28, so we make the code use
# g_mkdtemp() instead.
patch -p1 < $CWD/glib228compat.diff
sed -i "s,-fPIC,$SLKCFLAGS," config.mk
make VERBOSE=1
strip *.so
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View File

@ -0,0 +1,10 @@
PRGNAM="zathura-cb"
VERSION="0.1.0"
HOMEPAGE="http://www.pwmt.org/projects/zathura/plugins/zathura-cb/"
DOWNLOAD="http://www.pwmt.org/projects/zathura/plugins/download/zathura-cb-0.1.0.tar.gz"
DOWNLOAD_x86_64=""
MD5SUM="be34b699862f4c1c9f5ef4347d1dfdef"
MD5SUM_x86_64=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"
APPROVED="rworkman"