Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R-base 4.1: Patch ATSFont calls to CGFont calls, update gcc11 to gcc12 #1113

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions 10.9-libcxx/stable/main/finkinfo/sci/r-base41.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Info2: <<
Package: r-base41
Version: 4.1.1
Revision: 3
Revision: 5
Description: R Framework
Type: rversion (4.1)
Maintainer: BABA Yoshihiko <[email protected]>
Expand Down Expand Up @@ -41,12 +41,11 @@ BuildDepends: <<
Source: http://cran.r-project.org/src/base/R-4/R-%v.tar.gz
Source-Checksum: SHA256(515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364)
PatchFile: %n.patch
PatchFile-MD5: da609bf1e8f5a5e069b06e368a2aa98b
PatchFile-Checksum: SHA256(505d7185c5b0d70b434c3a8259a1830d84125a571ffc83865fb2b439d985ce91)
PatchScript: <<
#!/bin/sh -ev
#sed 's|@PREFIX@|%p|g' < %{PatchFile} | patch -p1
%{default_script}

# .po files not treated during CompileScript
# perl -pi -e 's/R-devel.rpm/%N-dev by Fink/g' src/library/tools/po/R-*.po
perl -pi -e 's/R-devel.rpm/%N-dev by Fink/' src/library/tools/R/install.R
Expand Down Expand Up @@ -360,12 +359,13 @@ Prevent configure script from detecting new support for utimensat and
clock_gettime to avoid datetime.Rout failing in testsuite. Likewise avoid
detecting working mktime to prevent failure in reg-tests-1d.Rout.

PCRE1 is preferred to PCRE2 as of 2019-01-14 for R 3.6.0. See:
https://cran.r-project.org/doc/manuals/r-devel/R-admin.html
Depends both on libpcre1 and libpcre2.

Allow newer libcurl. See:
https://github.com/fink/fink-distributions/issues/1079

Patch to allow usage of CGFontXX in place of ATSFontXX from fxcoudert of
the R-Project. Patch incorporated into existing previous patch due to
slight source version mismatch.
https://bugs.r-project.org/show_bug.cgi?id=18426
<<
License: GPL
Homepage: http://cran.R-project.org/
Expand Down
172 changes: 157 additions & 15 deletions 10.9-libcxx/stable/main/finkinfo/sci/r-base41.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ruN R-4.1.0-orig/Makefile.fw R-4.1.0/Makefile.fw
--- R-4.1.0-orig/Makefile.fw 2021-08-06 09:00:56.000000000 +0900
+++ R-4.1.0/Makefile.fw 2021-08-06 11:40:37.000000000 +0900
diff -ruN R-4.1.1-orig/Makefile.fw R-4.1.1/Makefile.fw
--- R-4.1.1-orig/Makefile.fw 2023-12-01 18:46:07
+++ R-4.1.1/Makefile.fw 2023-12-01 18:46:47
@@ -8,7 +8,7 @@

