From b4c776e98eddcc49b3c465bd1fb947524444145a Mon Sep 17 00:00:00 2001 From: Yoshitaka Moriwaki Date: Tue, 11 Aug 2026 18:15:31 +0900 Subject: [PATCH 1/3] coot 1.3.2 --- Formula/coot.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Formula/coot.rb b/Formula/coot.rb index f6e48614a..b102ed0b6 100644 --- a/Formula/coot.rb +++ b/Formula/coot.rb @@ -1,8 +1,8 @@ class Coot < Formula desc "Crystallographic Object-Oriented Toolkit" homepage "https://www2.mrc-lmb.cam.ac.uk/personal/pemsley/coot/" - url "https://github.com/pemsley/coot/archive/refs/tags/Release-1.3.1.tar.gz" - sha256 "39069510b2bd499a407d5cc9202d4df591b353c344dd21aaf30e2ceab8260025" + url "https://github.com/pemsley/coot/archive/refs/tags/Release-1.3.2.tar.gz" + sha256 "8bd71e6582e87a8d2959bc1b956875a7f62c575b5a93ca60f2e575eaab42ff57" license any_of: ["GPL-3.0-only", "LGPL-3.0-only", "GPL-2.0-or-later"] head "https://github.com/pemsley/coot.git", branch: "main" @@ -105,13 +105,6 @@ def install "\nexec_prefix=" ENV.cxx11 ENV.libcxx - # clang 15 (macOS 14) predates C++20 parenthesized aggregate initialization - # (P0960, landed in clang 16), so this `new T(str)` on the plain aggregate - # em_placement_data_t fails to compile there. Brace-initialize it instead, - # which is valid C++17 and behaves identically (obj stays value-initialized). - inreplace "src/cc-interface-map-utils.cc", - "new em_placement_data_t(em_placement_output_file_name)", - "new em_placement_data_t{em_placement_output_file_name}" inreplace "autogen.sh", "libtool", "glibtool" system "./autogen.sh" if OS.mac? From 74e5b8a97c4940f3b8025721f2a0b2f3230b8b59 Mon Sep 17 00:00:00 2001 From: Yoshitaka Moriwaki Date: Tue, 11 Aug 2026 19:58:01 +0900 Subject: [PATCH 2/3] coot 1.3.2 --- Formula/coot.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Formula/coot.rb b/Formula/coot.rb index b102ed0b6..a26b96e64 100644 --- a/Formula/coot.rb +++ b/Formula/coot.rb @@ -105,6 +105,10 @@ def install "\nexec_prefix=" ENV.cxx11 ENV.libcxx + + inreplace "src/cc-interface-map-utils.cc", + "new em_placement_data_t(em_placement_output_file_name, 0)", + "new em_placement_data_t{em_placement_output_file_name}" inreplace "autogen.sh", "libtool", "glibtool" system "./autogen.sh" if OS.mac? From c6d565ed39e158d5f52f60bc7369eb6f7b67ae0f Mon Sep 17 00:00:00 2001 From: Yoshitaka Moriwaki Date: Tue, 11 Aug 2026 21:22:33 +0900 Subject: [PATCH 3/3] coot 1.3.2 --- Formula/coot.rb | 58 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Formula/coot.rb b/Formula/coot.rb index a26b96e64..c939c795a 100644 --- a/Formula/coot.rb +++ b/Formula/coot.rb @@ -6,8 +6,6 @@ class Coot < Formula license any_of: ["GPL-3.0-only", "LGPL-3.0-only", "GPL-2.0-or-later"] head "https://github.com/pemsley/coot.git", branch: "main" - # Track the tagged releases; the default git strategy otherwise picks junk - # tags like revision-count-* and reports a bogus version. livecheck do url :stable strategy :github_latest @@ -106,6 +104,60 @@ def install ENV.cxx11 ENV.libcxx + if OS.mac? + # coot's bare GTK4 window has no Dock icon on macOS. Build a tiny + # static helper that calls NSApplication#setApplicationIconImage via + # AppKit, and link it only into the MacCoot binary (see the OS_DARWIN + # block appended to src/Makefile.am below). + dock_icon_source = buildpath/"src/coot-macos-dock-icon.mm" + dock_icon_source.write <<~OBJCPP + #import + + extern "C" void set_coot_macos_dock_icon(const char *path) { + @autoreleasepool { + NSString *icon_path = [NSString stringWithUTF8String:path]; + NSImage *image = [[NSImage alloc] initWithContentsOfFile:icon_path]; + if (image != nil) { + [[NSApplication sharedApplication] setApplicationIconImage:image]; + [image release]; + } + } + } + OBJCPP + system ENV.cxx, "-c", dock_icon_source, "-o", "src/coot-macos-dock-icon.o" + system "ar", "rcs", "src/libcoot-macos-dock-icon.a", "src/coot-macos-dock-icon.o" + + # extern "C" linkage specifications are only valid at namespace scope, + # so the declaration goes just above startup(), and only the call + # itself goes inline after gtk_init(). + inreplace "src/startup.cc", "int startup(int argc, char **argv) {", <<~CPP.chomp + #ifdef __APPLE__ + extern "C" void set_coot_macos_dock_icon(const char *path); + #endif + + int startup(int argc, char **argv) { + CPP + + inreplace "src/startup.cc", "gtk_init();", <<~CPP.chomp + gtk_init(); + + #ifdef __APPLE__ + set_coot_macos_dock_icon("#{pkgshare}/coot-dock-icon.png"); + #endif + CPP + + inreplace "src/Makefile.am" do |s| + s.inreplace_string.sub!(/(MacCoot_LDADD\s*=.*?\$\(EMBEDDED_PYTHON_LIBS\))(\nelse\ncoot_1_LDADD)/m) do + "#{Regexp.last_match(1)} \\\n\tlibcoot-macos-dock-icon.a#{Regexp.last_match(2)}" + end + end + # automake requires linker flags such as -framework to live in + # _LDFLAGS rather than _LDADD. + inreplace "src/Makefile.am", + "MacCoot_LDFLAGS = $(EXPORT_DYNAMIC_FLAG_SPEC)", + "MacCoot_LDFLAGS = $(EXPORT_DYNAMIC_FLAG_SPEC) -framework AppKit" + end + inreplace "src/cc-interface-map-utils.cc", "new em_placement_data_t(em_placement_output_file_name, 0)", "new em_placement_data_t{em_placement_output_file_name}" @@ -149,6 +201,8 @@ def install system "make" ENV.deparallelize { system "make", "install" } bin.install_symlink libexec/"Maccoot" + # install the Dock icon image referenced by the AppKit helper above + pkgshare.install "pixmaps/icons/hicolor_apps_256x256_coot.png" => "coot-dock-icon.png" if OS.mac? # install reference data # install data, #{pkgshare} is /path/to/share/coot (pkgshare/"reference-structures").install resource("reference-structures")