From: "Charles A. Roelli" <charles@aurox.ch>
To: Alan Third <alan@idiocy.org>
Cc: Anders Lindgren <andlind@gmail.com>, 27810@debbugs.gnu.org
Subject: bug#27810: NS runtime feature detection
Date: Mon, 7 Aug 2017 21:23:10 +0200 [thread overview]
Message-ID: <5d8b81c3-9a45-d59f-8dd1-c0ccc0a19c78@aurox.ch> (raw)
In-Reply-To: <20170806212929.GA62061@breton.holly.idiocy.org>
On 06/08/2017 23:29, Alan Third wrote:
>> 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
> };
Strange, it doesn't work here:
> nsterm.h:58: error: expected ‘)’ before ‘NSScrollerStyle’
>> 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.
Without it, I get this:
> nsterm.m: In function ‘+[EmacsScroller scrollerWidth]’:
> nsterm.m:8387: warning: ‘NSScroller’ may not respond to
‘+scrollerWidthForControlSize:scrollerStyle:’
> nsterm.m:8387: error: incompatible types in assignment
I think the compiler has to verify somehow that the result of the call
is a CGFloat.
Casting to CGFloat gives:
> nsterm.m:8387: error: pointer value used where a floating point value
was expected
>> 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.
Maybe I'm also confused. I thought we would be able to do this,
since:
- At link time, the symbol is marked as a weak reference, to be
resolved at runtime.
- At runtime, the dynamic linker resolves the reference to the weak
symbol, setting it to NULL if it isn't available. Normally the
definition of the function will be found in a dynamic library that
is part of macOS (as far as I understand).
The Apple compiler/linker should be capable of doing this, supposedly,
as long as you give the magical -Wl,-U,_symbol command line arguments
to the linker. See also https://stackoverflow.com/a/34983229.
>> 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?
I'd like to check, but wouldn't I need to either:
a) Statically link libraries Emacs depends on, or
b) Include the dependent libraries in the app bundle?
By the libraries Emacs depends on, I mean the ones starting with $HOME here:
$ otool -L src/emacs
src/emacs:
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
(compatibility version 45.0.0, current version 1038.36.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
(compatibility version 1.0.0, current version 275.0.0)
$HOME/Build/SnowLeopard/lib/libjpeg.9.dylib (compatibility version
12.0.0, current version 12.0.0)
$HOME/Build/SnowLeopard/lib/librsvg-2.2.dylib (compatibility
version 43.0.0, current version 43.16.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.11)
$HOME/Build/SnowLeopard/lib/libgio-2.0.0.dylib (compatibility
version 4503.0.0, current version 4503.0.0)
$HOME/Build/SnowLeopard/lib/libgdk_pixbuf-2.0.0.dylib
(compatibility version 3401.0.0, current version 3401.0.0)
$HOME/Build/SnowLeopard/lib/libgobject-2.0.0.dylib (compatibility
version 4503.0.0, current version 4503.0.0)
$HOME/Build/SnowLeopard/lib/libglib-2.0.0.dylib (compatibility
version 4503.0.0, current version 4503.0.0)
$HOME/Build/SnowLeopard/lib/libintl.9.dylib (compatibility version
11.0.0, current version 11.4.0)
$HOME/Build/SnowLeopard/lib/libcairo.2.dylib (compatibility version
11403.0.0, current version 11403.6.0)
$HOME/Build/SnowLeopard/lib/libxml2.2.dylib (compatibility version
12.0.0, current version 12.4.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current
version 5.4.0)
$HOME/Build/SnowLeopard/lib/libgnutls.30.dylib (compatibility
version 40.0.0, current version 40.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version
1.2.3)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current
version 227.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 550.44.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
(compatibility version 1.0.0, current version 38.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(compatibility version 300.0.0, current version 751.63.0)
Do either of these sound feasible?
next prev parent reply other threads:[~2017-08-07 19:23 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 11:29 Mac OS Sierra tab feature breaks C-x 5 2 Paul Michael Reilly
2017-07-06 12:14 ` Jean-Christophe Helary
2017-07-06 12:46 ` Sebastian Christ
2017-07-06 12:53 ` Alan Third
2017-07-06 14:35 ` Alan Third
2017-07-06 15:05 ` Jean-Christophe Helary
2017-07-06 17:42 ` Alan Third
2017-07-06 22:16 ` Alan Third
2017-07-10 19:17 ` Anders Lindgren
2017-07-10 19:52 ` Alan Third
2017-07-10 20:22 ` Anders Lindgren
2017-07-12 18:23 ` Alan Third
2017-07-12 21:20 ` Anders Lindgren
2017-07-13 20:22 ` Alan Third
2017-07-16 18:43 ` Anders Lindgren
2017-07-16 23:01 ` Alan Third
2017-07-17 20:09 ` Charles A. Roelli
2017-07-18 6:06 ` Anders Lindgren
2017-07-18 18:33 ` Charles A. Roelli
2017-07-18 22:16 ` Alan Third
2017-07-19 4:57 ` Charles A. Roelli
2017-07-21 20:31 ` Anders Lindgren
2017-07-22 11:22 ` Alan Third
2017-07-23 12:17 ` NS runtime feature detection (was: Mac OS Sierra tab feature breaks C-x 5 2) Alan Third
2017-07-24 19:02 ` NS runtime feature detection Charles A. Roelli
2017-07-24 20:44 ` bug#27810: " 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
2017-08-07 19:23 ` Charles A. Roelli [this message]
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:45 ` Alan Third
2017-07-23 22:35 ` Mac OS Sierra tab feature breaks C-x 5 2 Tim Cross
-- strict thread matches above, loose matches on Subject: below --
2017-07-24 20:22 bug#27810: macOS runtime feature detection 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d8b81c3-9a45-d59f-8dd1-c0ccc0a19c78@aurox.ch \
--to=charles@aurox.ch \
--cc=27810@debbugs.gnu.org \
--cc=alan@idiocy.org \
--cc=andlind@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.