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

Re: Statically linked ptex also crashes



I tried both 2 options.

> - build your own kpathsea4 library and link it statically, but then
>  apply the attached patch, otherwise it will break

By using the patch, ptex seems to work correctly.
As a workaround I attached another patch to statically link libkpathsea4.

> - make sure that the header files in /usr/include/kpathsea/ are used
>  and not the ones in the package (tetex3), and link dynamically
>  against libkpathsea5, in this case no patch needed.

Removing dependency on c-vararg.h, adding kpathsea/types.h and using
system libtool (which, as a result, appears to fix FTBFS on kfreebsd:
#511433) it seems to work with libkpathsea5 except that some macros
are needed, P[1-3]{C,H}, which are defined in old c-proto.h. Attached
a patch. Note that this also seems to work with new pTeX 3.1.11.

Regards,

-- 
YOSHINO Yoshihito <yy.y.ja.jp@gmail.com>
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/common.mk.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/common.mk.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/common.mk.patch	2009-12-24 22:42:03.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/common.mk.patch	2009-12-24 14:03:18.000000000 +0900
@@ -9,12 +9,3 @@
  
  # You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
  # please don't change ALL_CPPFLAGS or ALL_CFLAGS.
-@@ -54,7 +54,7 @@
- kpathsea_dir = $(kpathsea_parent)/kpathsea
- kpathsea_srcdir_parent = $(top_srcdir)/..
- kpathsea_srcdir = $(kpathsea_srcdir_parent)/kpathsea
--kpathsea = $(kpathsea_dir)/libkpathsea.la
-+kpathsea = -lkpathsea
- 
- @MAINT@ifeq ($(CC), gcc)
- @MAINT@XDEFS = -Wpointer-arith $(warn_more)
diff -urN ptex-bin-3.1.10+0.04b/debian/rules ptex-bin-3.1.10+0.04b.new/debian/rules
--- ptex-bin-3.1.10+0.04b/debian/rules	2009-12-24 22:42:03.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/rules	2009-12-24 20:59:34.000000000 +0900
@@ -49,6 +49,8 @@
 
 	# Apply patch to texk/make/common.mk (to avoid depending on built-in libkpathsea).
 	patch -p0 -d $(TETEX_SRC_DIR)/texk/make < debian/patches/teTeX/common.mk.patch
+	# Apply patch to texk/kpathsea/fontmap.c (to fix loading of fonts in libkpathsea).
+	patch -p3 -d $(TETEX_SRC_DIR) < debian/patches/teTeX/fix-free-error-in-fontmap-lookup.patch
 
 	# Apply patches to pTeX source (should be named as *.patch)
 	# Put patches in debian/patches.
@@ -73,7 +75,7 @@
 	./configure --prefix=/usr --without-dialog --without-texinfo \
 		    --with-system-ncurses --with-x --with-system-zlib \
 		    --with-system-pnglib --disable-multiplatform \
-		    --enable-shared)
+		    --disable-shared)
 	# For web2c
 	(cd $(TETEX_SRC_DIR)/texk/web2c && \
 	CFLAGS="$(CFLAGS)" \
@@ -92,6 +94,10 @@
 	dh_testdir
 
 	# Add here commands to compile the package.
+	# Build kpathsea.
+	(cd $(TETEX_SRC_DIR)/texk/kpathsea && \
+	  make)
+
 	# Build pTeX.
 	(cd $(TETEX_SRC_DIR)/texk/web2c/$(PTEX_SRC_DIR) && \
 	  make programs)
diff -urN ptex-bin-3.1.10+0.04b/debian/control ptex-bin-3.1.10+0.04b.new/debian/control
--- ptex-bin-3.1.10+0.04b/debian/control	2009-12-24 22:42:03.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/control	2009-12-28 20:02:09.000000000 +0900
@@ -2,13 +2,13 @@
 Section: tex
 Priority: optional
 Maintainer: Masayuki Hatta (mhatta) <mhatta@debian.org>
-Build-Depends: debhelper (>> 4.0.0), texlive-base-bin, texlive-extra-utils, texlive-metapost, flex, bison, libkpathsea-dev | libkpathsea4-dev, ptex-base (>= 2.4), ptex-buildsupport (>= 3.0)
+Build-Depends: debhelper (>> 4.0.0), texlive-binaries, texlive-extra-utils, texlive-metapost, flex, bison, libkpathsea-dev, ptex-base (>= 2.4), ptex-buildsupport (>= 3.0), libtool
 Standards-Version: 3.7.3
 
 Package: ptex-bin
 Architecture: any
 Replaces: platex
-Depends: ptex-base (>= 1:2.0-3), texlive-base-bin, texlive-math-extra, ${shlibs:Depends}
+Depends: ptex-base (>= 1:2.0-3), texlive-binaries, texlive-math-extra, ${shlibs:Depends}
 Suggests: dvipsk-ja, jbibtex-bin, jmpost, mendexk
 Conflicts: platex
 Description: The ASCII pTeX binary files
@@ -33,7 +33,7 @@
 
 Package: jmpost
 Architecture: any
-Depends: ${shlibs:Depends}, texlive-base-bin
+Depends: ${shlibs:Depends}, texlive-binaries
 Recommends: ptex-bin, dvipsk-ja
 Description: Japanized MetaPost, a system for drawing pictures
  This is jMetaPost, a Japanized MetaPost based on the original
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/Makefile.in.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/Makefile.in.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/Makefile.in.patch	1970-01-01 09:00:00.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/Makefile.in.patch	2009-12-28 20:02:09.000000000 +0900
@@ -0,0 +1,11 @@
+--- texk/web2c/web2c/Makefile.in.orig	2004-07-11 07:54:28.000000000 +0000
++++ texk/web2c/web2c/Makefile.in	2009-12-28 09:28:33.000000000 +0000
+@@ -37,7 +37,7 @@
+ fixwrites: fixwrites.o kps.o
+ 	$(build_link_command) fixwrites.o kps.o
+ splitup: splitup.o kps.o
+-	$(build_link_command) splitup.o kps.o
++	$(build_link_command) -lkpathsea splitup.o kps.o
+ regfix: regfix.o kps.o
+ 	$(build_link_command) regfix.o kps.o
+ 
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/common.mk.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/common.mk.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/common.mk.patch	2009-12-24 22:42:03.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/common.mk.patch	2009-12-28 20:02:09.000000000 +0900
@@ -1,11 +1,11 @@
---- common.mk.orig	2004-08-07 03:40:50.000000000 +0900
-+++ common.mk	2006-03-04 15:34:06.000000000 +0900
+--- texk/make/common.mk.orig	2004-08-07 03:40:50.000000000 +0900
++++ texk/make/common.mk	2006-03-04 15:34:06.000000000 +0900
 @@ -12,7 +12,7 @@
  LDFLAGS = @LDFLAGS@ $(XLDFLAGS)
  
  # Kpathsea needs this for compiling, programs need it for linking.
 -LIBTOOL = $(SHELL) $(kpathsea_parent)/libtool
-+LIBTOOL = $(SHELL) $(kpathsea_dir)/libtool
++LIBTOOL = /usr/bin/libtool
  
  # You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
  # please don't change ALL_CPPFLAGS or ALL_CFLAGS.
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/config.h.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/config.h.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/config.h.patch	1970-01-01 09:00:00.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/config.h.patch	2009-12-28 20:02:09.000000000 +0900
@@ -0,0 +1,11 @@
+--- texk/web2c/config.h.orig	2004-08-06 19:41:57.000000000 +0000
++++ texk/web2c/config.h	2009-12-28 08:35:18.000000000 +0000
+@@ -33,8 +33,6 @@
+ #include <kpathsea/config.h>
+ #include <web2c/c-auto.h>
+ 
+-#include <kpathsea/c-vararg.h>
+-
+ /* How to open a binary file.  */
+ #include <kpathsea/c-fopen.h>
+ 
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/depend.mk.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/depend.mk.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/depend.mk.patch	1970-01-01 09:00:00.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/depend.mk.patch	2009-12-28 20:02:09.000000000 +0900
@@ -0,0 +1,134 @@
+--- texk/web2c/lib/depend.mk.orig	2005-02-06 18:49:56.000000000 +0000
++++ texk/web2c/lib/depend.mk	2009-12-25 04:36:05.000000000 +0000
+@@ -6,7 +6,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ basechsuffix.o: basechsuffix.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -15,7 +15,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ chartostring.o: chartostring.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -24,7 +24,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ coredump.o: coredump.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -33,7 +33,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ eofeoln.o: eofeoln.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -42,7 +42,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ fprintreal.o: fprintreal.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -51,7 +51,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ input2int.o: input2int.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -60,7 +60,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ inputint.o: inputint.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -69,7 +69,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ main.o: main.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -78,7 +78,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ mfmpw32.o: mfmpw32.c
+ openclose.o: openclose.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -88,7 +88,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
+   $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+   $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/variable.h \
+   $(kpathsea_srcdir)/absolute.h
+@@ -100,7 +100,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ uexit.o: uexit.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -109,7 +109,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ usage.o: usage.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -118,7 +118,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ version.o: version.c ../c-auto.h
+ win32main.o: win32main.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -128,7 +128,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ zround.o: zround.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -137,4 +137,4 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/splitup.c.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/splitup.c.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/splitup.c.patch	1970-01-01 09:00:00.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/splitup.c.patch	2009-12-28 20:02:09.000000000 +0900
@@ -0,0 +1,12 @@
+--- texk/web2c/web2c/splitup.c.orig	2004-07-04 10:55:06.000000000 +0000
++++ texk/web2c/web2c/splitup.c	2009-12-28 09:04:32.000000000 +0000
+@@ -11,7 +11,8 @@
+ #define unlink delete
+ #endif
+ 
+-char *program_invocation_name;
++#include <kpathsea/types.h>
++
+ int filenumber = 0, ifdef_nesting = 0, lines_in_file = 0;
+ char *output_name = NULL;
+ boolean has_ini;
diff -urN ptex-bin-3.1.10+0.04b/debian/patches/teTeX/web2c.depend.mk.patch ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/web2c.depend.mk.patch
--- ptex-bin-3.1.10+0.04b/debian/patches/teTeX/web2c.depend.mk.patch	1970-01-01 09:00:00.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/patches/teTeX/web2c.depend.mk.patch	2009-12-28 20:02:09.000000000 +0900
@@ -0,0 +1,62 @@
+--- texk/web2c/web2c/depend.mk.orig	2005-02-06 18:49:57.000000000 +0000
++++ texk/web2c/web2c/depend.mk	2009-12-28 08:30:39.000000000 +0000
+@@ -6,7 +6,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
+   $(kpathsea_srcdir)/c-pathmx.h
+ kps.o: kps.c web2c.h ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -16,7 +16,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ $(LEX_OUTPUT_ROOT).o: $(LEX_OUTPUT_ROOT).c \
+   web2c.h \
+   ../config.h $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \
+@@ -27,7 +27,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
+   y_tab.h
+ main.o: main.c web2c.h ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -37,7 +37,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
+   y_tab.h
+ regfix.o: regfix.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -47,7 +47,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
+ splitup.o: splitup.c ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+   $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+@@ -56,7 +56,7 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
+   $(kpathsea_srcdir)/getopt.h
+ y_tab.o: y_tab.c web2c.h ../config.h $(kpathsea_srcdir)/config.h \
+   $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+@@ -66,4 +66,4 @@
+   $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+   $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+   $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+-  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h 
++  ../../web2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h 
diff -urN ptex-bin-3.1.10+0.04b/debian/rules ptex-bin-3.1.10+0.04b.new/debian/rules
--- ptex-bin-3.1.10+0.04b/debian/rules	2009-12-24 22:42:03.000000000 +0900
+++ ptex-bin-3.1.10+0.04b.new/debian/rules	2009-12-28 20:02:09.000000000 +0900
@@ -44,11 +44,17 @@
 	dh_testdir
 	# Unpack tarballs.
 	tar xfz $(TETEX_SRC_TARBALL)
+	mkdir $(TETEX_SRC_DIR)/texk/kpathsea_tetex
+	mv $(TETEX_SRC_DIR)/texk/kpathsea/c-proto.h $(TETEX_SRC_DIR)/texk/kpathsea_tetex/
+	rm -rf $(TETEX_SRC_DIR)/texk/kpathsea
+	ln -s /usr/include/kpathsea $(TETEX_SRC_DIR)/texk/kpathsea
 	tar xfz $(PTEX_SRC_TARBALL) -C $(TETEX_SRC_DIR)/texk/web2c
 	tar xfz $(JMPOST_SRC_TARBALL) -C $(TETEX_SRC_DIR)/texk/web2c/$(PTEX_SRC_DIR)
 
-	# Apply patch to texk/make/common.mk (to avoid depending on built-in libkpathsea).
-	patch -p0 -d $(TETEX_SRC_DIR)/texk/make < debian/patches/teTeX/common.mk.patch
+	# Apply patches to teTeX source
+	for f in debian/patches/teTeX/*.patch; do \
+		patch -p0 -d $(TETEX_SRC_DIR) < $$f; \
+	done
 
 	# Apply patches to pTeX source (should be named as *.patch)
 	# Put patches in debian/patches.
@@ -69,11 +75,11 @@
 	# Add here commands to configure the package.
 	# Arguments for configure are identical to tetex-bin package
 	# For kpathsea
-	(cd $(TETEX_SRC_DIR)/texk/kpathsea && \
-	./configure --prefix=/usr --without-dialog --without-texinfo \
-		    --with-system-ncurses --with-x --with-system-zlib \
-		    --with-system-pnglib --disable-multiplatform \
-		    --enable-shared)
+	#(cd $(TETEX_SRC_DIR)/texk/kpathsea && \
+	#./configure --prefix=/usr --without-dialog --without-texinfo \
+	#	    --with-system-ncurses --with-x --with-system-zlib \
+	#	    --with-system-pnglib --disable-multiplatform \
+	#	    --enable-shared)
 	# For web2c
 	(cd $(TETEX_SRC_DIR)/texk/web2c && \
 	CFLAGS="$(CFLAGS)" \
@@ -94,11 +100,11 @@
 	# Add here commands to compile the package.
 	# Build pTeX.
 	(cd $(TETEX_SRC_DIR)/texk/web2c/$(PTEX_SRC_DIR) && \
-	  make programs)
+	  make programs XCPPFLAGS="-DHAVE_PROTOTYPES=1 -include $(CURDIR)/$(TETEX_SRC_DIR)/texk/kpathsea_tetex/c-proto.h")
 
 	# Configure & build Japanized MetaPost.
 	(cd $(TETEX_SRC_DIR)/texk/web2c/$(PTEX_SRC_DIR)/$(JMPOST_SRC_DIR) && \
-	  chmod 755 ./configure && ./configure && make)
+	  chmod 755 ./configure && ./configure && make XCPPFLAGS="-DHAVE_PROTOTYPES=1 -include $(CURDIR)/$(TETEX_SRC_DIR)/texk/kpathsea_tetex/c-proto.h")
 
 	touch build-stamp
 

Reply to: