Skip to content

Commit

Permalink
R-gui: update to 1.79 for < 11
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Jan 18, 2025
1 parent 9d46c20 commit 3e6b544
Show file tree
Hide file tree
Showing 8 changed files with 686 additions and 8 deletions.
57 changes: 49 additions & 8 deletions math/R-app/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ if {${os.platform} eq "darwin" && ${os.major} > 12} {
worksrcdir Mac-GUI
} else {
# Version for older systems, including PPC. 1.73 still builds but freezes on quit.
version 1.72
set rel_r_ver 4.0.2
revision 4
version 1.79
set rel_r_ver 4.3.0
revision 0
}
categories math science aqua
maintainers {me.com:kjell.konis @kjellpk} {i0ntempest @i0ntempest} openmaintainer
Expand All @@ -32,7 +32,8 @@ homepage http://R.research.att.com/
platforms macosx

master_sites http://cran.rstudio.com/bin/macosx/ \
http://cran.us.r-project.org/bin/macosx/
http://cran.us.r-project.org/bin/macosx/ \
https://cran.csie.ntu.edu.tw/bin/macosx/

distname Mac-GUI-${version}

Expand All @@ -45,11 +46,14 @@ if {${os.platform} eq "darwin" && ${os.major} > 12} {
size 1399999
} else {
checksums ${distname}.tar.gz \
rmd160 022ddae8a3988c5a33928d520742ddfca73ac21d \
sha256 a30c97b37645b55aff62bc88cccaf92c307f1e84d84d3ecd5c1333afa2b78e76 \
size 1311627
rmd160 44518e071c8e220dd02071ba0ded7899fc5c8924 \
sha256 10eff30befa2b60a880d5a8f08f81a941cd447fee5f37fccf54b422299870267 \
size 1299278
}

# Fix wrong macros in InfoPlist:
patchfiles-append 0001-InfoPlist.h-fix-MIN_VER.patch

if {${os.platform} eq "darwin" && ${os.major} < 11} {
# We need to use xib files from older version, newer fail to build with Xcode 3.x.
set legacy_ver 1.70
Expand All @@ -76,13 +80,21 @@ if {${os.platform} eq "darwin" && ${os.major} < 11} {
move ${workpath}/Mac-GUI-${legacy_ver}/ja.lproj ${worksrcpath}
move ${workpath}/Mac-GUI-${legacy_ver}/nl.lproj ${worksrcpath}
}
# 1.79
patchfiles-append 1001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch
# 1.76
patchfiles-append 2001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch \
2002-Revert-add-blank-touchbar-to-console.patch \
2003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch \
2004-RDocumentWinCtrl.m-fix-compilation.patch \
2005-RScriptEditorTextStorage.m-fix-compilation.patch

post-patch {
# These are intended for 1.72 (see above). Other versions set different compatibility.
if {${os.major} == 9} {
reinplace "s|Xcode 3.2|Xcode 3.1|g" ${worksrcpath}/R.xcodeproj/project.pbxproj
}
reinplace "s|MACOSX_DEPLOYMENT_TARGET = 10.11|MACOSX_DEPLOYMENT_TARGET = ${macosx_deployment_target}|g" ${worksrcpath}/R.xcodeproj/project.pbxproj
reinplace "s|MACOSX_DEPLOYMENT_TARGET = 10.13|MACOSX_DEPLOYMENT_TARGET = ${macosx_deployment_target}|g" ${worksrcpath}/R.xcodeproj/project.pbxproj
}
}

Expand Down Expand Up @@ -116,6 +128,35 @@ if {[vercmp ${xcodeversion} 10.0] >= 0} {

post-destroot {
delete ${destroot}${applications_dir}/sush

# https://trac.macports.org/ticket/67042
if {${configure.cxx_stdlib} ne "libc++"} {
set rexec ${applications_dir}/R.app/Contents/MacOS/R
set rgui ${prefix}/bin/R-gui

set wrapper [open "${destroot}${rgui}" w 0755]
puts ${wrapper} "#!/bin/bash"
puts ${wrapper} ""
puts ${wrapper} {if [ -n "$DYLD_LIBRARY_PATH" ]; then}
puts ${wrapper} " DYLD_LIBRARY_PATH=${prefix}/lib/libgcc:\${DYLD_LIBRARY_PATH}"
puts ${wrapper} {else}
puts ${wrapper} " DYLD_LIBRARY_PATH=${prefix}/lib/libgcc"
puts ${wrapper} {fi}
puts ${wrapper} {export DYLD_LIBRARY_PATH}
puts ${wrapper} ""
puts ${wrapper} " PATH=${prefix}/bin:${prefix}/sbin:\$PATH"
puts ${wrapper} {export PATH}
puts ${wrapper} ""
puts ${wrapper} "exec ${rexec} \"\$@\""
close $wrapper
}
}

if {${configure.cxx_stdlib} ne "libc++"} {
notes "
A wrapper script to launch the app has been installed into ${prefix}/bin.
Please start the app from command line as `R-gui`.
"
}

livecheck.name Mac-GUI
34 changes: 34 additions & 0 deletions math/R-app/files/0001-InfoPlist.h-fix-MIN_VER.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From ae756c9d1f18aa1f280a0f3422df2bbe61f9dab3 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Sun, 19 Jan 2025 04:51:49 +0800
Subject: [PATCH] InfoPlist.h: fix MIN_VER

---
InfoPlist.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git InfoPlist.h InfoPlist.h
index 9adaf2f..e043e55 100644
--- InfoPlist.h
+++ InfoPlist.h
@@ -59,16 +59,16 @@
#elif MIN_VER >= 101000
#define CFG_NAME Yosemite build
#define MIN_VERSION 10.10
-#elif MIN_VER >= 109000
+#elif MIN_VER >= 1090
#define CFG_NAME Mavericks build
#define MIN_VERSION 10.9
-#elif MIN_VER >= 108000
+#elif MIN_VER >= 1080
#define CFG_NAME Mountain Lion build
#define MIN_VERSION 10.8
-#elif MIN_VER >= 107000
+#elif MIN_VER >= 1070
#define CFG_NAME Lion build
#define MIN_VERSION 10.7
-#elif MIN_VER >= 106000
+#elif MIN_VER >= 1060
#define CFG_NAME Snow Leopard build
#define MIN_VERSION 10.6
#else /* don't bother with the real name if older - just if it's 64-bit or not */
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From b320e319dcbea9edcd5ececa6e80e08e8c6b0fbf Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Fri, 17 Jan 2025 07:08:50 +0800
Subject: [PATCH 1/2] Revert "suppress IsMenuKeyEvent: in stderr"

This reverts commit c72427be7236045a110acac62f2afa8810869020.
---
RController.m | 41 ++++++++++++++---------------------------
1 file changed, 14 insertions(+), 27 deletions(-)

diff --git RController.m RController.m
index cf493bb..db7e366 100644
--- RController.m
+++ RController.m
@@ -2109,25 +2109,6 @@ issuing the newline.
[consoleTextView insertText:text];
}
*/
-
-/* A bad hack to remove output from the stream - it is used to remove
- stderr output caused by buggy Apple code that we have no control over.
- It is assumed that s is allocated so if a replacement is necessary,
- it will be released and a new string allocated.
- */
-static NSString *fixBuggyOutput(NSString *s, NSString *regExp) {
- NSRange r = [s rangeOfString:regExp options:NSRegularExpressionSearch];
- if (r.location != NSNotFound) {
- NSString *os = s;
- NSUInteger start, end;
- [s getLineStart:&start end:&end contentsEnd:0 forRange:r];
- s = [os stringByReplacingCharactersInRange:NSMakeRange(start, end-start) withString:@""];
- [s retain];
- [os release];
- }
- return s;
-}
-
/* This function is used by two threads to write stderr and/or stdout to the console
length: -1 = the string is null-terminated
outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root
@@ -2137,14 +2118,20 @@ outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root
NSColor *color=(outputType==0)?[consoleColors objectAtIndex:iStdoutColor]:((outputType==1)?[consoleColors objectAtIndex:iStderrColor]:[consoleColors objectAtIndex:iRootColor]);
if (len>=0 && buf[len]!=0) buf[len]=0; /* this MAY be dangerous ... */
NSString *s = [[NSString alloc] initWithUTF8String:buf];
- if (outputType == 1) {
- // FIXME horrible, horrible hack - this warning seems to be a macOS bug, because
- // we never create NSPopoverTouchBarItemButton, so we suppress it in the console
- // by removing a line with that content
- s = fixBuggyOutput(s, @"Warning: Expected min height of view: .* to be less than or equal to ");
- /* bug in Monterey and up */
- s = fixBuggyOutput(s, @"IsMenuKeyEvent: found no unichar data in event; retranslated without deadkeys to produce");
- }
+ if (outputType == 1) {
+ // FIXME horrible, horrible hack - this warning seems to be a macOS bug, because
+ // we never create NSPopoverTouchBarItemButton, so we suppress it in the console
+ // by removing a line with that content
+ NSRange r = [s rangeOfString:@"Warning: Expected min height of view: .* to be less than or equal to " options:NSRegularExpressionSearch];
+ if (r.location != NSNotFound) {
+ NSString *os = s;
+ NSUInteger start, end;
+ [s getLineStart:&start end:&end contentsEnd:0 forRange:r];
+ s = [os stringByReplacingCharactersInRange:NSMakeRange(start, end-start) withString:@""];
+ [s retain];
+ [os release];
+ }
+ }
[self flushROutput];
[self writeConsoleDirectly:s withColor:color];
[s release];
--
2.48.0

Loading

0 comments on commit 3e6b544

Please sign in to comment.