Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2003 18:45:24 +0300
From:      "Samy Al Bahra" <samy@kerneled.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/59488: Fix math/xplot build on FreeBSD 5.X
Message-ID:  1069256711@beastie.freebsd.local
Resent-Message-ID: <200311192240.hAJMeGUJ017235@freefall.freebsd.org>

| raw e-mail | index | archive | help

>Number:         59488
>Category:       ports
>Synopsis:       Fix math/xplot build on FreeBSD 5.X
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 19 14:40:15 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Samy Al Bahra
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Kerneled 
>Environment:


System: FreeBSD beastie.freebsd.local 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Wed Aug 20 18:35:24 AST 2003     samy@beastie.freebsd.local:/usr/src/sys/i386/compile/KERNELED i386  


>Description:


math/xplot does not build on 5.X
machines because it uses multistring
literals which are depreciated in gcc
3.X. The following patch fixes this.


>How-To-Repeat:


Build with gcc 3.X.


>Fix:


diff -ruN xplot/Makefile /home/samy/tmp/xplot/Makefile
--- xplot/Makefile	Thu Oct 16 01:23:25 2003
+++ /home/samy/tmp/xplot/Makefile	Wed Nov 19 18:36:57 2003
@@ -19,12 +19,6 @@
 
 XPLOT_DEMOS=	demo.0 demo.1 demo.2 demo.3 demo.4 demo.5 demo.6 demo.7
 
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 501000
-BROKEN=		"Does not compile"
-.endif
-
 post-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/tcpdump2xplot.pl ${PREFIX}/bin
 .if !defined(NOPORTDOCS)
@@ -37,4 +31,4 @@
 	${INSTALL_DATA} ${WRKSRC}/${i} ${PREFIX}/share/examples/xplot
 .endfor
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -ruN xplot/files/patch-ab /home/samy/tmp/xplot/files/patch-ab
--- xplot/files/patch-ab	Thu Sep  9 03:33:11 1999
+++ /home/samy/tmp/xplot/files/patch-ab	Wed Nov 19 18:36:27 2003
@@ -1,5 +1,5 @@
---- xplot.c.orig	Wed Jul  2 13:26:09 1997
-+++ xplot.c	Sat Aug  1 00:12:42 1998
+--- xplot.c.orig	Wed Nov 19 18:35:43 2003
++++ xplot.c	Wed Nov 19 18:35:42 2003
 @@ -46,7 +46,7 @@
  #include <X11/cursorfont.h>
  #include <math.h>
@@ -33,7 +33,11 @@
        d_i[d].clr_map = DefaultColormap(pl->dpy, DefaultScreen(pl->dpy));
        
 -      if ( option_mono ||
--
++      if ( option_mono ) {
++	usewhite = 1;
++      } else {
++	usewhite = 0;
+ 
 -	   ! XAllocColorCells(pl->dpy, 
 -			      d_i[d].clr_map, 0,
 -			      &d_i[d].line_plane_mask, 1,
@@ -56,11 +60,6 @@
 -	    d_i[d].clr.pixel |= d_i[d].line_plane_mask;
 -	    XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr);
 -	    d_i[d].Colors[i] = d_i[d].clr.pixel;
-+      if ( option_mono ) {
-+	usewhite = 1;
-+      } else {
-+	usewhite = 0;
-+
 +	for (i = 0; i < NColors; i++)  {
 +	  XColor alloc, exact;
 +
@@ -72,12 +71,12 @@
 +	    break;
  	  }
 +	  d_i[d].Colors[i] = alloc.pixel;
-+	}
+ 	}
 +      }
 +      if ( usewhite ) {
 +	for ( i = 0; i < NColors; i++) {
 +	  d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen);
- 	}
++	}
 +      }
      }
      
@@ -94,3 +93,297 @@
    /* Bracket the PS program with gsave/grestore so these page descriptions
       can be concatenated, then printed. */
    fputs("%%BoundingBox: ", fp);