install install-strip: install-R-framework
Expand All @@ -19,9 +19,9 @@ diff -ruN R-4.1.0-orig/Makefile.fw R-4.1.0/Makefile.fw
@( otool=otool ; if otool -D "$(DESTDIR)$(Rexeclibdir)/libR.dylib"|grep 'not an object'>/dev/null; then otool=otool64; fi; \
for lib in Rlapack Rblas R; do \
if test -e "$(DESTDIR)$(Rexeclibdir)/lib$${lib}.dylib"; then $(ECHO) " lib$${lib}"; \
diff -Nurd R-4.1.1.orig/configure R-4.1.1/configure
--- R-4.1.1.orig/configure 2021-08-02 18:15:58.000000000 -0400
+++ R-4.1.1/configure 2023-10-14 01:08:54.000000000 -0400
diff -ruN R-4.1.1-orig/configure R-4.1.1/configure
--- R-4.1.1-orig/configure 2023-12-01 18:46:06
+++ R-4.1.1/configure 2023-12-01 18:46:47
@@ -3915,8 +3915,8 @@

## As from R 3.2.0 split up -L... and -lR
Expand Down Expand Up @@ -71,9 +71,9 @@ diff -Nurd R-4.1.1.orig/configure R-4.1.1/configure
#elif LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 28
exit(0);
#else
diff -ruN R-4.1.0-orig/src/extra/intl/vasnprintf.c R-4.1.0/src/extra/intl/vasnprintf.c
--- R-4.1.0-orig/src/extra/intl/vasnprintf.c 2021-08-06 09:00:56.000000000 +0900
+++ R-4.1.0/src/extra/intl/vasnprintf.c 2021-08-06 11:40:37.000000000 +0900
diff -ruN R-4.1.1-orig/src/extra/intl/vasnprintf.c R-4.1.1/src/extra/intl/vasnprintf.c
--- R-4.1.1-orig/src/extra/intl/vasnprintf.c 2023-12-01 18:46:07
+++ R-4.1.1/src/extra/intl/vasnprintf.c 2023-12-01 18:46:47
@@ -4006,7 +4006,7 @@
#endif
*fbp = dp->conversion;
Expand All @@ -83,9 +83,151 @@ diff -ruN R-4.1.0-orig/src/extra/intl/vasnprintf.c R-4.1.0/src/extra/intl/vasnpr
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
diff -ruN R-4.1.0-orig/src/main/Makefile.in R-4.1.0/src/main/Makefile.in
--- R-4.1.0-orig/src/main/Makefile.in 2021-08-06 09:01:04.000000000 +0900
+++ R-4.1.0/src/main/Makefile.in 2021-08-06 17:09:48.000000000 +0900
diff -ruN R-4.1.1-orig/src/library/grDevices/src/devQuartz.c R-4.1.1/src/library/grDevices/src/devQuartz.c
--- R-4.1.1-orig/src/library/grDevices/src/devQuartz.c 2023-12-01 18:46:07
+++ R-4.1.1/src/library/grDevices/src/devQuartz.c 2023-12-01 18:48:22
@@ -558,10 +558,10 @@

#pragma mark Quartz Font Cache

-/* Font lookup is expesive yet frequent. Therefore we cache all used ATS fonts (which are global to the app). */
+/* Font lookup is expesive yet frequent. Therefore we cache all used CG fonts (which are global to the app). */

typedef struct font_cache_entry_s {
- ATSFontRef font;
+ CGFontRef font;
char *family;
int face;
} font_cache_entry_t;
@@ -576,7 +576,7 @@

font_cache_t font_cache, *font_cache_tail = &font_cache;

-static ATSFontRef RQuartz_CacheGetFont(const char *family, int face) {
+static CGFontRef RQuartz_CacheGetFont(const char *family, int face) {
font_cache_t *fc = &font_cache;
while (fc) {
int i = 0, j = fc->fonts;
@@ -590,7 +590,7 @@
return 0;
}

-static void RQuartz_CacheAddFont(const char *family, int face, ATSFontRef font) {
+static void RQuartz_CacheAddFont(const char *family, int face, CGFontRef font) {
if (font_cache_tail->fonts >= max_fonts_per_block)
font_cache_tail = font_cache_tail->next = (font_cache_t*) calloc(1, sizeof(font_cache_t));
{
@@ -646,7 +646,7 @@
CGFontRef RQuartz_Font(CTXDESC)
{
const char *fontName = NULL, *fontFamily = gc->fontfamily;
- ATSFontRef atsFont = 0;
+ CGFontRef cgFont = 0;
int fontFace = gc->fontface;
if (fontFace < 1 || fontFace > 5) fontFace = 1; /* just being paranoid */
if (fontFace == 5)
@@ -654,25 +654,23 @@
else
fontName = RQuartz_LookUpFontName(fontFace, fontFamily[0] ? fontFamily : "default");
if (fontName) {
- atsFont = RQuartz_CacheGetFont(fontName, 0); /* face is 0 because we are passing a true font name */
- if (!atsFont) { /* not in the cache, get it */
+ cgFont = RQuartz_CacheGetFont(fontName, 0); /* face is 0 because we are passing a true font name */
+ if (!cgFont) { /* not in the cache, get it */
CFStringRef cfFontName = CFStringCreateWithCString(NULL, fontName, kCFStringEncodingUTF8);
- atsFont = ATSFontFindFromName(cfFontName, kATSOptionFlagsDefault);
- if (!atsFont)
- atsFont = ATSFontFindFromPostScriptName(cfFontName, kATSOptionFlagsDefault);
+ cgFont = CGFontCreateWithFontName(cfFontName);
CFRelease(cfFontName);
- if (!atsFont) {
+ if (!cgFont) {
warning(_("font \"%s\" could not be found for family \"%s\""), fontName, fontFamily);
return NULL;
}
- RQuartz_CacheAddFont(fontName, 0, atsFont);
+ RQuartz_CacheAddFont(fontName, 0, cgFont);
}
} else { /* the real font name could not be looked up. We must use cache and/or find the right font by family and face */
if (!fontFamily[0]) fontFamily = "Arial";
/* Arial is the default, because Helvetica doesn't have Oblique
on 10.4 - maybe change later? */
- atsFont = RQuartz_CacheGetFont(fontFamily, fontFace);
- if (!atsFont) { /* not in the cache? Then we need to find the
+ cgFont = RQuartz_CacheGetFont(fontFamily, fontFace);
+ if (!cgFont) { /* not in the cache? Then we need to find the
proper font name from the family name and face */
/* as it turns out kATSFontFilterSelectorFontFamily is not
implemented in macOS (!!) so there is no way to query for a
@@ -681,25 +679,24 @@
char compositeFontName[256];
/* CFStringRef cfFontName; */
if (strlen(fontFamily) > 210) error(_("font family name is too long"));
- while (!atsFont) { /* try different faces until exhausted or successful */
+ while (!cgFont) { /* try different faces until exhausted or successful */
strcpy(compositeFontName, fontFamily);
if (fontFace == 2 || fontFace == 4) strcat(compositeFontName, " Bold");
if (fontFace == 3 || fontFace == 4) strcat(compositeFontName, " Italic");
CFStringRef cfFontName = CFStringCreateWithCString(NULL, compositeFontName, kCFStringEncodingUTF8);
- atsFont = ATSFontFindFromName(cfFontName, kATSOptionFlagsDefault);
- if (!atsFont) atsFont = ATSFontFindFromPostScriptName(cfFontName, kATSOptionFlagsDefault);
+ cgFont = CGFontCreateWithFontName(cfFontName);
CFRelease(cfFontName);
- if (!atsFont) {
+ if (!cgFont) {
if (fontFace == 1) { /* more guessing - fontFace == 1 may need Regular or Roman */
strcat(compositeFontName," Regular");
cfFontName = CFStringCreateWithCString(NULL, compositeFontName, kCFStringEncodingUTF8);
- atsFont = ATSFontFindFromName(cfFontName, kATSOptionFlagsDefault);
+ cgFont = CGFontCreateWithFontName(cfFontName);
CFRelease(cfFontName);
- if (!atsFont) {
+ if (!cgFont) {
strcpy(compositeFontName, fontFamily);
strcat(compositeFontName," Roman");
cfFontName = CFStringCreateWithCString(NULL, compositeFontName, kCFStringEncodingUTF8);
- atsFont = ATSFontFindFromName(cfFontName, kATSOptionFlagsDefault);
+ cgFont = CGFontCreateWithFontName(cfFontName);
CFRelease(cfFontName);
}
} else if (fontFace == 3 || fontFace == 4) { /* Oblique is sometimes used instead of Italic (e.g. in Helvetica) */
@@ -707,26 +704,26 @@
if (fontFace == 4) strcat(compositeFontName, " Bold");
strcat(compositeFontName," Oblique");
cfFontName = CFStringCreateWithCString(NULL, compositeFontName, kCFStringEncodingUTF8);
- atsFont = ATSFontFindFromName(cfFontName, kATSOptionFlagsDefault);
+ cgFont = CGFontCreateWithFontName(cfFontName);
CFRelease(cfFontName);
}
}
- if (!atsFont) { /* try to fall back to a more plain face */
+ if (!cgFont) { /* try to fall back to a more plain face */
if (fontFace == 4) fontFace = 2;
else if (fontFace != 1) fontFace = 1;
else break;
- atsFont = RQuartz_CacheGetFont(fontFamily, fontFace);
- if (atsFont) break;
+ cgFont = RQuartz_CacheGetFont(fontFamily, fontFace);
+ if (cgFont) break;
}
}
- if (!atsFont)
+ if (!cgFont)
warning(_("no font could be found for family \"%s\""), fontFamily);
else
- RQuartz_CacheAddFont(fontFamily, fontFace, atsFont);
+ RQuartz_CacheAddFont(fontFamily, fontFace, cgFont);
}
}

- return CGFontCreateWithPlatformFont(&atsFont);
+ return cgFont;
}

#define RQUARTZ_FILL (1)
diff -ruN R-4.1.1-orig/src/main/Makefile.in R-4.1.1/src/main/Makefile.in
--- R-4.1.1-orig/src/main/Makefile.in 2023-12-01 18:46:07
+++ R-4.1.1/src/main/Makefile.in 2023-12-01 18:46:47
@@ -102,7 +102,7 @@
R_bin_OBJECTS = Rmain.o @WANT_R_SHLIB_FALSE@$(OBJECTS)
@WANT_R_SHLIB_FALSE@R_bin_LDADD = $(MAIN_OBJS) $(EXTRA_STATIC_LIBS) $(EXTRA_LIBS)
Expand All @@ -95,9 +237,9 @@ diff -ruN R-4.1.0-orig/src/main/Makefile.in R-4.1.0/src/main/Makefile.in
## This should depend on MAIN_OBJS not MAIN_LIBS, but we can't use that.
## There is also a dependence on libRblas when that is internal and static.
@WANT_R_SHLIB_FALSE@R_bin_DEPENDENCIES = $(MAIN_LIBS) $(EXTRA_STATIC_LIBS)@USE_EXPORTFILES_TRUE@ $(top_builddir)/etc/R.exp
diff -ruN R-4.1.0-orig/src/nmath/standalone/Makefile.in R-4.1.0/src/nmath/standalone/Makefile.in
--- R-4.1.0-orig/src/nmath/standalone/Makefile.in 2021-08-06 09:01:05.000000000 +0900
+++ R-4.1.0/src/nmath/standalone/Makefile.in 2021-08-06 11:40:37.000000000 +0900
diff -ruN R-4.1.1-orig/src/nmath/standalone/Makefile.in R-4.1.1/src/nmath/standalone/Makefile.in
--- R-4.1.1-orig/src/nmath/standalone/Makefile.in 2023-12-01 18:46:07
+++ R-4.1.1/src/nmath/standalone/Makefile.in 2023-12-01 18:46:47
@@ -134,7 +134,7 @@

test: $(srcdir)/test.c
Expand Down