Skip to content
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
20 changes: 2 additions & 18 deletions pkgs/applications/editors/emacs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@ lib.makeScope pkgs.newScope (
inherit (self) callPackage;
inheritedArgs = {
inherit (pkgs.darwin) sigtool;
inherit (pkgs.darwin.apple_sdk.frameworks)
Accelerate
AppKit
Carbon
Cocoa
GSS
ImageCaptureCore
ImageIO
IOKit
OSAKit
Quartz
QuartzCore
WebKit
;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) UniformTypeIdentifiers;
};
in
{
sources = import ./sources.nix {
inherit lib;
inherit (pkgs)
fetchFromBitbucket
fetchFromGitHub
fetchFromSavannah
;
};
Expand All @@ -46,8 +32,6 @@ lib.makeScope pkgs.newScope (
withPgtk = true;
};

emacs28-macport = callPackage (self.sources.emacs28-macport) inheritedArgs;

emacs29-macport = callPackage (self.sources.emacs29-macport) inheritedArgs;
emacs30-macport = callPackage (self.sources.emacs30-macport) inheritedArgs;
}
)
12 changes: 12 additions & 0 deletions pkgs/applications/editors/emacs/macport-stdbool.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/conf_post.h b/src/conf_post.h
index e3272278832..01d3bcf9a81 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -58,6 +58,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#if NS_IMPL_GNUSTEP || defined __MINGW32__
typedef unsigned int bool_bf;
#else
+#include <stdbool.h> /* Clang in C mode does not automatically define bool unless you explicitly include that header */
typedef bool bool_bf;
#endif

4 changes: 4 additions & 0 deletions pkgs/applications/editors/emacs/macport_noescape_noop.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if __has_include("config.h")
#include "config.h"
#endif

#ifndef NOESCAPE_NOOP_H_
#define NOESCAPE_NOOP_H_

Expand Down
40 changes: 2 additions & 38 deletions pkgs/applications/editors/emacs/make-emacs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Xaw3d,
acl,
alsa-lib,
apple-sdk,
apple-sdk_14,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juuyokka is apple-sdk_14 the minimum sdk version that is needed for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has additional functionality on newer SDKs. There is no harm in using a newer SDK for a correctly-written application that does runtime availability checks before using newer APIs, and this appears to do so. However, macOS 14 will be the baseline for 25.11 anyway, so it may not be worth explicitly specifying until they implement optional functionality for newer versions.

autoreconfHook,
cairo,
dbus,
Expand Down Expand Up @@ -114,21 +114,6 @@
"lucid"
),

# macOS dependencies for NS and macPort
Accelerate,
AppKit,
Carbon,
Cocoa,
GSS,
IOKit,
ImageCaptureCore,
ImageIO,
OSAKit,
Quartz,
QuartzCore,
UniformTypeIdentifiers,
WebKit,

# test
callPackage,
}:
Expand Down Expand Up @@ -205,7 +190,7 @@ mkDerivation (finalAttrs: {
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# The linker needs to know where to find libSystem on Darwin.
"${apple-sdk.sdkroot}/usr/lib"
"${apple-sdk_14.sdkroot}/usr/lib"
]
)
)
Expand Down Expand Up @@ -372,27 +357,6 @@ mkDerivation (finalAttrs: {
]
++ lib.optionals withNS [
librsvg
AppKit
GSS
ImageIO
]
++ lib.optionals (variant == "macport") [
Accelerate
AppKit
Carbon
Cocoa
IOKit
OSAKit
Quartz
QuartzCore
WebKit
# TODO are these optional?
GSS
ImageCaptureCore
ImageIO
]
++ lib.optionals (variant == "macport" && stdenv.hostPlatform.isAarch64) [
UniformTypeIdentifiers
];

# Emacs needs to find movemail at run time, see info (emacs) Movemail
Expand Down
47 changes: 11 additions & 36 deletions pkgs/applications/editors/emacs/sources.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
lib,
fetchFromBitbucket,
fetchFromGitHub,
fetchFromSavannah,
}:

