Ticket #40444: patch-update-java-mars-port.diff

File patch-update-java-mars-port.diff, 8.5 KB (added by maehne (Torsten Maehne), 8 years ago)

Patch to update mars to version 4.4

  • Portfile

    diff -aruN mars.orig/Portfile mars/Portfile
    old new  
    44PortSystem          1.0
    55
    66name                mars
    7 version             4.3
    8 set releasedate     Jan2013
     7version             4.4
     8set releasedate     Aug2013
    99set fileversion     [join [split ${version} .] _]
    1010revision            0
    1111categories          java devel
     
    2727use_zip             yes
    2828extract.suffix      .jar
    2929
    30 checksums           sha1    5a8608ba0a8548d12c035d9817769d86edfa77f8 \
    31                     rmd160  21e419cd2cd181e48e651e6beeae88cd4273466f
     30checksums           sha1    54544a2f212cc5cc96868efe7ea8973be3f778fb \
     31                    rmd160  15480082329e9b9cc8d7ea81dc84cd3922dfbefc
    3232
    3333depends_lib         bin:java:kaffe
    3434
     
    3636
    3737build               {}
    3838
    39 destroot {
    40     # Install Mars JAR
    41     xinstall -m 755 -d ${destroot}${prefix}/share/java
    42     xinstall -m 644 -W ${distpath} ${distname}.jar ${destroot}${prefix}/share/java
    43    
    44     # Install and configure mars command line wrapper
    45     xinstall -m 755 ${filespath}/mars.in ${destroot}${prefix}/bin/mars
    46     reinplace "s|@MARSJARPATH@|${prefix}/share/java/${distname}.jar|g" ${destroot}${prefix}/bin/mars
    47 }
    48 
    49 # The only reason we extract the zip file is to get the image for the OS X app icon,
     39# The only reason we extract the zip file is to get the image for the
     40# OS X app icon (and patch the sources for the OS-X-specific jedit bug),
    5041# so we don't need to extract it on other platforms.
    5142if {${os.platform} != "darwin"} {
    5243    extract.only
     44    destroot {
     45        # Install Mars JAR
     46        xinstall -m 755 -d ${destroot}${prefix}/share/java
     47        xinstall -m 644 -W ${distpath} ${distname}.jar ${destroot}${prefix}/share/java
     48
     49        # Install and configure mars command line wrapper
     50        xinstall -m 755 ${filespath}/mars.in ${destroot}${prefix}/bin/mars
     51        reinplace "s|@MARSJARPATH@|${prefix}/share/java/${distname}.jar|g" ${destroot}${prefix}/bin/mars
     52    }
    5353}
    5454
    5555platform darwin {
    5656    depends_build-append        port:makeicns
    57    
     57
    5858    extract.mkdir               yes
    59     pre-extract {
    60         extract.post_args-append    images/MarsThumbnail.gif
     59# As long as the OS-X-specific jedit bug is present in the editor of Mars,
     60# we have to unpack the whole JAR.
     61#    pre-extract {
     62#        extract.post_args-append    images/MarsThumbnail.gif
     63#    }
     64
     65    # The jedit-based editor of MARS requires a patch on OS X to enable
     66    # entering characters requiring the ALT key.
     67    patchfiles          patch-mars-venus-editors-jeditsyntax-DefaultInputHandler.java
     68    build {
     69        # Recompile patched source file
     70        # mars/venus/editors/jeditsyntax/DefaultInputHandler.java
     71        system "cd ${worksrcpath} && javac ${worksrcpath}/mars/venus/editors/jeditsyntax/DefaultInputHandler.java"
     72        # Create new JAR archive
     73        system "cd ${worksrcpath} && sh ${worksrcpath}/CreateMarsJar.bat"
    6174    }
    62    
     75
     76    destroot {
     77        # Install Mars JAR
     78        xinstall -m 755 -d ${destroot}${prefix}/share/java
     79        xinstall -m 644 ${worksrcpath}/Mars.jar ${destroot}${prefix}/share/java/${distname}.jar
     80
     81        # Install and configure mars command line wrapper
     82        xinstall -m 755 ${filespath}/mars.in ${destroot}${prefix}/bin/mars
     83        reinplace "s|@MARSJARPATH@|${prefix}/share/java/${distname}.jar|g" ${destroot}${prefix}/bin/mars
     84    }
     85
    6386    # Build a nice .app
    6487    post-destroot {
    6588        set MarsAppPath ${destroot}${applications_dir}/MARS.app
  • files/mars.in

    diff -aruN mars.orig/files/mars.in mars/files/mars.in
    old new  
    11#!/bin/sh
    2 java -jar @MARSJARPATH@
     2java -jar "@MARSJARPATH@" "$@"
     3
  • files/patch-mars-venus-editors-jeditsyntax-DefaultInputHandler.java

    diff -aruN mars.orig/files/patch-mars-venus-editors-jeditsyntax-DefaultInputHandler.java mars/files/patch-mars-venus-editors-jeditsyntax-DefaultInputHandler.java
    old new  
     1--- mars/venus/editors/jeditsyntax/DefaultInputHandler.java.orig        2013-03-07 17:51:06.000000000 +0100
     2+++ mars/venus/editors/jeditsyntax/DefaultInputHandler.java     2013-03-07 18:21:45.000000000 +0100
     3@@ -14,6 +14,7 @@
     4    import java.awt.Toolkit;
     5    import java.util.Hashtable;
     6    import java.util.StringTokenizer;
     7+   import java.util.Properties;
     8 
     9 /**
     10  * The default input handler. It maps sequences of keystrokes into actions
     11@@ -232,19 +233,45 @@
     12          // matches KeyEvent.META_MASK.   DPS 30-Nov-2010
     13          if ((modifiers & KeyEvent.META_MASK) != 0)
     14             return;
     15-      // DPS 9-Jan-2013.  Umberto Villano from Italy describes Alt combinations
     16-      // not working on Italian Mac keyboards, where # requires Alt (Option).
     17-               // This is preventing him from writing comments.  Similar complaint from
     18-               // Joachim Parrow in Sweden, only for the $ character.  Villano pointed
     19-               // me to this method.  Plus a Google search on "jeditsyntax alt key"
     20-               // (without quotes) took me to
     21-               // http://compgroups.net/comp.lang.java.programmer/option-key-in-jedit-syntax-package/1068227
     22-               // which says to comment out the second condition in this IF statement:
     23-      // if(c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0)
     24-               // So let's give it a try!
     25-               // (...later) Bummer, it results in keystroke echoed into editing area when I use Alt
     26-               // combination for shortcut menu access (e.g. Alt+f to open the File menu).
     27-         if(c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0)
     28+         // DPS 9-Jan-2013.  Umberto Villano from Italy describes Alt combinations
     29+         // not working on Italian Mac keyboards, where # requires Alt (Option).
     30+         // This is preventing him from writing comments.  Similar complaint from
     31+         // Joachim Parrow in Sweden, only for the $ character.  Villano pointed
     32+         // me to this method.  Plus a Google search on "jeditsyntax alt key"
     33+         // (without quotes) took me to
     34+         // http://compgroups.net/comp.lang.java.programmer/option-key-in-jedit-syntax-package/1068227
     35+         // which says to comment out the second condition in this IF statement:
     36+         // if(c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0)
     37+         // So let's give it a try!
     38+         // (...later) Bummer, it results in keystroke echoed into editing area when I use Alt
     39+         // combination for shortcut menu access (e.g. Alt+f to open the File menu).
     40+         //
     41+         // Torsten Maehne: This is a shortcoming of the menu
     42+         // shortcuts handling in the jedit component: It assumes that
     43+         // modifier keys are the same across all platforms. However,
     44+         // the menu shortcut keymask varies between OS X and
     45+         // Windows/Linux, it is Cmd + <key> instead of Alt +
     46+         // <key>. The "Java Development Guide for Mac" explicitly
     47+         // discusses the issue in:
     48+         // <https://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html#//apple_ref/doc/uid/TP40001909-211884-TPXREF130>
     49+         //
     50+         // As jedit always considers Alt + <key> as a keyboard
     51+         // shortcut, they block their output in the editor, which
     52+         // prevents the entry of special characters on OS X that uses
     53+         // Alt + <key> for this purpose instead of AltGr + <key>, as
     54+         // on Windows or Linux.
     55+         //
     56+         // For the latest jedit version (5.0.0), the menu
     57+         // accelerators don't work on OS X, at least the special
     58+         // characters can be entered using Alt + <key>. The issue is
     59+         // still open, but there seems to be progress:
     60+         //
     61+         // http://sourceforge.net/tracker/index.php?func=detail&aid=3558572&group_id=588&atid=300588
     62+         // http://sourceforge.net/tracker/?func=detail&atid=300588&aid=3604532&group_id=588
     63+         //
     64+         // Until this is resolved upstream, don't ignore characters
     65+         // on OS X, which have been entered with the ALT modifier:
     66+         if(c != KeyEvent.CHAR_UNDEFINED && (((modifiers & KeyEvent.ALT_MASK) == 0) || System.getProperty("os.name").contains("OS X")))
     67          {
     68             if(c >= 0x20 && c != 0x7f)
     69             {