unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: "Charles A. Roelli" <charles@aurox.ch>
Cc: Anders Lindgren <andlind@gmail.com>, 27810@debbugs.gnu.org
Subject: bug#27810: NS runtime feature detection
Date: Sun, 6 Aug 2017 22:29:29 +0100	[thread overview]
Message-ID: <20170806212929.GA62061@breton.holly.idiocy.org> (raw)
In-Reply-To: <87dde5f1-0010-584e-2dad-4f0fe932f1fa@aurox.ch>

On Sun, Aug 06, 2017 at 10:29:49PM +0200, Charles A. Roelli wrote:
> I ran a simple configure/compile with your patch installed, which worked
> fine.
> I then tried:
> 
> ./configure --with-ns CFLAGS=-DMAC_OS_X_VERSION_MIN_REQUIRED=1060
> -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g -O3
> 
> and ran into a few errors, which should be fixed with the attached
> patch applied on top of yours.  I've written notes on some of the
> changed parts below.

Thanks! These are exactly the kinds of errors I was expecting to see.

> Next, in src/nsterm.h:
> 
> +#define NSAppKitVersionNumber10_7 1138
> 
> New define, since it's referenced verbatim in nsterm.m:7017:

Ah, I didn’t even think of that. :)

> New scroll styles in 10.7+:
> 
> +enum {
> +    NSScrollerStyleLegacy = 0,
> +    NSScrollerStyleOverlay = 1
> +};
> +typedef NSInteger NSScrollerStyle;

I believe we can make this slightly neater:

    enum NSScrollerStyle {
      NSScrollerStyleLegacy = 0,
      NSScrollerStyleOverlay = 1
    };

> Add-on to the class declaration of NSScroller (not sure if this is the
> right way to do it).  Otherwise the compiler errors out on compiling
> the 10.7+ call to scrollerWidthForControlSize:
> 
> +@interface NSScroller(NSObject)
> ++ (CGFloat)scrollerWidthForControlSize:(NSControlSize)controlSize
> scrollerStyle:(NSScrollerStyle)scrollerStyle;
> +@end

Strange... Are you sure this one was an error and not just a warning?
We’re expecting warnings for this type of thing.

> Forward declarations for functions used by macfont.m (declared as weak
> imports since they won't all be available unless we're on 10.8+):
> 
> +void CTFontDrawGlyphs(CTFontRef font, const CGGlyph *glyphs, const CGPoint
> *positions, size_t count, CGContextRef context)
> __attribute__((weak_import));
> +#endif
> +
> +#if !defined (MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >=
> 1080
> +extern CFArrayRef CTFontCopyDefaultCascadeListForLanguages(CTFontRef font,
> CFArrayRef languagePrefList) __attribute__((weak_import));
> 
> The compiler issued no complaints here, but the linker would not link
> temacs unless the symbols were listed as permitted to be undefined,
> using this in src/Makefile:
> 
> ## System-specific LDFLAGS.
> LD_SWITCH_SYSTEM= -Wl,-U,_CTFontCopyDefaultCascadeListForLanguages
> -Wl,-U,_CTFontDrawGlyphs

I’ve done a bit more reading up on this and I think I’ve misunderstood
how this works, and probably mislead you.

It seems these functions need to be declared as weak in the definition
of the library they’re supposed to be in. If we declare them in the
Emacs code‐base then the linker, reasonably, expects the functions to
be in the Emacs code‐base.

The top answer here might explain it better:

https://stackoverflow.com/questions/274753/how-to-make-weak-linking-work-with-gcc

I suppose this means we simply can’t guarantee perfect forward
compatibility. It’s a shame, but I don’t see a way round it.

> If they look okay, could you please integrate these changes into your
> patch?  Thanks a lot for your help on this.

If you can confirm the scrollerWidthForControlSize thing, I’ll
incorporate everything else.

Thank you for your help.

Oh, by the way, are you able to check whether the .app built on 10.6
actually runs on something higher?
-- 
Alan Third





  reply	other threads:[~2017-08-06 21:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170716230109.GA54914@breton.holly.idiocy.org>
     [not found] ` <1ce59431-ff6b-dc89-31a6-8fc5bd4e3926@aurox.ch>
     [not found]   ` <CABr8ebb788TSgj=GgP26_nOK6O2SznZaDx9bTQOgxmYfkz321g@mail.gmail.com>
     [not found]     ` <e6be1e89-14a9-da0a-7d15-3f29dd37e91f@aurox.ch>
     [not found]       ` <20170718221629.GA55506@breton.holly.idiocy.org>
     [not found]         ` <bdf95a23-8ea2-73c4-35c9-2943e23a36dd@aurox.ch>
     [not found]           ` <CABr8ebYtZqNAa5t=QYhBWebcsdFvhXGsuO4t2d2P-UeKQ8hPTQ@mail.gmail.com>
     [not found]             ` <20170722112230.GA58424@breton.holly.idiocy.org>
     [not found]               ` <20170723121701.GA3730@breton.holly.idiocy.org>
     [not found]                 ` <508a4930-feab-588b-0ab9-f55a10ea85ec@aurox.ch>
2017-07-24 20:44                   ` bug#27810: NS runtime feature detection Alan Third
2017-07-24 20:53                     ` Glenn Morris
2017-07-25 17:56                       ` Alan Third
2017-07-25 18:22                         ` Charles A. Roelli
2017-07-25 20:08                           ` Anders Lindgren
2017-07-26 21:57                     ` Alan Third
2017-07-31 19:05                       ` Charles A. Roelli
2017-08-01 15:38                         ` Anders Lindgren
2017-08-01 22:03                           ` Alan Third
2017-08-06 20:29                             ` Charles A. Roelli
2017-08-06 21:29                               ` Alan Third [this message]
2017-08-07 19:23                                 ` Charles A. Roelli
2017-08-10 21:04                                   ` Alan Third
2017-08-12 11:13                                     ` Charles A. Roelli
2017-08-12 13:02                                       ` Charles A. Roelli
2017-08-16 20:31                                         ` Alan Third
2017-08-12 15:51                                       ` Alan Third
2017-09-12 20:01                                         ` David Caldwell
2017-09-12 20:06                                           ` David Reitter
2017-09-12 20:34                                             ` Alan Third
2017-09-12 20:29                                           ` Alan Third
2017-09-13 19:03                                             ` Charles A. Roelli
2017-07-24 20:22 bug#27810: macOS " Alan Third
2017-07-26  2:59 ` Richard Stallman
2017-07-26 16:06   ` Alan Third
2017-07-27  1:43     ` Richard Stallman
2017-07-27 17:31       ` Eli Zaretskii
2017-07-28 17:14         ` Richard Stallman
2017-07-28 17:36           ` Eli Zaretskii
2017-07-29 19:04             ` Richard Stallman
2017-07-31  0:45               ` Richard Stallman
2017-07-29 19:07     ` Richard Stallman
2017-07-30 12:12       ` Alan Third
2017-07-30 14:15         ` Eli Zaretskii
2017-07-31  0:47         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170806212929.GA62061@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=27810@debbugs.gnu.org \
    --cc=andlind@gmail.com \
    --cc=charles@aurox.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).