Ticket #34423: gnuplot-use-aqt-framework-extra-option.patch

File gnuplot-use-aqt-framework-extra-option.patch, 15.3 KB (added by mojca (Mojca Miklavec), 12 years ago)

A patch that also adds +aquaterm option (but does the same otherwise)

  • Portfile

    patchfiles patch-src-variable.c.diff \ 
    5353                            patch-upstream-compilerwarnings.diff \
    5454                            patch-upstream-wxt-scroll.diff \
    5555                            patch-upstream-qt.diff \
    56                             patch-configure-qt.diff
     56                            patch-configure-qt.diff \
     57                            patch-configure-aquaterm.diff
    5758
    5859# upstream patches:
    5960#
    patchfiles patch-src-variable.c.diff \ 
    6465# - patch-upstream-qt.diff
    6566#   2012-04-01 08:49:45 Jérôme Lodewyck (cvs commit:lodewyck)
    6667
    67 platform darwin {
    68     depends_lib-append      port:aquaterm
    69 }
    70 
    7168minimum_xcodeversions       {9 3.1}
    7269
    7370configure.args              --with-readline=${prefix} \
    7471                            --with-gd=${prefix} \
    7572                            --with-pdf=${prefix} \
    7673                            --with-png=${prefix} \
     74                            --without-aquaterm \
    7775                            --with-x \
    7876                            --enable-datastrings \
    7977                            --enable-histograms \
    configure.args --with-readline=${prefix} \ 
    8785
    8886configure.ccache            no
    8987
     88variant aquaterm description "Enable AquaTerm terminal" {
     89    depends_lib-append      port:aquaterm
     90    configure.args-delete   --without-aquaterm
     91    configure.args-append   --with-aquaterm=${frameworks_dir}
     92}
     93
    9094variant no_x11 description "Disable X11 terminal" {
    9195    depends_lib-delete      port:xpm
    9296    configure.args-delete   --with-x
    variant tutorial description "Build the tutorial (requires a tex install)" { 
    136140    configure.args-append   --with-tutorial
    137141}
    138142
    139 default_variants            +luaterm +pangocairo
     143default_variants            +aquaterm +luaterm +pangocairo
    140144
    141145destroot.destdir            prefix=${destroot}${prefix}
    142146
  • new file files/patch-configure-aquaterm.diff

    - +  
     1--- config.hin.orig
     2+++ config.hin
     3@@ -142,7 +142,7 @@
     4 /* Define to 1 if you have the `lgamma' function. */
     5 #undef HAVE_LGAMMA
     6 
     7-/* Define to 1 if you're using the aquaterm library on Mac OS X */
     8+/* Define to 1 if you're using the AquaTerm framework on Mac OS X */
     9 #undef HAVE_LIBAQUATERM
     10 
     11 /* Define to 1 if you have the <libc.h> header file. */
     12--- configure.orig
     13+++ configure
     14@@ -769,6 +769,7 @@ with_texdir
     15 with_kpsexpand
     16 with_x
     17 with_x_app_defaultdir
     18+with_aquaterm
     19 with_lasergnu
     20 with_gihdir
     21 with_linux_vga
     22@@ -1482,6 +1483,7 @@ Optional Packages:
     23   --with-x                use the X Window System
     24   --with-x-app-defaultdir=DIR       location of X11 application defaults
     25                           (default /etc/X11/app-defaults/)
     26+  --without-aquaterm      disable aqua terminal (default --with-aquaterm=/Library/Frameworks)
     27   --with-lasergnu         install lasergnu printer script
     28   --with-gihdir=DIR       location of .gih help text file
     29                           (default PREFIX/share/PACKAGE/VERSION)
     30@@ -7485,8 +7487,8 @@ fi
     31 rm -f conftest*
     32 
     33 
     34-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple MacOS X" >&5
     35-$as_echo_n "checking for Apple MacOS X... " >&6; }
     36+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple Mac OS X" >&5
     37+$as_echo_n "checking for Apple Mac OS X... " >&6; }
     38 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     39 /* end confdefs.h.  */
     40 #if defined(__APPLE__) && defined(__MACH__)
     41@@ -7498,13 +7500,96 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     42   $EGREP "yes" >/dev/null 2>&1; then :
     43    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     44 $as_echo "yes" >&6; }
     45-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aqtInit in -laquaterm" >&5
     46-$as_echo_n "checking for aqtInit in -laquaterm... " >&6; }
     47-if test "${ac_cv_lib_aquaterm_aqtInit+set}" = set; then :
     48+    is_apple=yes
     49+else
     50+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     51+$as_echo "no" >&6; }
     52+    is_apple=no
     53+fi
     54+rm -f conftest*
     55+
     56+
     57+
     58+
     59+if test "$is_apple" = "yes"; then
     60+
     61+# Check whether --with-aquaterm was given.
     62+if test "${with_aquaterm+set}" = set; then :
     63+  withval=$with_aquaterm;
     64+else
     65+  with_aquaterm="yes"
     66+fi
     67+
     68+
     69+    # if AquaTerm wasn't explicitly disabled
     70+    if test "x$with_aquaterm" != xno; then
     71+        aquaterm_libs=""
     72+        if test "x$with_aquaterm" = xyes; then :
     73+  # Default location of AquaTerm framework
     74+              aquaterm_framework_path="/Library/Frameworks"
     75+else
     76+  # Location of frameworks provided by user
     77+              aquaterm_framework_path="$with_aquaterm"
     78+               aquaterm_libs=" -F$aquaterm_framework_path"
     79+fi
     80+
     81+                                        if test ! -d "$aquaterm_framework_path/AquaTerm.framework"; then :
     82+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Framework '$aquaterm_framework_path/AquaTerm.framework' doesn't exist." >&5
     83+$as_echo "$as_me: WARNING: Framework '$aquaterm_framework_path/AquaTerm.framework' doesn't exist." >&2;}
     84+               aquaterm_libs=""
     85+fi
     86+
     87+                                ac_save_CFLAGS="$CFLAGS"
     88+        CFLAGS="$CFLAGS -ObjC$aquaterm_libs"
     89+        ac_ext=c
     90+ac_cpp='$CPP $CPPFLAGS'
     91+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     92+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     93+ac_compiler_gnu=$ac_cv_c_compiler_gnu
     94+
     95+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AquaTerm/AQTAdapter.h" >&5
     96+$as_echo_n "checking for AquaTerm/AQTAdapter.h... " >&6; }
     97+if ${ac_cv_header_aquaterm_aqtadapter_h+:} false; then :
     98   $as_echo_n "(cached) " >&6
     99 else
     100-  ac_check_lib_save_LIBS=$LIBS
     101-LIBS="-laquaterm -lobjc $LIBS"
     102+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     103+/* end confdefs.h.  */
     104+#import <AquaTerm/AQTAdapter.h>
     105+int
     106+main ()
     107+{
     108+
     109+  ;
     110+  return 0;
     111+}
     112+_ACEOF
     113+if ac_fn_c_try_compile "$LINENO"; then :
     114+  ac_cv_header_aquaterm_aqtadapter_h=yes
     115+else
     116+  ac_cv_header_aquaterm_aqtadapter_h=no
     117+fi
     118+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     119+fi
     120+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_aquaterm_aqtadapter_h" >&5
     121+$as_echo "$ac_cv_header_aquaterm_aqtadapter_h" >&6; }
     122+        ac_ext=c
     123+ac_cpp='$CPP $CPPFLAGS'
     124+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     125+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
     126+ac_compiler_gnu=$ac_cv_c_compiler_gnu
     127+
     128+        CFLAGS="$ac_save_CFLAGS"
     129+
     130+                if test "x$ac_cv_header_aquaterm_aqtadapter_h" = "xno"; then :
     131+  with_aquaterm=no
     132+else
     133+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aqtInit in AquaTerm framework" >&5
     134+$as_echo_n "checking for aqtInit in AquaTerm framework... " >&6; }
     135+if ${ac_cv_framework_AquaTerm_aqtInit+:} false; then :
     136+  $as_echo_n "(cached) " >&6
     137+else
     138+  ac_check_framework_save_LIBS=$LIBS
     139+LIBS="-framework AquaTerm $aquaterm_libs $LIBS"
     140 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     141 /* end confdefs.h.  */
     142 
     143@@ -7524,33 +7609,32 @@ return aqtInit ();
     144 }
     145 _ACEOF
     146 if ac_fn_c_try_link "$LINENO"; then :
     147-  ac_cv_lib_aquaterm_aqtInit=yes
     148+  ac_cv_framework_AquaTerm_aqtInit=yes
     149 else
     150-  ac_cv_lib_aquaterm_aqtInit=no
     151+  ac_cv_framework_AquaTerm_aqtInit=no
     152 fi
     153 rm -f core conftest.err conftest.$ac_objext \
     154     conftest$ac_exeext conftest.$ac_ext
     155-LIBS=$ac_check_lib_save_LIBS
     156+LIBS=$ac_check_framework_save_LIBS
     157 fi
     158-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_aquaterm_aqtInit" >&5
     159-$as_echo "$ac_cv_lib_aquaterm_aqtInit" >&6; }
     160-if test "x$ac_cv_lib_aquaterm_aqtInit" = x""yes; then :
     161-   LIBS="-laquaterm $LIBS -framework Foundation"
     162-       CFLAGS="$CFLAGS -ObjC"
     163+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_framework_AquaTerm_aqtInit" >&5
     164+$as_echo "$ac_cv_framework_AquaTerm_aqtInit" >&6; }
     165+if test $ac_cv_framework_AquaTerm_aqtInit = yes; then :
     166 
     167 $as_echo "#define HAVE_LIBAQUATERM 1" >>confdefs.h
     168 
     169+                                   CFLAGS="$CFLAGS -ObjC$aquaterm_libs"
     170+                                   LIBS="$LIBS -framework Foundation -framework AquaTerm$aquaterm_libs"
     171+                                   with_aquaterm=yes
     172 
     173+else
     174+  with_aquaterm=no
     175 fi
     176-
     177-     is_apple=yes
     178-
     179+fi
     180+    fi
     181 else
     182-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     183-$as_echo "no" >&6; }
     184-   is_apple=no
     185+    with_aquaterm=no
     186 fi
     187-rm -f conftest*
     188 
     189 
     190 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BeOS" >&5
     191@@ -14910,7 +14994,7 @@ else
     192 $as_echo "  next terminal: no" >&6; }
     193 fi
     194 
     195-if test "$ac_cv_lib_aquaterm_aqtInit" = yes; then
     196+if test "$with_aquaterm" = yes; then
     197   { $as_echo "$as_me:${as_lineno-$LINENO}: result:   aqua terminal: yes" >&5
     198 $as_echo "  aqua terminal: yes" >&6; }
     199 else
     200--- configure.in.orig
     201+++ configure.in
     202@@ -1366,7 +1366,7 @@ else
     203   AC_MSG_RESULT([  next terminal: no])
     204 fi
     205 
     206-if test "$ac_cv_lib_aquaterm_aqtInit" = yes; then
     207+if test "$with_aquaterm" = yes; then
     208   AC_MSG_RESULT([  aqua terminal: yes])
     209 else
     210   AC_MSG_RESULT([  aqua terminal: no])
     211--- m4/apple.m4.orig
     212+++ m4/apple.m4
     213@@ -1,27 +1,117 @@
     214+# serial 1
     215+
     216+# The following code has been found in several open source projects online.
     217+# It's true origin is unknown.
     218+#
     219+# AC_CHECK_FRAMEWORK(FRAMEWORK, FUNCTION,
     220+#              [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
     221+#              [OTHER-LIBRARIES])
     222+# ------------------------------------------------------
     223+#
     224+AC_DEFUN([AC_CHECK_FRAMEWORK],
     225+[m4_ifval([$3], , [AH_CHECK_FRAMEWORK([$1])])dnl
     226+AS_LITERAL_IF([$1],
     227+         [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1_$2])],
     228+         [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1''_$2])])dnl
     229+AC_CACHE_CHECK([for $2 in $1 framework], ac_Framework,
     230+[ac_check_framework_save_LIBS=$LIBS
     231+LIBS="-framework $1 $5 $LIBS"
     232+AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
     233+          [AS_VAR_SET(ac_Framework, yes)],
     234+          [AS_VAR_SET(ac_Framework, no)])
     235+LIBS=$ac_check_framework_save_LIBS])
     236+AS_IF([test AS_VAR_GET(ac_Framework) = yes],
     237+      [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FRAMEWORK_$1))
     238+  LIBS="-framework $1 $LIBS"
     239+])],
     240+      [$4])dnl
     241+AS_VAR_POPDEF([ac_Framework])dnl
     242+])# AC_CHECK_FRAMEWORK
     243+
     244+# AH_CHECK_FRAMEWORK(FRAMEWORK)
     245+# ---------------------
     246+m4_define([AH_CHECK_FRAMEWORK],
     247+[AH_TEMPLATE(AS_TR_CPP(HAVE_FRAMEWORK_$1),
     248+        [Define to 1 if you have the `]$1[' framework (-framework ]$1[).])])
     249+
     250+
     251 ## ------------------------------- ##
     252 ## Check for Apple Mac OS X        ##
     253-## From Leigh Smith                ##
     254 ## ------------------------------- ##
     255 
     256-# serial 1
     257-
     258 AC_DEFUN([GP_APPLE],
     259-[AC_MSG_CHECKING(for Apple MacOS X)
     260+[AC_MSG_CHECKING(for Apple Mac OS X)
     261 AC_EGREP_CPP(yes,
     262 [#if defined(__APPLE__) && defined(__MACH__)
     263   yes
     264 #endif
     265-],
     266-   [ AC_MSG_RESULT(yes)
     267-     AC_CHECK_LIB(aquaterm, aqtInit,
     268-     [ LIBS="-laquaterm $LIBS -framework Foundation"
     269-       CFLAGS="$CFLAGS -ObjC"
     270-       AC_DEFINE(HAVE_LIBAQUATERM,1,
     271-                 [Define to 1 if you're using the aquaterm library on Mac OS X])
     272-     ],[], -lobjc)
     273-     is_apple=yes
     274-   ],
     275-   AC_MSG_RESULT(no)
     276-   is_apple=no)
     277-])
     278+],
     279+   [AC_MSG_RESULT(yes)
     280+    is_apple=yes],
     281+   [AC_MSG_RESULT(no)
     282+    is_apple=no])
     283 
     284+dnl  AquaTerm terminal for Mac OS X
     285+
     286+dnl The terminal only works on Mac OS X, so the test will only be performed there
     287+dnl It is enabled by default (if AquaTerm can be found).
     288+dnl One can disabled it with --without-aquaterm
     289+dnl or choose a different framework location with --with-aquaterm=/path/to/Frameworks
     290+dnl
     291+dnl Somewhere we have to document that --with-aquaterm=/path/to/Frameworks will try to include
     292+dnl       /path/to/Frameworks/AquaTerm.framework by using -F/path/to/Frameworks
     293+dnl as well as
     294+dnl       -I/path/to/Frameworks/AquaTerm.framework/Headers
     295+dnl but of course one can always simply use explicit LDFLAGS and CFLAGS.
     296+
     297+if test "$is_apple" = "yes"; then
     298+    AC_ARG_WITH(aquaterm, [  --without-aquaterm      disable aqua terminal (default --with-aquaterm=/Library/Frameworks)], [], [with_aquaterm="yes"])
     299+
     300+    # if AquaTerm wasn't explicitly disabled
     301+    if test "x$with_aquaterm" != xno; then
     302+        aquaterm_libs=""
     303+        AS_IF([test "x$with_aquaterm" = xyes],
     304+              # Default location of AquaTerm framework
     305+              [aquaterm_framework_path="/Library/Frameworks"],
     306+              # Location of frameworks provided by user
     307+              [aquaterm_framework_path="$with_aquaterm"
     308+               aquaterm_libs=" -F$aquaterm_framework_path"])
     309+
     310+        dnl Test if /path/to/Frameworks/AquaTerm.framework as provided by
     311+        dnl     --with-aquaterm=/path/to/Frameworks or /Library/Frameworks
     312+        dnl exists and issue a warning if it doesn't
     313+        dnl (however it might still be the case that one used explicit flags, so don't make that fatal, just informative)
     314+        AS_IF([test ! -d "$aquaterm_framework_path/AquaTerm.framework"],
     315+              [AC_MSG_WARN([Framework '$aquaterm_framework_path/AquaTerm.framework' doesn't exist.])
     316+               aquaterm_libs=""])
     317+
     318+        dnl We need to check if AquaTerm/AQTAdapter.h can be found.
     319+        dnl We could actually use AC_LANG_PUSH([Objective C]) here, but for real compilation C with -ObjC is used
     320+        dnl and it might be that users have set CFLAGS and no OBJCFLAGS, which would lead to discrepancies.
     321+        ac_save_CFLAGS="$CFLAGS"
     322+        CFLAGS="$CFLAGS -ObjC$aquaterm_libs"
     323+        AC_LANG_PUSH([C])
     324+        AC_CACHE_CHECK([for AquaTerm/AQTAdapter.h],
     325+                       [ac_cv_header_aquaterm_aqtadapter_h],
     326+                       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#import <AquaTerm/AQTAdapter.h>]],[[]])],
     327+                                          [ac_cv_header_aquaterm_aqtadapter_h=yes],
     328+                                          [ac_cv_header_aquaterm_aqtadapter_h=no])])
     329+        AC_LANG_POP([C])
     330+        CFLAGS="$ac_save_CFLAGS"
     331+
     332+        dnl And now finally test if AquaTerm framework can be linked against
     333+        AS_IF([test "x$ac_cv_header_aquaterm_aqtadapter_h" = "xno"],
     334+              [with_aquaterm=no],
     335+              [AC_CHECK_FRAMEWORK([AquaTerm],[aqtInit],
     336+                                  [AC_DEFINE(HAVE_LIBAQUATERM,1,
     337+                                      [Define to 1 if you're using the AquaTerm framework on Mac OS X])
     338+                                   CFLAGS="$CFLAGS -ObjC$aquaterm_libs"
     339+                                   LIBS="$LIBS -framework Foundation -framework AquaTerm$aquaterm_libs"
     340+                                   with_aquaterm=yes
     341+                                  ],[with_aquaterm=no],[$aquaterm_libs])])
     342+    fi
     343+else
     344+    with_aquaterm=no
     345+fi
     346+
     347+])
     348--- term/aquaterm.trm.orig
     349+++ term/aquaterm.trm
     350@@ -94,7 +94,7 @@ TERM_PUBLIC void ENHAQUA_writec __PROTO((int c));
     351 #ifndef TERM_PROTO_ONLY
     352 
     353 #ifdef TERM_BODY
     354-#import <aquaterm/AQTAdapter.h>
     355+#import <AquaTerm/AQTAdapter.h>
     356 
     357 #import <Foundation/NSAutoreleasePool.h>
     358 #import <Foundation/NSArray.h>
     359@@ -356,7 +356,7 @@ AQUA_init()
     360   [adapter openPlotWithIndex:AQUA_plotRef];
     361 
     362   /* Check for support of version-dependent features */
     363-   AQUA_hasAlphaSupport = [AQTAdapter respondsToSelector:@selector(setColorRed:green:blue:alpha:)];
     364+   AQUA_hasAlphaSupport = [AQTAdapter instancesRespondToSelector:@selector(setColorRed:green:blue:alpha:)];
     365 
     366   /* set xmax, ymax*/
     367   term->xmax = AQUA_xSize;