Ticket #33596: gnuplot4_6_0-v2.diff

File gnuplot4_6_0-v2.diff, 15.9 KB (added by mojca (Mojca Miklavec), 12 years ago)

Last version of the patch to upgrade gnuplot to 4.6.0 (almost the same as gnuplot4_6_0-v2-cocoa.diff)

  • Portfile

    diff --git a/Portfile b/Portfile
    index f5292ef..d9b2427 100644
    a b PortSystem 1.0 
    55PortGroup                   xcodeversion 1.0
    66
    77name                        gnuplot
    8 version                     4.4.4
     8version                     4.6.0
    99categories                  math science
    1010# the license has some inconvenient requirements that we're not meeting
    1111# to be allowed to distribute binaries
    dist_subdir ${name}/${version} 
    3131distfiles-append            ${name}.pdf
    3232extract.only                ${distname}.tar.gz
    3333checksums                   ${distname}.tar.gz \
    34                             rmd160  7e1d039c05c46fa38b53a3c4afbd328509da901d \
    35                             sha256  d228599d08d5f87bcb79af8af8bb432c77d942802b1643f920c7baaeaf1ddbfd \
     34                            rmd160  2c06500f45fb81850b45713a2cd0e38f0021b065 \
     35                            sha256  6e60adb5039a3541f407c2ade670004178b376754c424c13f0be24c7960c17be \
    3636                            ${name}.pdf \
    37                             rmd160  f8bd424418bbf87e405c0f3d7eb2bf759c4770d5 \
    38                             sha256  3495b65604239d78cdad5ac3b34864572382c09ddf8ea202bddafce9133a1adf
     37                            rmd160  374614145a7b78e263b0cfbb695eb22d07dede9a \
     38                            sha256  57bd4d88e1321968ba06f29dfa322b4cd9e6beb4e0f42e1a4775d9c9a41af170
    3939
    4040depends_lib                 port:expat \
    4141                            port:fontconfig \
    depends_lib port:expat \ 
    4949                            port:xpm \
    5050                            port:zlib
    5151
    52 patchfiles                  patch-src-variable_c.diff
     52patchfiles                  patch-src-variable_c.diff \
     53                            patch-upstream-compilerwarnings.diff \
     54                            patch-upstream-wxt-scroll.diff \
     55                            patch-upstream-qt.diff \
     56                            patch-configure-qt.diff
     57
     58# upstream patches:
     59#
     60# - patch-upstream-compilerwarnings.diff
     61#   2012-03-18 17:30:42 Hans-Bernhard Broeker (cvs commit:broeker)
     62# - patch-upstream-wxt-scroll.diff
     63#   2012-02-29 19:29:25 Mojca Miklavec (cvs commit:sfeam)
     64# - patch-upstream-qt.diff
     65#   2012-04-01 08:49:45 Jérôme Lodewyck (cvs commit:lodewyck)
    5366
    5467platform darwin {
    5568    depends_lib-append      port:aquaterm
    56     configure.cflags-append -DDEFAULTTERM='"aqua"'
    5769}
    5870
    5971minimum_xcodeversions       {9 3.1}
    variant no_x11 { 
    8193    configure.args-append   --without-x
    8294}
    8395
    84 variant wxwidgets description "Enable wxWidgets front-end" {
    85     depends_lib-append      port:wxWidgets
     96variant luaterm description "Enable lua-based terminals" {
     97    depends_lib-append      port:lua
     98    configure.args-delete   --without-lua
     99    configure.args-append   --with-lua
     100}
     101
     102variant pangocairo description "Enable cairo-based terminals" {
     103    depends_lib-append      path:lib/pkgconfig/pango.pc:pango
     104    configure.args-delete   --without-cairo
     105}
     106
     107# One can in principle choose between wxWidgets and wxWidgets-devel,
     108# but only 2.9 allows building 64-bit binaries.
     109# If it is acceptable to depend on wxWidgets-devel only,
     110# one could delete the variant that depends on wxWidgets 2.8.
     111variant wxwidgets conflicts wxwidgets_devel description "Enable wxt terminal (wxWidgets 2.8, 32-bit only)" {
     112    depends_lib-append      port:wxWidgets path:lib/pkgconfig/pango.pc:pango
    86113    configure.args-delete   --disable-wxwidgets
    87114    configure.args-append   --with-wx-config=${prefix}/bin/wx-config
    88115}
    if {[variant_isset wxwidgets]} { 
    92119    supported_archs         i386 ppc
    93120}
    94121
    95 variant luaterm description "Enable Lua terminal" {
    96     depends_lib-append      port:lua
    97     configure.args-delete   --without-lua
    98     configure.args-append   --with-lua
     122variant wxwidgets_devel conflicts wxwidgets description "Enable wxt terminal (using wxWidgets 2.9, supports 64-bit)" {
     123    depends_lib-append      port:wxWidgets-devel path:lib/pkgconfig/pango.pc:pango
     124    configure.args-delete   --disable-wxwidgets
     125    configure.args-append   --with-wx-config=${prefix}/bin/wx-config
     126}
     127if {[variant_isset wxwidgets_devel]} {
     128    # http://trac.wxwidgets.org/ticket/13565
     129    if {${configure.compiler} == "clang"} {
     130        configure.compiler llvm-gcc-4.2
     131    }
    99132}
    100133
    101 variant pangocairo description "Enable cairo-based terminals" {
    102     depends_lib-append      path:lib/pkgconfig/pango.pc:pango
    103     configure.args-delete   --without-cairo
     134variant qt description "Enable qt terminal" {
     135    depends_lib-append      port:qt4-mac
     136    configure.args-append   --enable-qt
    104137}
    105138
    106139variant tutorial description "Build the tutorial (requires a tex install)" {
  • new file files/patch-configure-qt.diff

    diff --git a/files/patch-configure-qt.diff b/files/patch-configure-qt.diff
    new file mode 100644
    index 0000000..0f92580
    - +  
     1--- configure.orig
     2+++ configure
     3@@ -7828,7 +7828,7 @@ else
     4        char b[false == 0 ? 1 : -1];
     5        char c[__bool_true_false_are_defined == 1 ? 1 : -1];
     6        char d[(bool) 0.5 == true ? 1 : -1];
     7-       bool e = &s;
     8+       /* See body of main program for 'e'.  */
     9        char f[(_Bool) 0.0 == false ? 1 : -1];
     10        char g[true];
     11        char h[sizeof (_Bool)];
     12@@ -7839,25 +7839,6 @@ else
     13        _Bool n[m];
     14        char o[sizeof n == m * sizeof n[0] ? 1 : -1];
     15        char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
     16-#      if defined __xlc__ || defined __GNUC__
     17-        /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
     18-           reported by James Lemley on 2005-10-05; see
     19-           http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
     20-           This test is not quite right, since xlc is allowed to
     21-           reject this program, as the initializer for xlcbug is
     22-           not one of the forms that C requires support for.
     23-           However, doing the test right would require a runtime
     24-           test, and that would make cross-compilation harder.
     25-           Let us hope that IBM fixes the xlc bug, and also adds
     26-           support for this kind of constant expression.  In the
     27-           meantime, this test will reject xlc, which is OK, since
     28-           our stdbool.h substitute should suffice.  We also test
     29-           this with GCC, where it should work, to detect more
     30-           quickly whether someone messes up the test in the
     31-           future.  */
     32-        char digs[] = "0123456789";
     33-        int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
     34-#      endif
     35        /* Catch a bug in an HP-UX C compiler.  See
     36           http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
     37           http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
     38@@ -7869,6 +7850,7 @@ int
     39 main ()
     40 {
     41 
     42+       bool e = &s;
     43        *pq |= q;
     44        *pq |= ! q;
     45        /* Refer to every declared value, to avoid compiler optimizations.  */
     46@@ -13010,7 +12992,7 @@ fi
     47   CXXFLAGS="$CXXFLAGS $QT_CXXFLAGS"
     48 
     49     if test "$is_apple" = yes; then
     50-    CXXFLAGS="$CXXFLAGS -ObjC"
     51+    LIBS="$LIBS -framework Carbon"
     52   fi
     53 
     54   QT4LOC=`$PKG_CONFIG --variable=exec_prefix QtCore`
     55--- configure.in.orig
     56+++ configure.in
     57@@ -1146,7 +1146,7 @@ if test "${enable_qt_ok}" = yes ; then
     58 
     59   dnl Compile Objective C Cocoa headers on Mac to hide the gnuplot icon from the dock
     60   if test "$is_apple" = yes; then
     61-    CXXFLAGS="$CXXFLAGS -ObjC"
     62+    LIBS="$LIBS -framework Carbon"
     63   fi
     64 
     65   QT4LOC=`$PKG_CONFIG --variable=exec_prefix QtCore`
     66--- src/qtterminal/qt_term.cpp.orig
     67+++ src/qtterminal/qt_term.cpp
     68@@ -46,7 +46,7 @@
     69 #include <QtNetwork>
     70 
     71 #ifdef Q_WS_MAC
     72-       #include <Cocoa/Cocoa.h>
     73+       #include <Carbon/Carbon.h>
     74 #endif
     75 
     76 extern "C" {
     77@@ -308,10 +308,15 @@ void qt_init()
     78        QApplication* application = new QApplication(argc, (char**)( NULL));
     79 
     80 #ifdef Q_WS_MAC
     81-       // Don't display this application in the MAC OS X dock
     82-       ProcessSerialNumber psn;
     83-       if (GetCurrentProcess(&psn) == noErr)
     84-               TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
     85+       #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
     86+               #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     87+                       // Don't display this application in the MAC OS X dock
     88+                       // kProcessTransformToBackgroundApplication only works on Mac OS X 10.7 and later
     89+                       ProcessSerialNumber psn;
     90+                       if (GetCurrentProcess(&psn) == noErr)
     91+                               TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
     92+               #endif
     93+       #endif
     94 #endif
     95 
     96        // The creation of a QApplication mangled our locale settings
  • files/patch-src-variable_c.diff

    diff --git a/files/patch-src-variable_c.diff b/files/patch-src-variable_c.diff
    index eb2abce..95eae92 100644
    a b  
    1 --- src/variable.c.orig 2010-10-18 15:41:53.000000000 +0200
    2 +++ src/variable.c      2010-10-18 15:42:11.000000000 +0200
    3 @@ -244,13 +244,13 @@
     1--- src/variable.c.orig
     2+++ src/variable.c
     3@@ -250,13 +250,13 @@
    44 };
    55 #endif
    66 
  • new file files/patch-upstream-compilerwarnings.diff

    diff --git a/files/patch-upstream-compilerwarnings.diff b/files/patch-upstream-compilerwarnings.diff
    new file mode 100644
    index 0000000..03b8163
    - +  
     1--- src/color.c.orig
     2+++ src/color.c
     3@@ -515,7 +515,7 @@ cbtick_callback(
     4            if (axis_array[axis].manual_justify)
     5                just = axis_array[axis].label.pos;
     6            write_multiline(x2+offsetx, y3+offsety, text,
     7-                           just, CENTRE, hrotate,
     8+                           just, JUST_CENTRE, hrotate,
     9                            axis_array[axis].ticdef.font);
     10            if (hrotate)
     11                (*term->text_angle)(0);
     12@@ -526,7 +526,7 @@ cbtick_callback(
     13            if (axis_array[axis].manual_justify)
     14                just = axis_array[axis].label.pos;         
     15            write_multiline(x3+offsetx, y2+offsety, text,
     16-                           just, CENTRE, 0.0,
     17+                           just, JUST_CENTRE, 0.0,
     18                            axis_array[axis].ticdef.font);
     19        }
     20        term_apply_lp_properties(&border_lp);   /* border linetype */
     21--- src/gplt_x11.c.orig
     22+++ src/gplt_x11.c
     23@@ -2897,22 +2897,22 @@ exec_cmd(plot_struct *plot, char *command)
     24 
     25                    case PseudoColor:
     26                        fprintf(stderr, ERROR_NOTICE("PseudoColor"));
     27-                       fprintf(stderr, display_error_text_after);
     28+                       fprintf(stderr, "%s", display_error_text_after);
     29                        break;
     30 
     31                    case GrayScale:
     32                        fprintf(stderr, ERROR_NOTICE("GrayScale"));
     33-                       fprintf(stderr, display_error_text_after);
     34+                       fprintf(stderr, "%s", display_error_text_after);
     35                        break;
     36 
     37                    case StaticColor:
     38                        fprintf(stderr, ERROR_NOTICE("StaticColor"));
     39-                       fprintf(stderr, display_error_text_after);
     40+                       fprintf(stderr, "%s", display_error_text_after);
     41                        break;
     42 
     43                    case StaticGray:
     44                        fprintf(stderr, ERROR_NOTICE("StaticGray"));
     45-                       fprintf(stderr, display_error_text_after);
     46+                       fprintf(stderr, "%s", display_error_text_after);
     47                        break;
     48 
     49                    case DirectColor:
     50--- src/graphics.c.orig
     51+++ src/graphics.c
     52@@ -1734,7 +1734,7 @@ do_plot(struct curve_points *plots, int pcount)
     53        ignore_enhanced(axis_array[FIRST_X_AXIS].label.noenhanced);
     54        apply_pm3dcolor(&(axis_array[FIRST_X_AXIS].label.textcolor), t);
     55        write_multiline(x, y, axis_array[FIRST_X_AXIS].label.text,
     56-                       JUST_CENTRE, JUST_TOP, 0,
     57+                       CENTRE, JUST_TOP, 0,
     58                        axis_array[FIRST_X_AXIS].label.font);
     59        reset_textcolor(&(axis_array[FIRST_X_AXIS].label.textcolor), t);
     60        ignore_enhanced(FALSE);
     61--- src/plot2d.c.orig
     62+++ src/plot2d.c
     63@@ -2120,7 +2120,7 @@ eval_plots()
     64 
     65                    if (this_plot->labels == NULL) {
     66                        this_plot->labels = new_text_label(-1);
     67-                       this_plot->labels->pos = JUST_CENTRE;
     68+                       this_plot->labels->pos = CENTRE;
     69                        this_plot->labels->layer = LAYER_PLOTLABELS;
     70                    }
     71                    parse_label_options(this_plot->labels);
     72@@ -2309,7 +2309,7 @@ eval_plots()
     73            if (this_plot->plot_style == LABELPOINTS) {
     74                if (this_plot->labels == NULL) {
     75                    this_plot->labels = new_text_label(-1);
     76-                   this_plot->labels->pos = JUST_CENTRE;
     77+                   this_plot->labels->pos = CENTRE;
     78                    this_plot->labels->layer = LAYER_PLOTLABELS;
     79                }
     80                this_plot->labels->place.scalex =
     81--- src/plot3d.c.orig
     82+++ src/plot3d.c
     83@@ -1555,7 +1555,7 @@ eval_3dplots()
     84                    int stored_token = c_token;
     85                    if (this_plot->labels == NULL) {
     86                        this_plot->labels = new_text_label(-1);
     87-                       this_plot->labels->pos = JUST_CENTRE;
     88+                       this_plot->labels->pos = CENTRE;
     89                        this_plot->labels->layer = LAYER_PLOTLABELS;
     90                    }
     91                    parse_label_options(this_plot->labels);
  • new file files/patch-upstream-qt.diff

    diff --git a/files/patch-upstream-qt.diff b/files/patch-upstream-qt.diff
    new file mode 100644
    index 0000000..573932c
    - +  
     1--- src/qtterminal/QtGnuplotScene.cpp.orig
     2+++ src/qtterminal/QtGnuplotScene.cpp
     3@@ -56,7 +56,7 @@ QtGnuplotScene::QtGnuplotScene(QtGnuplotEventHandler* eventHandler, QObject* par
     4        m_eventHandler = eventHandler;
     5        m_lastModifierMask = 0;
     6        m_textAngle = 0.;
     7-       m_textAlignment == Qt::AlignLeft;
     8+       m_textAlignment = Qt::AlignLeft;
     9        m_currentZ = 1.;
     10        m_currentPointSize = 1.;
     11        m_enhanced = 0;
     12--- src/qtterminal/QtGnuplotWidget.cpp.orig
     13+++ src/qtterminal/QtGnuplotWidget.cpp
     14@@ -169,6 +169,15 @@ void QtGnuplotWidget::resizeEvent(QResizeEvent* event)
     15        QWidget::resizeEvent(event);
     16 }
     17 
     18+QPainter::RenderHints QtGnuplotWidget::renderHints() const
     19+{
     20+       QPainter::RenderHints hint = QPainter::TextAntialiasing;
     21+       if (m_antialias)
     22+               hint |= QPainter::Antialiasing;
     23+
     24+       return hint;
     25+}
     26+
     27 /////////////////////////////////////////////////
     28 // Slots
     29 
     30@@ -178,7 +187,7 @@ QPixmap QtGnuplotWidget::createPixmap()
     31        pixmap.fill();
     32        QPainter painter(&pixmap);
     33        painter.translate(0.5, 0.5);
     34-       painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
     35+       painter.setRenderHints(renderHints());
     36        m_scene->render(&painter);
     37        painter.end();
     38        return pixmap;
     39@@ -195,7 +204,7 @@ void QtGnuplotWidget::print()
     40        if (QPrintDialog(&printer).exec() == QDialog::Accepted)
     41        {
     42                QPainter painter(&printer);
     43-               painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
     44+               painter.setRenderHints(renderHints());
     45                m_scene->render(&painter);
     46        }
     47 }
     48@@ -211,8 +220,10 @@ void QtGnuplotWidget::exportToPdf()
     49        QPrinter printer;
     50        printer.setOutputFormat(QPrinter::PdfFormat);
     51        printer.setOutputFileName(fileName);
     52+       printer.setPaperSize(QSizeF(m_scene->width(), m_scene->height()), QPrinter::Point);
     53+       printer.setPageMargins(0, 0, 0, 0, QPrinter::Point);
     54        QPainter painter(&printer);
     55-       painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
     56+       painter.setRenderHints(renderHints());
     57        m_scene->render(&painter);
     58 }
     59 
     60@@ -266,7 +277,7 @@ void QtGnuplotWidget::loadSettings()
     61 
     62 void QtGnuplotWidget::applySettings()
     63 {
     64-       m_view->setRenderHints(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
     65+       m_view->setRenderHints(renderHints());
     66        m_view->setBackgroundBrush(m_backgroundColor);
     67 }
     68 
     69--- src/qtterminal/QtGnuplotWidget.h.orig
     70+++ src/qtterminal/QtGnuplotWidget.h
     71@@ -47,6 +47,7 @@
     72 #include "QtGnuplotEvent.h"
     73 
     74 #include <QWidget>
     75+#include <QPainter>
     76 
     77 class QtGnuplotScene;
     78 class QGraphicsView;
     79@@ -93,6 +94,7 @@ private:
     80        void loadSettings();
     81        void applySettings();
     82        void saveSettings();
     83+       QPainter::RenderHints renderHints() const;
     84 
     85 private:
     86        int m_id;
  • new file files/patch-upstream-wxt-scroll.diff

    diff --git a/files/patch-upstream-wxt-scroll.diff b/files/patch-upstream-wxt-scroll.diff
    new file mode 100644
    index 0000000..212b4f3
    - +  
     1--- src/wxterminal/wxt_gui.cpp.orig
     2+++ src/wxterminal/wxt_gui.cpp
     3@@ -1003,11 +1003,16 @@ void wxtPanel::OnRightUp( wxMouseEvent& event )
     4 /* mouse wheel event */
     5 void wxtPanel::OnMouseWheel( wxMouseEvent& event )
     6 {
     7-       UpdateModifiers(event);
     8+       int mouse_button;
     9 
     10-       wxt_exec_event(GE_buttonpress, 0, 0,
     11-                       event.GetWheelRotation() > 0 ? 4 : 5,
     12-                       0, this->GetId());
     13+       UpdateModifiers(event);
     14+       mouse_button = (event.GetWheelRotation() > 0 ? 4 : 5);
     15+#if wxCHECK_VERSION(2, 9, 0)
     16+       /* GetWheelAxis: 0 is the Y axis, 1 is the X axis. */
     17+       if (event.GetWheelAxis() > 0)
     18+           mouse_button += 2;
     19+#endif
     20+       wxt_exec_event(GE_buttonpress, 0, 0, mouse_button, 0, this->GetId());
     21 }
     22 
     23 /* the state of the modifiers is checked each time a key is pressed instead of