+@@ -3168,146 +3161,146 @@
+   fputs("gsave\n", fp);
+ 
+   /* Set up scale */
+-  fputs("
+-%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def
+-
+-%matrix currentmatrix
+-%aload pop
+-%6 2 roll sign
+-%6 1 roll sign
+-%6 1 roll sign
+-%6 1 roll sign
+-%6 1 roll
+-%matrix astore setmatrix
+-
+-0.12 dup scale
+-
++  fputs("\n\
++%/sign { dup 0 gt { pop 1 } { 0 lt { -1 } { 0 } ifelse } ifelse } def\n\
++\n\
++%matrix currentmatrix\n\
++%aload pop\n\
++%6 2 roll sign\n\
++%6 1 roll sign\n\
++%6 1 roll sign\n\
++%6 1 roll sign\n\
++%6 1 roll\n\
++%matrix astore setmatrix\n\
++\n\
++0.12 dup scale\n\
++\n\
+ ", fp);
+ 
+   fprintf(fp, "/theta {%d mul} def\n", ( (state == PRINTING) ? 4 : 2));
+ 
+   /* Set up units of measurement. */
+   fprintf(fp, "/inch {%d mul} def\n", PER_INCH);
+-  fputs("/pt {inch 72 div} def
+-%
+-%
+-/tfont /Times-Bold findfont 12 pt scalefont def
+-%
+-/lfont /Times-Roman findfont 10 pt scalefont def
+-%
+-%tfont /FontBBox get
+-%  aload pop 
+-%  tfont /FontMatrix get dtransform pop /tascent exch def
+-%  tfont /FontMatrix get dtransform pop neg /tdescent exch def
+-lfont /FontBBox get
+-  aload pop 
+-  lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def
+-  lfont /FontMatrix get dtransform pop neg /ldescent exch def
+-% begin gdt mod
+-% define font for xplot characters
+-/BuildCharDict 10 dict def
+-/Xplotfontdict 7 dict def
+-Xplotfontdict begin
+-  /FontType 3 def
+-  /FontMatrix [1 0 0 1 0 0] def
+-  /FontBBox [-1 -1 1 1]def
+-  /Encoding 256 array def
+-  0 1 255 {Encoding exch /.notdef put} for
+-  Encoding (.) 0 get /xplotfontdot put
+-  /CharacterDefs 3 dict def
+-  CharacterDefs /.notdef {} put
+-  CharacterDefs /xplotfontdot
+-    { newpath
+-	0 0 1 0 360 arc fill
+-    } put
+-  /BuildChar
+-    { BuildCharDict begin
+-	/char exch def
+-	/fontdict exch def
+-	/charname fontdict /Encoding get
+-	char get def
+-	/charproc fontdict /CharacterDefs
+-        get charname get def
+-	1 0 -1 -1 1 1 setcachedevice
+-	gsave charproc grestore
+-      end
+-    } def
+-end
+-/XplotFont Xplotfontdict definefont pop
+-% scale font according to theta
+-/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def
+-% DONE gdt mod
+-%define procedures for each xplot primitive.
+-% x y x --
+-/x {moveto 8 8 rlineto -16 -16 rlineto
+-    8 8 rmoveto
+-    -8 8 rlineto 16 -16 rlineto} def
+-% x y + --
+-/+ {moveto 0 8 rlineto 0 -16 rlineto
+-    0 8 rmoveto
+-    -8 0 rlineto 16 0 rlineto} def
+-% x y ?arrow --
+-/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto
+-         -8 theta 8 theta rlineto } def
+-/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto
+-         8 theta -8 theta rlineto } def
+-/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto
+-         -8 theta -8 theta rlineto } def
+-/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto
+-         8 theta -8 theta rlineto } def
+-%x y x y line --
+-/line {moveto lineto} def
+-%x y dot --
+-% begin gdt mod
+-/dot { moveto dotfont setfont (.) show } def
+-%/dot {stroke 8 theta 0 360 arc fill} def
+-% end gdt mod
+-%x y plus --
+-/plus {moveto -16 theta 0 rmoveto 16 theta 0 rlineto 
+-       -16 theta -16 theta rmoveto 0 16 theta rlineto} def
+-%x y box --
+-/box {moveto -8 theta -8 theta rmoveto
+-      16 theta 0 rlineto 
+-      0 16 theta rlineto
+-      -16 theta 0 rlineto
+-      0 -16 theta rlineto} def
+-%x y diamond --
+-/diamond { moveto 0 theta 24 theta rmoveto
+-           -24 theta -24 theta rlineto
+-            24 theta -24 theta rlineto
+-            24 theta  24 theta rlineto
+-           -24 theta  24 theta rlineto} def
+-%x y ?tick --
+-/utick {moveto 0 6 theta rlineto} def
+-/dtick {moveto 0 -6 theta rlineto} def
+-/ltick {moveto -6 theta 0 rlineto} def
+-/rtick {moveto 6 theta 0 rlineto} def
+-/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def
+-/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def
+-%Separate functions for each text position.
+-%x y string ?text --
+-/space 6 pt def
+-% Set the font, figure out the width.
+-% x y string tsetup string x width y
+-/tsetup {lfont setfont dup stringwidth pop exch
+-         4 1 roll exch} def
+-%CENTER
+-/ctext {tsetup lascent 2 div sub
+-        3 1 roll 2 div sub exch
+-% stack should now be string x y
+-        moveto show} def
+-%ABOVE
+-/atext {tsetup space ldescent add add
+-        3 1 roll 2 div sub exch moveto show} def
+-%BELOW
+-/btext {tsetup space lascent add sub
+-        3 1 roll 2 div sub exch moveto show} def
+-%TO_THE_LEFT
+-/ltext {tsetup lascent 2 div sub
+-        3 1 roll space add sub exch moveto show} def
+-%TO_THE_RIGHT
+-/rtext {tsetup lascent 2 div sub
+-        3 1 roll pop space add exch moveto show} def
++  fputs("/pt {inch 72 div} def\n\
++%\n\
++%\n\
++/tfont /Times-Bold findfont 12 pt scalefont def\n\
++%\n\
++/lfont /Times-Roman findfont 10 pt scalefont def\n\
++%\n\
++%tfont /FontBBox get\n\
++%  aload pop\n\
++%  tfont /FontMatrix get dtransform pop /tascent exch def\n\
++%  tfont /FontMatrix get dtransform pop neg /tdescent exch def\n\
++lfont /FontBBox get\n\
++  aload pop\n\
++  lfont /FontMatrix get dtransform pop 0.65 mul /lascent exch def\n\
++  lfont /FontMatrix get dtransform pop neg /ldescent exch def\n\
++% begin gdt mod\n\
++% define font for xplot characters\n\
++/BuildCharDict 10 dict def\n\
++/Xplotfontdict 7 dict def\n\
++Xplotfontdict begin\n\
++  /FontType 3 def\n\
++  /FontMatrix [1 0 0 1 0 0] def\n\
++  /FontBBox [-1 -1 1 1]def\n\
++  /Encoding 256 array def\n\
++  0 1 255 {Encoding exch /.notdef put} for\n\
++  Encoding (.) 0 get /xplotfontdot put\n\
++  /CharacterDefs 3 dict def\n\
++  CharacterDefs /.notdef {} put\n\
++  CharacterDefs /xplotfontdot\n\
++    { newpath\n\
++	0 0 1 0 360 arc fill\n\
++    } put\n\
++  /BuildChar\n\
++    { BuildCharDict begin\n\
++	/char exch def\n\
++	/fontdict exch def\n\
++	/charname fontdict /Encoding get\n\
++	char get def\n\
++	/charproc fontdict /CharacterDefs\n\
++        get charname get def\n\
++	1 0 -1 -1 1 1 setcachedevice\n\
++	gsave charproc grestore\n\
++      end\n\
++    } defn\n\
++end\n\
++/XplotFont Xplotfontdict definefont pop\n\
++% scale font according to theta\n\
++/dotsetup { /dotfont /XplotFont findfont 4 theta scalefont def } def\n\
++% DONE gdt mod\n\
++%define procedures for each xplot primitive.\n\
++% x y x --\n\
++/x {moveto 8 8 rlineto -16 -16 rlineto\n\
++    8 8 rmoveto\n\
++    -8 8 rlineto 16 -16 rlineto} def\n\
++% x y + --\n\
++/+ {moveto 0 8 rlineto 0 -16 rlineto\n\
++    0 8 rmoveto\n\
++    -8 0 rlineto 16 0 rlineto} def\n\
++% x y ?arrow --\n\
++/darrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto\n\
++         -8 theta 8 theta rlineto } def\n\
++/uarrow {moveto -8 theta -8 theta rmoveto 8 theta 8 theta rlineto\n\
++         8 theta -8 theta rlineto } def\n\
++/rarrow {moveto -8 theta 8 theta rmoveto 8 theta -8 theta rlineto\n\
++         -8 theta -8 theta rlineto } def\n\
++/larrow {moveto 8 theta 8 theta rmoveto -8 theta -8 theta rlineto\n\
++         8 theta -8 theta rlineto } def\n\
++%x y x y line --\n\
++/line {moveto lineto} def\n\
++%x y dot --\n\
++% begin gdt mod\n\
++/dot { moveto dotfont setfont (.) show } def\n\
++%/dot {stroke 8 theta 0 360 arc fill} def\n\
++% end gdt mod\n\
++%x y plus --\n\
++/plus {moveto -16 theta 0 rmoveto 16 theta 0 rlineto\n\
++       -16 theta -16 theta rmoveto 0 16 theta rlineto} def\n\
++%x y box --\n\
++/box {moveto -8 theta -8 theta rmoveto\n\
++      16 theta 0 rlineto\n\
++      0 16 theta rlineto\n\
++      -16 theta 0 rlineto\n\
++      0 -16 theta rlineto} def\n\
++%x y diamond --\n\
++/diamond { moveto 0 theta 24 theta rmoveto\n\
++           -24 theta -24 theta rlineto\n\
++            24 theta -24 theta rlineto\n\
++            24 theta  24 theta rlineto\n\
++           -24 theta  24 theta rlineto} def\n\
++%x y ?tick --\n\
++/utick {moveto 0 6 theta rlineto} def\n\
++/dtick {moveto 0 -6 theta rlineto} def\n\
++/ltick {moveto -6 theta 0 rlineto} def\n\
++/rtick {moveto 6 theta 0 rlineto} def\n\
++/htick {moveto -6 theta 0 rmoveto 12 theta 0 rlineto} def\n\
++/vtick {moveto 0 -6 theta rmoveto 0 12 theta rlineto} def\n\
++%Separate functions for each text position.\n\
++%x y string ?text --\n\
++/space 6 pt def\n\
++% Set the font, figure out the width.\n\
++% x y string tsetup string x width y\n\
++/tsetup {lfont setfont dup stringwidth pop exch\n\
++         4 1 roll exch} def\n\
++%CENTER\n\
++/ctext {tsetup lascent 2 div sub\n\
++        3 1 roll 2 div sub exch\n\
++% stack should now be string x y\n\
++        moveto show} def\n\
++%ABOVE\n\
++/atext {tsetup space ldescent add add\n\
++        3 1 roll 2 div sub exch moveto show} def\n\
++%BELOW\n\
++/btext {tsetup space lascent add sub\n\
++        3 1 roll 2 div sub exch moveto show} def\n\
++%TO_THE_LEFT\n\
++/ltext {tsetup lascent 2 div sub\n\
++        3 1 roll space add sub exch moveto show} def\n\
++%TO_THE_RIGHT\n\
++/rtext {tsetup lascent 2 div sub\n\
++        3 1 roll pop space add exch moveto show} def\n\
+ ", fp);
+ 
+   {
+@@ -3354,9 +3347,9 @@
+   if (state == PRINTING) {
+     fputs("-90 rotate -11 inch 0 inch translate\n", fp);
+   } else {
+-    fputs("
+-/notintex { currentdict userdict eq } def
+-notintex { 1.5 inch 5.0 inch translate } if
++    fputs("\n\
++/notintex { currentdict userdict eq } def\n\
++notintex { 1.5 inch 5.0 inch translate } if\n\
+ ", fp);
+   }
+   /* Move origin to create left & bottom margins. */



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1069256711>