pkubowicz / opendetex

Improved version of Detex - tool for extracting plain text from TeX and LaTeX sources
Other
236 stars 35 forks source link

TLpatches #48

Closed aminophen closed 5 years ago

aminophen commented 5 years ago

Hi,

This is TeX Live team. For TL2019, we are planning to include your opendetex as an update to detex. Currently we have two patches specific for TL: https://github.com/TeX-Live/texlive-source/tree/trunk/texk/detex/TLpatches Could you review these patches and apply them here? Thanks, -- hironobu

pkubowicz commented 5 years ago

@aminophen patch-04 breaks the build on my local Kubuntu:

cc -O -DVERSION=\"2.8.5-SNAPSHOT\"  -Wall   -c -o detex.o detex.c
detex.c:72: warning: "PATH_MAX" redefined
 #define PATH_MAX MAXPATHLEN

In file included from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:194,
                 from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed/limits.h:34,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from detex.c:70:
/usr/include/linux/limits.h:13: note: this is the location of the previous definition
 #define PATH_MAX        4096 /* # chars in a path name including nul */

In file included from detex.c:70:
/usr/include/x86_64-linux-gnu/bits/stdlib.h: In function ‘realpath’:
detex.c:72:18: error: ‘PATH_MAX’ undeclared (first use in this function)
 #define PATH_MAX MAXPATHLEN
                  ^~~~~~~~~~

I applied patch 13.

aminophen commented 5 years ago

@pkubowicz Thanks for your comments.

patch-04 breaks the build on my local Ubuntu:

I see. Then, how about this instead?

diff --git a/texk/detex/detex-src/detex.l b/texk/detex/detex-src/detex.l
index 6213342..3d12069 100644
--- a/texk/detex/detex-src/detex.l
+++ b/texk/detex/detex-src/detex.l
@@ -70,10 +70,16 @@
 #include <strings.h>
 #define        strrchr rindex
 #endif
-#ifndef MAXPATHLEN
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#else
 #include <sys/param.h>
-#endif
+#ifndef PATH_MAX /* for old BSD */
 #define PATH_MAX MAXPATHLEN
+#endif
+#endif
+
 #ifdef OS2
 #include <stdlib.h>
 #endif

I applied patch 13.

;-) Thanks.

pkubowicz commented 5 years ago

Applied patch-04 as well. Thank you.