pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/pdfgrep pdfgrep: fix compile with pre-2016/12...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ec667b505e86
branches:  trunk
changeset: 368367:ec667b505e86
user:      ast <ast%pkgsrc.org@localhost>
date:      Fri Sep 15 22:18:00 2017 +0000

description:
pdfgrep: fix compile with pre-2016/12/16 dirent.h on NetBSD

dirent.h v1.35 from before 2016-12-16 has a different prototype for
scandir() and thus cache.cc won't compile there. Added a configure
section to detect this so that both v1.35 and v1.36 dirent.h work.

diffstat:

 textproc/pdfgrep/distinfo                                |   6 +-
 textproc/pdfgrep/patches/patch-src_cache.cc              |  33 ++++++++
 textproc/pdfgrep/patches/patch-src_cache.cc_config.h.in  |  18 ++++
 textproc/pdfgrep/patches/patch-src_cache.cc_configure    |  66 ++++++++++++++++
 textproc/pdfgrep/patches/patch-src_cache.cc_configure.ac |  34 ++++++++
 5 files changed, 156 insertions(+), 1 deletions(-)

diffs (183 lines):

diff -r 940d2ad5578e -r ec667b505e86 textproc/pdfgrep/distinfo
--- a/textproc/pdfgrep/distinfo Fri Sep 15 17:53:53 2017 +0000
+++ b/textproc/pdfgrep/distinfo Fri Sep 15 22:18:00 2017 +0000
@@ -1,7 +1,11 @@
-$NetBSD: distinfo,v 1.6 2017/08/11 00:59:45 ryoon Exp $
+$NetBSD: distinfo,v 1.7 2017/09/15 22:18:00 ast Exp $
 
 SHA1 (pdfgrep-2.0.1.tar.gz) = 35e8a5143849f7da72c6793e7056c079b5208b5c
 RMD160 (pdfgrep-2.0.1.tar.gz) = 5c656f03b00e80395d648f804db3fc6d748c701b
 SHA512 (pdfgrep-2.0.1.tar.gz) = 4285f8cb514975a0040cdd6b82133090e27ba5c2f95ca880dccc3dd4fa3427260a5fc73d807df9124a79fa36ac6ed8c11380cde11e00599ed7134d92c50df4a0
 Size (pdfgrep-2.0.1.tar.gz) = 187217 bytes
+SHA1 (patch-src_cache.cc) = 64f38fe8e99792119b79f7af50fb34d77bdffec3
+SHA1 (patch-src_cache.cc_config.h.in) = 2b05d4ccf870660f640aa85c6eadbd94a85322af
+SHA1 (patch-src_cache.cc_configure) = 1f522d758bf9d84fec4a3ffffacf4e9341074aa9
+SHA1 (patch-src_cache.cc_configure.ac) = f82c18c66c6b7f9036fe172a7310094620777199
 SHA1 (patch-src_pdfgrep.cc) = ac9290a2467b88592788adf1ec7d15b4cfb5c8a6
