Ticket #31196: emacs-app.diff

File emacs-app.diff, 2.3 KB (added by takanori@…, 13 years ago)
  • files/patch-emacs.c.diff

     
     1--- src/emacs.c.orig    2011-01-09 02:45:14.000000000 +0900
     2+++ src/emacs.c 2011-09-09 23:13:44.000000000 +0900
     3@@ -23,6 +23,8 @@
     4 #include <signal.h>
     5 #include <errno.h>
     6 #include <stdio.h>
     7+#include <stdlib.h>
     8+#include <string.h>
     9 
     10 #include <sys/types.h>
     11 #include <sys/file.h>
     12@@ -839,6 +841,25 @@
     13 #ifdef DARWIN_OS
     14   if (!initialized)
     15     unexec_init_emacs_zone ();
     16+
     17+  /* Imaxima won't work properly if PATH does not contain the
     18+     MacPorts directory. The following code is a workaround to
     19+     avoid this problem. */
     20+  {
     21+    char *oldpath = getenv("PATH");
     22+    if (!oldpath) {oldpath = "";}
     23+    size_t oldpathsize = strlen(oldpath)+1;
     24+    if (!strstr(oldpath, "__PREFIX__/bin")) {
     25+      char *newpath;
     26+      size_t newpathsize = oldpathsize + strlen("__PREFIX__/bin:");
     27+      if ((newpath = (char *)malloc(newpathsize)) != NULL) {
     28+        strlcpy(newpath, "__PREFIX__/bin:", newpathsize);
     29+        strlcat(newpath, oldpath, newpathsize);
     30+        setenv("PATH", newpath, 1);
     31+        free(newpath);
     32+      }
     33+    }
     34+  }
     35 #endif
     36 
     37   sort_args (argc, argv);
  • Portfile

     
    55
    66name            emacs-app
    77version         23.3
    8 revision        1
     8revision        2
    99categories      aqua editors
    1010maintainers     css
    1111description     The GNU Emacs text editor (Cocoa version)
     
    3535
    3636configure.args  --with-ns --without-x --without-dbus
    3737
    38 patchfiles      patch-src_unexmacosx.c.diff
     38patchfiles      patch-src_unexmacosx.c.diff \
     39                patch-emacs.c.diff
    3940
    4041variant fullscreen description {Add fullscreen patch from http://gist.github.com/291150 as mentioned in http://www.sanityinc.com/full-screen-support-for-cocoa-emacs-on-osx} {
    4142    patchfiles-append patch-fullscreen.diff
     
    4748   configure.ldflags-append     -fno-pie
    4849}
    4950
     51post-patch {
     52    reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/src/emacs.c
     53}
     54
    5055destroot {
    5156        system "cd ${worksrcpath} && make install"
    5257        xinstall -m 755 -d ${destroot}${applications_dir}