unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Caldwell <david@porkrind.org>
To: Alan Third <alan@idiocy.org>, "Charles A. Roelli" <charles@aurox.ch>
Cc: David Reitter <david.reitter@gmail.com>,
	david+emacsformacosx@porkrind.org,
	Anders Lindgren <andlind@gmail.com>,
	27810@debbugs.gnu.org
Subject: bug#27810: NS runtime feature detection
Date: Tue, 12 Sep 2017 13:01:56 -0700	[thread overview]
Message-ID: <c553c3fd-70ba-67e1-03bd-2364e0144c14@porkrind.org> (raw)
In-Reply-To: <20170812155115.GA14919@breton.holly.idiocy.org>


[-- Attachment #1.1: Type: text/plain, Size: 4468 bytes --]

On 8/12/17 8:51 AM, Alan Third wrote:
> On Sat, Aug 12, 2017 at 01:13:56PM +0200, Charles A. Roelli wrote:
>> Hm, on second thoughts, it seems a bit overwrought to try doing this
>> weak linking only for the sake of forward-compatible builds.  It
>> should be enough to support only backward-compatible builds, so that
>> we might one day distribute Emacs as a .dmg (built on the latest macOS
>> and backwards-compatible with the oldest version of macOS that we
>> support).
> 
> I think this makes sense. Especially given we’re not able to actually
> create a stand‐alone .app without implementing something like...
> 
>> I also looked at the emacsformacosx.com build scripts, and it seems
>> like they're making copies of Emacs' dependent dynamic libraries,
>> including them in the application bundle, then using
>> install_name_tool(1) to patch the Emacs binary to depend on them (I
>> don't understand, though, how those scripts resolve dependencies
>> between the dynamic libraries themselves).

The install_name_tool stuff is to change the absolute paths in the
dynamic library load paths to application relative paths. And only for
extra dependency stuff that gets installed like gnutls (and eventually
more—I'd like ImageMagick, but I haven't been able to get relative paths
working with its plugin-architecture).

The relative paths still include the OS that they were compiled on so
the dylibs can find each other but not conflict with the other OS dylibs.

For instance, Emacs-Emacs.app/Contents/MacOS/Emacs-x86_64-10_9 has this
as one of it's load paths:

  @executable_path/lib-x86_64-10_9/libgnutls.30.dylib

and Emacs.app/Contents/MacOS/lib-x86_64-10_9/libgnutls.30.dylib has
stuff like:

  @executable_path/lib-x86_64-10_9/libp11-kit.0.dylib

It's pretty straightforward in the end, but it's not documented super
well, and it's sort of tricky that you have to manipulate all these
things manually.

> I wouldn’t have a problem with putting this capability in, but I don’t
> have the knowledge nor the inclination to do it myself.
> 
> I was going to write something up in INSTALL about building with
> feature detection, but I really don’t know how to put it. I don’t want
> to give the impression that if you use
> -DMAC_OS_X_VERSION_MIN_ALLOWED=1060 that it will magically build a
> portable .app. I began to wonder if it’s worth mentioning at all since
> I doubt any more than a handful of people will be interested in
> building with this option.
> 
> David and David, I hope it’s OK to include you in this. I thought you
> might be interested and perhaps have some thoughts on what we’re
> doing.
> 
> Basically, instead of detecting all macOS features at compile‐time,
> we’ve stuck in some code to detect them at run‐time. It causes
> compiler warnings, so by default it still limits features to those
> available at build‐time, but if you do something like:
> 
>     ./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 -O3 -g"
> 
> when building on macOS Sierra, you should, in theory, end up with an
> executable that will work correctly on every version of macOS back to
> 10.6, inclusive. We haven’t been able to properly test portability yet
> as it requires including dynamic libraries.

I would love that. As far as I know, that's the way Apple recommends
doing feature detection. Many of the complexities of the
EmacsForMacOS.com builds (like all the individual OS compiled versions)
are because Emacs does compile-time feature detection instead of
run-time. Compiling on old systems means having to jump through hoops
sometimes as different software stops being supported on them. I have to
download a "portable ruby" binary that homebrew made so that I can run
something newer than 1.8 on old OSes. For master branch builds I have to
run the autoconf stuff on an up-to-date Debian machine before handing it
off to the Mac build machines because it's really hard to automate
installing the latest autoconf in a way that supports stuff back to 10.6
(Homebrew is not available on 10.6, for instance).

So having a single backwards compatible version of Emacs would be very
very nice. The build-system is rickety and this would make it more
streamlined. And much easier for a random person to build a universal
app (btw I'd be happy to help produce official Mac builds if that is
ever wanted).

-David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-09-12 20:01 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
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 [this message]
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=c553c3fd-70ba-67e1-03bd-2364e0144c14@porkrind.org \
    --to=david@porkrind.org \
    --cc=27810@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=andlind@gmail.com \
    --cc=charles@aurox.ch \
    --cc=david+emacsformacosx@porkrind.org \
    --cc=david.reitter@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 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).