diff -r 940d2ad5578e -r ec667b505e86 textproc/pdfgrep/patches/patch-src_cache.cc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/pdfgrep/patches/patch-src_cache.cc       Fri Sep 15 22:18:00 2017 +0000
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_cache.cc,v 1.1 2017/09/15 22:18:00 ast Exp $
+
+* Compile with pre-2016/12/16 v1.36 dirent.h on NetBSD
+
+--- src/cache.cc.orig  2017-01-25 09:31:18.000000000 +0100
++++ src/cache.cc       2017-09-15 22:05:44.077172709 +0200
+@@ -18,6 +18,8 @@
+  *   Boston, MA 02110-1301 USA.                                            *
+  ***************************************************************************/
+ 
++#include "config.h"
++
+ #include "cache.h"
+ #include "output.h"
+ 
+@@ -85,9 +87,17 @@
+ 
+ // I feel so bad...
+ static const char *cache_directory;
++#if SCANDIR_COMPAR_USES_CONST_VOID_POINTER
++static int agesort(const void *a, const void *b) {
++      std::string A = string(cache_directory) + "/"
++                               + ((const struct dirent *)a)->d_name;
++      std::string B = string(cache_directory) + "/"
++                               + ((const struct dirent *)b)->d_name;
++#else
+ static int agesort(const struct dirent ** a, const struct dirent **b) {
+       std::string A = string(cache_directory) + "/" + (*a)->d_name;
+       std::string B = string(cache_directory) + "/" + (*b)->d_name;
++#endif
+ 
+       struct stat bufa, bufb;
+       if (stat(A.c_str(), &bufa) != 0) return 0;
diff -r 940d2ad5578e -r ec667b505e86 textproc/pdfgrep/patches/patch-src_cache.cc_config.h.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/pdfgrep/patches/patch-src_cache.cc_config.h.in   Fri Sep 15 22:18:00 2017 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_cache.cc_config.h.in,v 1.1 2017/09/15 22:18:00 ast Exp $
+
+* Compile with pre-2016/12/16 v1.36 dirent.h on NetBSD
+
+--- config.h.in.orig   2017-09-15 22:23:22.225934988 +0200
++++ config.h.in        2017-09-15 22:25:22.674646455 +0200
+@@ -80,6 +80,11 @@
+ /* Git commit used to build this programm */
+ #undef PDFGREP_GIT_HEAD
+ 
++/* Define to 1 if you have to use const void * with scandir's compar()
++   function, to 0 if you are using the IEEE Std 1003.1 standard const struct
++   dirent **. */
++#undef SCANDIR_COMPAR_USES_CONST_VOID_POINTER
++
+ /* Define to 1 if you have the ANSI C header files. */
+ #undef STDC_HEADERS
+ 
diff -r 940d2ad5578e -r ec667b505e86 textproc/pdfgrep/patches/patch-src_cache.cc_configure
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/pdfgrep/patches/patch-src_cache.cc_configure     Fri Sep 15 22:18:00 2017 +0000
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_cache.cc_configure,v 1.1 2017/09/15 22:18:00 ast Exp $
+
+* Compile with pre-2016/12/16 v1.36 dirent.h on NetBSD
+
+--- configure.orig     2017-03-06 10:29:52.000000000 +0100
++++ configure  2017-09-15 23:49:38.676008878 +0200
+@@ -621,6 +621,7 @@
+ # include <unistd.h>
+ #endif"
+ 
++ac_c_werror_flag=
+ ac_subst_vars='am__EXEEXT_FALSE
+ am__EXEEXT_TRUE
+ LTLIBOBJS
+@@ -5066,6 +5067,51 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
+ 
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if scandir's compar() expects const void * pointers" >&5
++$as_echo_n "checking if scandir's compar() expects const void * pointers... " >&6; }
++
++ac_c_werror_flag=yes
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <dirent.h>
++int
++main ()
++{
++
++    const char *dirname;
++    struct dirent ***namelist;
++    int (*f_select)(const struct dirent *);
++    int (*f_compar)(const void *, const void *);
++    scandir(dirname, namelist, f_select, f_compar);
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++cat >>confdefs.h <<_ACEOF
++#define SCANDIR_COMPAR_USES_CONST_VOID_POINTER 1
++_ACEOF
++
++
++else
++
++     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++cat >>confdefs.h <<_ACEOF
++#define SCANDIR_COMPAR_USES_CONST_VOID_POINTER 0
++_ACEOF
++
++
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
+ 
+ 
+ 
diff -r 940d2ad5578e -r ec667b505e86 textproc/pdfgrep/patches/patch-src_cache.cc_configure.ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/pdfgrep/patches/patch-src_cache.cc_configure.ac  Fri Sep 15 22:18:00 2017 +0000
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_cache.cc_configure.ac,v 1.1 2017/09/15 22:18:00 ast Exp $
+
+* Compile with pre-2016/12/16 v1.36 dirent.h on NetBSD
+
+--- configure.ac.orig  2017-03-06 10:29:41.000000000 +0100
++++ configure.ac       2017-09-15 23:47:38.595038637 +0200
+@@ -45,6 +45,27 @@
+ Please install pkg-config and re-run autoconf.])
+ ])
+ 
++dnl Check scandir prototype in dirent.h (NetBSD pre-2016/12/16 v1.36)
++AC_MSG_CHECKING([if scandir's compar() expects const void * pointers])
++AC_LANG_WERROR
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dirent.h>]],
++  [[
++    const char *dirname;
++    struct dirent ***namelist;
++    int (*f_select)(const struct dirent *);
++    int (*f_compar)(const void *, const void *);
++    scandir(dirname, namelist, f_select, f_compar);
++  ]])],
++   [
++     AC_MSG_RESULT([yes])
++     AC_DEFINE_UNQUOTED([SCANDIR_COMPAR_USES_CONST_VOID_POINTER], 1, [Define to 1 if you have to use const void * with scandir's compar() function, to 0 if you are using the IEEE Std 1003.1 
standard const struct dirent **.])
++   ],
++   [
++     AC_MSG_RESULT([no])
++     AC_DEFINE_UNQUOTED([SCANDIR_COMPAR_USES_CONST_VOID_POINTER], 0, [Define to 1 if you have to use const void * with scandir's compar() function, to 0 if you are using the IEEE Std 1003.1 
standard const struct dirent **.])
++   ]
++)
++
+ dnl Poppler checking
+ PKG_CHECK_MODULES(poppler_cpp, poppler-cpp)
+ AC_SUBST(poppler_cpp_CFLAGS)



Home | Main Index | Thread Index | Old Index