Skip to content

Commit

Permalink
vim: fix test for SDK newer than 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kencu authored and raimue committed Oct 7, 2018
1 parent 3722785 commit 12828a4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions editors/vim/Portfile
Expand Up @@ -25,6 +25,9 @@ depends_lib port:ncurses \
port:gettext \
port:libiconv

# fix test macro for sdk check
patchfiles-append patch-vim-src-os_macosx-availability.diff

post-patch {
set features [open ${worksrcpath}/src/feature.h a+]
puts $features "#define SYS_VIMRC_FILE \"${prefix}/etc/vimrc\""
Expand Down
40 changes: 40 additions & 0 deletions editors/vim/files/patch-vim-src-os_macosx-availability.diff
@@ -0,0 +1,40 @@
diff --git src/os_macosx.m src/os_macosx.m
index 752bdae..50ca361 100644
--- src/os_macosx.m
+++ src/os_macosx.m
@@ -63,7 +63,7 @@ clip_mch_request_selection(VimClipboard *cbd)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSPasteboard *pb = [NSPasteboard generalPasteboard];
-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
NSPasteboardTypeString, nil];
#else
@@ -99,7 +99,7 @@ clip_mch_request_selection(VimClipboard *cbd)
{
/* Use NSPasteboardTypeString. The motion type is detected automatically.
*/
-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSMutableString *mstring =
[[pb stringForType:NSPasteboardTypeString] mutableCopy];
#else
@@ -188,7 +188,7 @@ clip_mch_set_selection(VimClipboard *cbd)

/* See clip_mch_request_selection() for info on pasteboard types. */
NSPasteboard *pb = [NSPasteboard generalPasteboard];
-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
NSPasteboardTypeString, nil];
#else
@@ -201,7 +201,7 @@ clip_mch_set_selection(VimClipboard *cbd)
NSArray *plist = [NSArray arrayWithObjects:motion, string, nil];
[pb setPropertyList:plist forType:VimPboardType];

-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
[pb setString:string forType:NSPasteboardTypeString];
#else
[pb setString:string forType:NSStringPboardType];

0 comments on commit 12828a4

Please sign in to comment.