From 42a9cfe540687fd32cfd23ff511c9e197f2fcc72 Mon Sep 17 00:00:00 2001 From: Atemu Date: Fri, 25 Sep 2020 11:40:46 +0200 Subject: [PATCH 1/3] mlterm: stdenv.lib -> lib --- .../terminal-emulators/mlterm/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/terminal-emulators/mlterm/default.nix b/pkgs/applications/terminal-emulators/mlterm/default.nix index 7c7906fc841f04..0ec8d7a474041a 100644 --- a/pkgs/applications/terminal-emulators/mlterm/default.nix +++ b/pkgs/applications/terminal-emulators/mlterm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, autoconf, makeDesktopItem +{ stdenv, lib, fetchurl, pkgconfig, autoconf, makeDesktopItem , libX11, gdk-pixbuf, cairo, libXft, gtk3, vte , harfbuzz #substituting glyphs with opentype fonts , fribidi, m17n_lib #bidi and encoding @@ -46,9 +46,9 @@ stdenv.mkDerivation rec { -L${stdenv.cc.cc.lib}/lib -lX11 -lgdk_pixbuf-2.0 -lcairo -lfontconfig -lfreetype -lXft -lvte-2.91 -lgtk-3 -lharfbuzz -lfribidi -lm17n - " + stdenv.lib.optionalString (openssl != null) " + " + lib.optionalString (openssl != null) " -lcrypto - " + stdenv.lib.optionalString (libssh2 != null) " + " + lib.optionalString (libssh2 != null) " -lssh2 "; @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { "--with-tools=mlclient,mlconfig,mlcc,mlterm-menu,mlimgloader,registobmp,mlfc" #mlterm-menu and mlconfig depend on enabling gnome3.at-spi2-core #and configuring ~/.mlterm/key correctly. - ] ++ stdenv.lib.optional (libssh2 == null) "--disable-ssh2"; + ] ++ lib.optional (libssh2 == null) "--disable-ssh2"; postInstall = '' install -D contrib/icon/mlterm-icon.svg "$out/share/icons/hicolor/scalable/apps/mlterm.svg" @@ -80,13 +80,13 @@ stdenv.mkDerivation rec { comment = "Terminal emulator"; desktopName = "mlterm"; genericName = "Terminal emulator"; - categories = stdenv.lib.concatStringsSep ";" [ + categories = lib.concatStringsSep ";" [ "Application" "System" "TerminalEmulator" ]; startupNotify = "false"; }; - meta = with stdenv.lib; { + meta = with lib; { description = "Multi Lingual TERMinal emulator on X11"; homepage = "http://mlterm.sourceforge.net/"; license = licenses.bsd3; From 62b33a614d9b57be89dcc2f2036dd4bc1e21a6e6 Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 31 Oct 2020 12:19:03 +0100 Subject: [PATCH 2/3] mlterm: add Darwin support --- .../terminal-emulators/mlterm/default.nix | 44 ++++++++++++++----- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/terminal-emulators/mlterm/default.nix b/pkgs/applications/terminal-emulators/mlterm/default.nix index 0ec8d7a474041a..eea267445a6cee 100644 --- a/pkgs/applications/terminal-emulators/mlterm/default.nix +++ b/pkgs/applications/terminal-emulators/mlterm/default.nix @@ -5,6 +5,7 @@ , openssl, libssh2 #build-in ssh , fcitx, ibus, uim #IME , wrapGAppsHook #color picker in mlconfig +, Cocoa #Darwin }: stdenv.mkDerivation rec { @@ -18,9 +19,25 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig autoconf wrapGAppsHook ]; buildInputs = [ - libX11 gdk-pixbuf.dev cairo libXft gtk3 vte - harfbuzz fribidi m17n_lib openssl libssh2 - fcitx ibus uim + libX11 + gdk-pixbuf.dev + cairo + libXft + gtk3 + harfbuzz + fribidi + ] ++ lib.optionals (!stdenv.isDarwin) [ + # need linker magic, not adapted for Darwin yet + openssl + libssh2 + + # Not supported on Darwin + vte + m17n_lib + + fcitx + ibus + uim ]; #bad configure.ac and Makefile.in everywhere @@ -42,7 +59,7 @@ stdenv.mkDerivation rec { --replace "-m 2755 -g utmp" " " \ --replace "-m 4755 -o root" " " ''; - NIX_LDFLAGS = " + NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) " -L${stdenv.cc.cc.lib}/lib -lX11 -lgdk_pixbuf-2.0 -lcairo -lfontconfig -lfreetype -lXft -lvte-2.91 -lgtk-3 -lharfbuzz -lfribidi -lm17n @@ -53,23 +70,30 @@ stdenv.mkDerivation rec { "; configureFlags = [ - "--with-x=yes" - "--with-gui=xlib,fb" "--with-imagelib=gdk-pixbuf" #or mlimgloader depending on your bugs of choice "--with-type-engines=cairo,xft,xcore" "--with-gtk=3.0" "--enable-ind" #indic scripts "--enable-fribidi" #bidi scripts - "--enable-m17nlib" #character encodings "--with-tools=mlclient,mlconfig,mlcc,mlterm-menu,mlimgloader,registobmp,mlfc" #mlterm-menu and mlconfig depend on enabling gnome3.at-spi2-core #and configuring ~/.mlterm/key correctly. - ] ++ lib.optional (libssh2 == null) "--disable-ssh2"; + ] ++ lib.optionals (!stdenv.isDarwin) [ + "--with-x=yes" + "--with-gui=xlib,fb" + "--enable-m17nlib" #character encodings + ] ++ lib.optionals stdenv.isDarwin [ + "--with-gui=quartz" + ] ++ lib.optionals (libssh2 == null) [ " --disable-ssh2" ]; postInstall = '' install -D contrib/icon/mlterm-icon.svg "$out/share/icons/hicolor/scalable/apps/mlterm.svg" install -D contrib/icon/mlterm-icon-gnome2.png "$out/share/icons/hicolor/48x48/apps/mlterm.png" install -D -t $out/share/applications $desktopItem/share/applications/* + '' + lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications/ + cp -a cocoa/mlterm.app $out/Applications/ + install $out/bin/mlterm -Dt $out/Applications/mlterm.app/Contents/MacOS/ ''; desktopItem = makeDesktopItem { @@ -87,10 +111,10 @@ stdenv.mkDerivation rec { }; meta = with lib; { - description = "Multi Lingual TERMinal emulator on X11"; + description = "Multi Lingual TERMinal emulator"; homepage = "http://mlterm.sourceforge.net/"; license = licenses.bsd3; maintainers = with maintainers; [ vrthra ramkromberg ]; - platforms = with platforms; linux; + platforms = with platforms; linux ++ darwin; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 82bf8bc78cabb7..0f5f1970012966 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -722,6 +722,7 @@ in mlterm = callPackage ../applications/terminal-emulators/mlterm { libssh2 = null; openssl = null; + inherit (darwin.apple_sdk.frameworks) Cocoa; }; mrxvt = callPackage ../applications/terminal-emulators/mrxvt { }; From c6b47ff67838b9cedf3fc0e1df9afd1fcf1cb88a Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 31 Oct 2020 12:32:38 +0100 Subject: [PATCH 3/3] mlterm: add myself as maintainer --- pkgs/applications/terminal-emulators/mlterm/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/terminal-emulators/mlterm/default.nix b/pkgs/applications/terminal-emulators/mlterm/default.nix index eea267445a6cee..853fe22f0bf2c0 100644 --- a/pkgs/applications/terminal-emulators/mlterm/default.nix +++ b/pkgs/applications/terminal-emulators/mlterm/default.nix @@ -114,7 +114,7 @@ stdenv.mkDerivation rec { description = "Multi Lingual TERMinal emulator"; homepage = "http://mlterm.sourceforge.net/"; license = licenses.bsd3; - maintainers = with maintainers; [ vrthra ramkromberg ]; + maintainers = with maintainers; [ vrthra ramkromberg atemu ]; platforms = with platforms; linux ++ darwin; }; }