Expand Down Expand Up @@ -31,8 +32,8 @@ let
}
);
"macport" = (
fetchFromBitbucket {
owner = "mituharu";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this abandoned, or it is just dormant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge, it is only dormant. There doesn't appear to be a branch for Emacs 30, so I swapped sources to a fork until something stable comes out of the woodwork.

fetchFromGitHub {
owner = "jdtsmith";
repo = "emacs-mac";
inherit rev hash;
}
Expand Down Expand Up @@ -88,7 +89,9 @@ let
matthewbauer
panchoh
];
"macport" = with lib.maintainers; [ ];
"macport" = with lib.maintainers; [
lactose
];
}
.${variant};
platforms =
Expand Down Expand Up @@ -121,40 +124,12 @@ in
];
});

emacs28-macport = import ./make-emacs.nix (mkArgs {
pname = "emacs-mac";
version = "28.2";
variant = "macport";
rev = "emacs-28.2-mac-9.1";
hash = "sha256-Ne2jQ2nVLNiQmnkkOXVc5AkLVkTpm8pFC7VNY2gQjPE=";
patches = fetchpatch: [
# CVE-2022-45939
(fetchpatch {
url = "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=d48bb4874bc6cd3e69c7a15fc3c91cc141025c51";
hash = "sha256-TiBQkexn/eb6+IqJNDqR/Rn7S7LVdHmL/21A5tGsyJs=";
})

# https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00611.html
(fetchpatch {
url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/28.2/10_all_org-macro-eval.patch?id=af40e12cb742510e5d40a06ffc6dfca97e340dd6";
hash = "sha256-OdGt4e9JGjWJPkfJhbYsmQQc6jart4BH5aIKPIbWKFs=";
})
(fetchpatch {
url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/28.2/11_all_untrusted-content.patch?id=af40e12cb742510e5d40a06ffc6dfca97e340dd6";
hash = "sha256-wa2bsnCt5yFx0+RAFZGBPI+OoKkbrfkkMer/KBEc/wA=";
})
(fetchpatch {
url = "https://gitweb.gentoo.org/proj/emacs-patches.git/plain/emacs/28.2/12_all_org-remote-unsafe.patch?id=af40e12cb742510e5d40a06ffc6dfca97e340dd6";
hash = "sha256-b6WU1o3PfDV/6BTPfPNUFny6oERJCNsDrvflxX3Yvek=";
})
];
});

emacs29-macport = import ./make-emacs.nix (mkArgs {
emacs30-macport = import ./make-emacs.nix (mkArgs {
pname = "emacs-mac";
version = "29.1";
version = "30.1.50";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juuyokka I think latest version is now at "30.2.50". See jdtsmith/emacs-mac@34f3540

variant = "macport";
rev = "emacs-29.1-mac-10.0";
hash = "sha256-TE829qJdPjeOQ+kD0SfyO8d5YpJjBge/g+nScwj+XVU=";
rev = "a50f20585960d92510fb62c95cb12606218a2081";
hash = "sha256-Ap4ZBb9NYIbwLroOoqvpQU/hjhaJJDB+3/1V0Q2c6aA=";
patches = _: [ ./macport-stdbool.patch ];
});
}
2 changes: 2 additions & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ mapAliases {
emacs29-gtk3 = throw "Emacs 29 is removed due to CVEs which are fixed in Emacs 30"; # Added 2025-03-03
emacs29-nox = throw "Emacs 29 is removed due to CVEs which are fixed in Emacs 30"; # Added 2025-03-03
emacs29-pgtk = throw "Emacs 29 is removed due to CVEs which are fixed in Emacs 30"; # Added 2025-03-03
emacs28-macport = throw "Emacs 28 is removed due to CVEs which are fixed in Emacs 30"; # Added 2025-04-02
emacs29-macport = throw "Emacs 29 is removed due to CVEs which are fixed in Emacs 30"; # Added 2025-04-02
emacsMacport = emacs-macport; # Added 2023-08-10
emacsNativeComp = emacs; # Added 2022-06-08
emacsWithPackages = throw "'emacsWithPackages' has been renamed to/replaced by 'emacs.pkgs.withPackages'"; # Converted to throw 2024-10-17
Expand Down
5 changes: 2 additions & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14197,11 +14197,10 @@ with pkgs;
emacs30-nox
emacs30-pgtk

emacs28-macport
emacs29-macport
emacs30-macport
;

emacs-macport = emacs29-macport;
emacs-macport = emacs30-macport;
emacs = emacs30;
emacs-gtk = emacs30-gtk3;
emacs-nox = emacs30-nox;
Expand Down