From 76e58af907b06aa2ae45c638391eb3814cd3dcd9 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 9 Sep 2018 17:13:52 -0400 Subject: office/zathura: Re-enable synctex. Signed-off-by: B. Watson --- office/zathura/README | 7 +++++ office/zathura/slack-desc | 2 +- office/zathura/synctex_fix.diff | 59 +++++++++++++++++++++++++++++++++++++++ office/zathura/zathura.SlackBuild | 33 +++++++++++++++++----- 4 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 office/zathura/synctex_fix.diff diff --git a/office/zathura/README b/office/zathura/README index 189dcf21ba..27f9f8301d 100644 --- a/office/zathura/README +++ b/office/zathura/README @@ -18,3 +18,10 @@ are the same. zathura 0.3.8 is the last possible update for Slackware 14.2. Newer versions would require a newer gtk+3. + +Optional dependency: office/texlive. If zathura is built on a system +with texlive installed, synctex support will be included. Documentation +on zathura's synctex support is poor; for some hints on using synctex +with zathura, see: + +http://www.math.cmu.edu/~gautam/sj/blog/20140310-zathura-fsearch.html diff --git a/office/zathura/slack-desc b/office/zathura/slack-desc index 871551a92b..49889a17df 100644 --- a/office/zathura/slack-desc +++ b/office/zathura/slack-desc @@ -14,6 +14,6 @@ zathura: zathura is an application that provides a minimalistic and space zathura: saving interface as well as an easy usage that mainly focuses on zathura: keyboard interaction. zathura: -zathura: +zathura: This package was built @WITH@ texlive synctex support. zathura: zathura: diff --git a/office/zathura/synctex_fix.diff b/office/zathura/synctex_fix.diff new file mode 100644 index 0000000000..904bd663fe --- /dev/null +++ b/office/zathura/synctex_fix.diff @@ -0,0 +1,59 @@ +diff -Naur zathura-0.3.8/zathura/synctex.c zathura-0.3.8.patched/zathura/synctex.c +--- zathura-0.3.8/zathura/synctex.c 2017-12-20 08:40:45.000000000 -0500 ++++ zathura-0.3.8.patched/zathura/synctex.c 2018-09-09 13:56:54.489287021 -0400 +@@ -24,13 +24,13 @@ + return false; + } + +- synctex_scanner_t scanner = synctex_scanner_new_with_output_file(filename, NULL, 1); ++ synctex_scanner_p scanner = synctex_scanner_new_with_output_file(filename, NULL, 1); + if (scanner == NULL) { + girara_debug("Failed to create synctex scanner."); + return false; + } + +- synctex_scanner_t temp = synctex_scanner_parse(scanner); ++ synctex_scanner_p temp = synctex_scanner_parse(scanner); + if (temp == NULL) { + girara_debug("Failed to parse synctex file."); + synctex_scanner_free(scanner); +@@ -41,7 +41,7 @@ + + if (synctex_edit_query(scanner, page + 1u, x, y) > 0) { + /* Assume that a backward search returns at most one result. */ +- synctex_node_t node = synctex_next_result(scanner); ++ synctex_node_p node = synctex_scanner_next_result(scanner); + if (node != NULL) { + if (input_file != NULL) { + *input_file = g_strdup(synctex_scanner_get_name(scanner, synctex_node_tag(node))); +@@ -127,13 +127,13 @@ + ++line; + ++column; + +- synctex_scanner_t scanner = synctex_scanner_new_with_output_file(filename, NULL, 1); ++ synctex_scanner_p scanner = synctex_scanner_new_with_output_file(filename, NULL, 1); + if (scanner == NULL) { + girara_debug("Failed to create synctex scanner."); + return NULL; + } + +- synctex_scanner_t temp = synctex_scanner_parse(scanner); ++ synctex_scanner_p temp = synctex_scanner_parse(scanner); + if (temp == NULL) { + girara_debug("Failed to parse synctex file."); + synctex_scanner_free(scanner); +@@ -143,11 +143,11 @@ + girara_list_t* hitlist = girara_list_new2(g_free); + girara_list_t* other_rects = girara_list_new2(g_free); + +- if (synctex_display_query(scanner, input_file, line, column) > 0) { +- synctex_node_t node = NULL; ++ if (synctex_display_query(scanner, input_file, line, column, -1) > 0) { ++ synctex_node_p node = NULL; + bool got_page = false; + +- while ((node = synctex_next_result (scanner)) != NULL) { ++ while ((node = synctex_scanner_next_result (scanner)) != NULL) { + const unsigned int current_page = synctex_node_page(node) - 1; + if (got_page == false) { + got_page = true; diff --git a/office/zathura/zathura.SlackBuild b/office/zathura/zathura.SlackBuild index 28e06b3447..7d0e602451 100644 --- a/office/zathura/zathura.SlackBuild +++ b/office/zathura/zathura.SlackBuild @@ -23,6 +23,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20180909 bkw: +# - Re-enable building with synctex, since texlive has been fixed. This +# requires a patch, since this version of zathura was written for an +# older version of texlive. + # 20180903 bkw: # - Disable building with synctex, since it currently doesn't work due # to a bug in the texlive package. Will be re-enabled when the texlive @@ -151,6 +156,17 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ patch -p1 < $CWD/dlopen_hack.diff +# synctex API in recent texlive has changed from whatever version +# zathura was developed with. This is a monkey patch, with me as +# the monkey: monkey see someone else's patch for something else here: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=896566;filename=synctex2;msg=10 +# ...and monkey do the same thing to zathura. +# A while after I did this, I found someone else's patch: +# http://pk.archive.ubuntu.com/ubuntu/ubuntu/pool/universe/z/zathura/zathura_0.3.9-2.debian.tar.xz +# ...the portion of the patch that alters synctex.c looks identical to +# the one I came up with, meaning I could have saved myself some work... +patch -p1 < $CWD/synctex_fix.diff + sed -i "s/-pedantic/$SLKCFLAGS/" config.mk sed -i '/--dependency-file/d' Makefile @@ -165,10 +181,16 @@ make \ RSTTOMAN="" \ COLOR=0 \ GLIB_VERSION_CHECK=0 \ - WITH_SYNCTEX=0 \ + VERBOSE=1 \ all \ install +# Check & see if synctex was built in, for slack-desc purposes. +WITH=WITHOUT +if ldd $PKG/usr/bin/$PRGNAM | grep -q libsynctex; then + WITH=WITH +fi + gzip $PKG/usr/man/man?/*.? mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION @@ -194,11 +216,8 @@ rm -rf $PLUGIN-$PLUGINVER tar xvf $CWD/$PLUGIN-$PLUGINVER.tar.gz cd $PLUGIN-$PLUGINVER 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 \ - \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ # ZATHURA_VERSION_CHECK=0 is required because zathura.pc isn't installed. @@ -221,7 +240,7 @@ cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png echo "Icon=$PRGNAM" >> $PKG/usr/share/applications/$PRGNAM.desktop mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed "s,@WITH@,$WITH," $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -- cgit v1.2.3