summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorYusuf Aktepe2019-11-05 02:29:05 +0300
committerYusuf Aktepe2019-11-05 02:29:33 +0300
commita7ed60fc9c5d374dbe099b274aaae12307e38a87 (patch)
tree59c7a883b32efb0a184dde4dc17656787b821abb
downloadaur-a7ed60fc9c5d374dbe099b274aaae12307e38a87.tar.gz
Initial commit
-rw-r--r--.SRCINFO23
-rw-r--r--PKGBUILD46
-rw-r--r--dir-navigation.diff89
3 files changed, 158 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..33e4d5700809
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = sxiv-dir-navigation-git
+ pkgdesc = Simple X Image Viewer (with patch to browse through images in working directory)
+ pkgver = v25.r10.g07300da
+ pkgrel = 1
+ url = https://github.com/muennich/sxiv
+ arch = x86_64
+ license = GPL2
+ makedepends = git
+ depends = imlib2
+ depends = desktop-file-utils
+ depends = xdg-utils
+ depends = hicolor-icon-theme
+ depends = libexif
+ depends = libxft
+ provides = sxiv
+ conflicts = sxiv
+ source = sxiv::git+https://github.com/muennich/sxiv.git
+ source = dir-navigation.diff
+ sha256sums = SKIP
+ sha256sums = d2cd688f326c8457f7102d374e6bad96c9922d20e918c3f7020a6ec0d554fef5
+
+pkgname = sxiv-dir-navigation-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9b1033a26221
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,46 @@
+# Maintainer: Yusuf Aktepe <yusuf@yusufaktepe.com>
+# Contributor: Doron Behar <doron.behar@gmail.com>
+# Contributor: Jason Ryan <jasonwryan@gmail.com>
+
+_name=sxiv
+pkgname="${_name}-dir-navigation-git"
+pkgver=v25.r10.g07300da
+pkgrel=1
+pkgdesc="Simple X Image Viewer (with patch to browse through images in working directory)"
+arch=('x86_64')
+url="https://github.com/muennich/${_name}"
+license=('GPL2')
+depends=('imlib2' 'desktop-file-utils' 'xdg-utils' 'hicolor-icon-theme' 'libexif' 'libxft')
+makedepends=('git')
+provides=("${_name}")
+conflicts=("${_name}")
+source=("${_name}::git+${url}.git"
+ "dir-navigation.diff")
+sha256sums=('SKIP'
+ 'd2cd688f326c8457f7102d374e6bad96c9922d20e918c3f7020a6ec0d554fef5')
+
+pkgver() {
+ cd "${_name}"
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "${_name}"
+ ln -s config.def.h config.h
+
+ echo "==> Applying dir-navigation patch"
+ git apply "$srcdir"/dir-navigation.diff
+}
+
+build() {
+ make -C "${_name}"
+}
+
+package() {
+ cd "${_name}"
+ make PREFIX=/usr DESTDIR="$pkgdir" install
+ make -C icon PREFIX=/usr DESTDIR="$pkgdir" install
+ install -Dm644 sxiv.desktop "$pkgdir"/usr/share/applications/sxiv.desktop
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/dir-navigation.diff b/dir-navigation.diff
new file mode 100644
index 000000000000..2f3ead5c21ba
--- /dev/null
+++ b/dir-navigation.diff
@@ -0,0 +1,89 @@
+From 4c99b47411932c2e46ca282597418329a7fbeea9 Mon Sep 17 00:00:00 2001
+From: Doron Behar <doron.behar@gmail.com>
+Date: Tue, 23 Apr 2019 14:42:38 +0300
+Subject: [PATCH] Always read all files in the directory sxiv gets
+
+---
+ main.c | 43 ++++++++++++++++++++++++++++++-------------
+ 1 file changed, 30 insertions(+), 13 deletions(-)
+
+diff --git a/main.c b/main.c
+index 8adbf78..f5eeea1 100644
+--- a/main.c
++++ b/main.c
+@@ -21,6 +21,7 @@
+ #include "config.h"
+
+ #include <stdlib.h>
++#include <libgen.h>
+ #include <string.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -817,15 +818,36 @@ void setup_signal(int sig, void (*handler)(int sig))
+ error(EXIT_FAILURE, errno, "signal %d", sig);
+ }
+
++int add_files_from_dir(char *directory, char *exclude_filename, bool recursive)
++{
++ r_dir_t dir;
++ if (r_opendir(&dir, directory, recursive) < 0) {
++ error(0, errno, "%s", directory);
++ return 1;
++ }
++ int start = fileidx;
++ char *filename;
++ while ((filename = r_readdir(&dir, true)) != NULL) {
++
++ if (strcmp(filename, exclude_filename) != 0) {
++ check_add_file(filename, false);
++ }
++ free((void*) filename);
++ }
++ r_closedir(&dir);
++ if (fileidx - start > 1)
++ qsort(files + start, fileidx - start, sizeof(fileinfo_t), fncmp);
++ return 0;
++}
++
+ int main(int argc, char **argv)
+ {
+- int i, start;
++ int i;
+ size_t n;
+ ssize_t len;
+ char *filename;
+ const char *homedir, *dsuffix = "";
+ struct stat fstats;
+- r_dir_t dir;
+
+ setup_signal(SIGCHLD, sigchld);
+ setup_signal(SIGPIPE, SIG_IGN);
+@@ -874,19 +896,14 @@ int main(int argc, char **argv)
+ }
+ if (!S_ISDIR(fstats.st_mode)) {
+ check_add_file(filename, true);
++ char *_filename = strdup(filename);
++ char *filedir = strdup(filename);
++ filedir = dirname(filename);
++ if (!add_files_from_dir(filedir, _filename, options->recursive))
++ continue;
+ } else {
+- if (r_opendir(&dir, filename, options->recursive) < 0) {
+- error(0, errno, "%s", filename);
++ if (!add_files_from_dir(filename, "", options->recursive))
+ continue;
+- }
+- start = fileidx;
+- while ((filename = r_readdir(&dir, true)) != NULL) {
+- check_add_file(filename, false);
+- free((void*) filename);
+- }
+- r_closedir(&dir);
+- if (fileidx - start > 1)
+- qsort(files + start, fileidx - start, sizeof(fileinfo_t), fncmp);
+ }
+ }
+
+--
+2.23.0
+