summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Justin Bauer <mjbauer95@gmail.com>2018-03-22 11:25:52 -0500
committerGitHub <noreply@github.com>2018-03-22 11:25:52 -0500
commit8889942e67e0ce1015331198344e492893ccd24b (patch)
treeed028fd3d42d8c1f285680c1f17e9b65e5bef519
parent678211bb37821597a8c4426664cbe3bc821ac70e (diff)
parent12f14a0909cec960337e9b8a5cf209b045003ffb (diff)
downloadnixlib-8889942e67e0ce1015331198344e492893ccd24b.tar
nixlib-8889942e67e0ce1015331198344e492893ccd24b.tar.gz
nixlib-8889942e67e0ce1015331198344e492893ccd24b.tar.bz2
nixlib-8889942e67e0ce1015331198344e492893ccd24b.tar.lz
nixlib-8889942e67e0ce1015331198344e492893ccd24b.tar.xz
nixlib-8889942e67e0ce1015331198344e492893ccd24b.tar.zst
nixlib-8889942e67e0ce1015331198344e492893ccd24b.zip
Merge pull request #31875 from jbaum98/texmacsDarwin
Add texmacsDarwin
-rw-r--r--pkgs/applications/editors/texmacs/common.nix68
-rw-r--r--pkgs/applications/editors/texmacs/darwin.nix59
-rw-r--r--pkgs/applications/editors/texmacs/darwin.patch29
-rw-r--r--pkgs/applications/editors/texmacs/default.nix89
-rw-r--r--pkgs/top-level/all-packages.nix13
5 files changed, 182 insertions, 76 deletions
diff --git a/pkgs/applications/editors/texmacs/common.nix b/pkgs/applications/editors/texmacs/common.nix
new file mode 100644
index 000000000000..ec2498aa69b9
--- /dev/null
+++ b/pkgs/applications/editors/texmacs/common.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchurl, tex, extraFonts, chineseFonts, japaneseFonts, koreanFonts }:
+rec {
+  extraFontsSrc = fetchurl {
+    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-extra-fonts-1.0-noarch.tar.gz";
+    sha256 = "0hylgjmd95y9yahbblmawkkw0i71vb145xxv2xqrmff81301n6k7";
+  };
+
+  fullFontsSrc = fetchurl {
+    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-windows-fonts-1.0-noarch.tar.gz";
+    sha256 = "1yxzjpqpm7kvx0ly5jmfpzlfhsh41b0ibn1v84qv6xy73r2vis2f";
+  };
+
+  chineseFontsSrc = fetchurl {
+    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-chinese-fonts.tar.gz";
+    sha256 = "0yprqjsx5mfsaxr525mcm3xqwcadzxp14njm38ir1325baada2fp";
+  };
+
+  japaneseFontsSrc = fetchurl {
+    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-japanese-fonts.tar.gz";
+    sha256 = "1dn6zvsa7gk59d61xicwpbapab3rm6kz48rp5w1bhmihxixw21jn";
+  };
+
+  koreanFontsSrc = fetchurl {
+    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-korean-fonts.tar.gz";
+    sha256 = "07axg57mqm3jbnm4lawx0h3r2h56xv9acwzjppryfklw4c27f5hh";
+  };
+
+  postPatch = (if tex == null then ''
+    gunzip < ${fullFontsSrc} | (cd TeXmacs && tar xvf -)
+   '' else if extraFonts then ''
+    gunzip < ${extraFontsSrc} | (cd TeXmacs && tar xvf -)
+   '' else "") +
+   (if chineseFonts then ''
+    gunzip < ${chineseFontsSrc} | (cd TeXmacs && tar xvf -)
+   '' else "") +
+   (if japaneseFonts then ''
+    gunzip < ${japaneseFontsSrc} | (cd TeXmacs && tar xvf -)
+   '' else "") +
+   (if koreanFonts then ''
+    gunzip < ${koreanFontsSrc} | (cd TeXmacs && tar xvf -)
+   '' else "");
+
+
+  meta = {
+    description = "WYSIWYW editing platform with special features for scientists";
+    longDescription =
+    '' GNU TeXmacs is a free wysiwyw (what you see is what you want)
+    editing platform with special features for scientists.  The software
+    aims to provide a unified and user friendly framework for editing
+    structured documents with different types of content (text,
+    graphics, mathematics, interactive content, etc.).  The rendering
+    engine uses high-quality typesetting algorithms so as to produce
+    professionally looking documents, which can either be printed out or
+    presented from a laptop.
+
+    The software includes a text editor with support for mathematical
+    formulas, a small technical picture editor and a tool for making
+    presentations from a laptop.  Moreover, TeXmacs can be used as an
+    interface for many external systems for computer algebra, numerical
+    analysis, statistics, etc.  New presentation styles can be written
+    by the user and new features can be added to the editor using the
+    Scheme extension language.  A native spreadsheet and tools for
+    collaborative authoring are planned for later.
+  '';
+    homepage = http://texmacs.org/;
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/pkgs/applications/editors/texmacs/darwin.nix b/pkgs/applications/editors/texmacs/darwin.nix
new file mode 100644
index 000000000000..e319ccf39b1b
--- /dev/null
+++ b/pkgs/applications/editors/texmacs/darwin.nix
@@ -0,0 +1,59 @@
+{ stdenv, callPackage, fetchurl, makeWrapper,
+  guile_1_8, qt4, zlib, freetype, CoreFoundation, Cocoa, gettext, libiconv, ghostscript,
+  tex ? null,
+  aspell ? null,
+  netpbm ? null,
+  imagemagick ? null,
+  extraFonts ? false,
+  chineseFonts ? false,
+  japaneseFonts ? false,
+  koreanFonts ? false }:
+let
+  version = "1.99.4";
+  common = callPackage ./common.nix {
+    inherit tex extraFonts chineseFonts japaneseFonts koreanFonts;
+  };
+in
+stdenv.mkDerivation {
+  name = "TeXmacs-${version}";
+
+  src= fetchurl {
+    url = "http://www.texmacs.org/Download/ftp/tmftp/source/TeXmacs-${version}-src.tar.gz";
+    sha256 = "1z8sj0xd1ncbl7ipzfsib6lmc7ahgvmiw61ln5zxm2l88jf7qc1a";
+  };
+
+  patches = [ ./darwin.patch ];
+
+  buildInputs = [ guile_1_8.dev qt4 freetype CoreFoundation Cocoa gettext libiconv ghostscript ];
+
+  GUILE_CPPFLAGS="-D_THREAD_SAFE -I${guile_1_8.dev}/include -I${guile_1_8.dev}/include/guile ";
+
+  NIX_LDFLAGS="${zlib}/lib/libz.dylib";
+
+  buildPhase = ''
+    substituteInPlace Makefile \
+      --replace 'find -d $(MACOS_PACKAGE_TEXMACS)' 'find $(MACOS_PACKAGE_TEXMACS) -depth' \
+      --replace '$(MACOS_PACKAGE_SRC)/bundle-libs.sh' 'true'
+    make MACOS_BUNDLE
+  '';
+
+  installPhase = ''
+    mkdir -p $out/Applications
+    cp -R ../distr/TeXmacs-${version}.app $out/Applications
+  '';
+
+  inherit (common) postPatch;
+
+  postInstall = "wrapProgram $out/Applications/TeXmacs-${version}/Contents/MacOS/TeXmacs --suffix PATH : " +
+    "${ghostscript}/bin:" +
+    (if aspell == null then "" else "${aspell}/bin:") +
+    (if tex == null then "" else "${tex}/bin:") +
+    (if netpbm == null then "" else "${netpbm}/bin:") +
+    (if imagemagick == null then "" else "${imagemagick}/bin:");
+
+  enableParallelBuilding = true;
+
+  meta = common.meta // {
+    platforms = stdenv.lib.platforms.darwin;
+  };
+}
diff --git a/pkgs/applications/editors/texmacs/darwin.patch b/pkgs/applications/editors/texmacs/darwin.patch
new file mode 100644
index 000000000000..2cb33fbbef30
--- /dev/null
+++ b/pkgs/applications/editors/texmacs/darwin.patch
@@ -0,0 +1,29 @@
+--- a/configure
++++ b/configure
+@@ -7461,7 +7461,7 @@ $as_echo "final adjustments for cygwin host" >&6; }
+     CONFIG_QTPIPES="yes"
+     CONFIG_CXXFLAGS="-I${prefix}/include"
+     CONFIG_BSHARED=""
+-    CONFIG_BFLAGS="-framework Cocoa -framework IOKit"
++    CONFIG_BFLAGS="-framework Cocoa -framework IOKit -framework CoreFoundation"
+     CONFIG_BPATH=""
+     CONFIG_SO="dylib"
+     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
+@@ -8281,6 +8281,7 @@ _ASEOF
+   if $QMAKE ${additional_qmake_flags} ; then :; else
+     as_fn_error $? "Calling $QMAKE failed." "$LINENO" 5
+   fi
++  echo "QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10" >> $pro_file
+   # Try to compile a simple Qt app.
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build a simple Qt app" >&5
+ $as_echo_n "checking whether we can build a simple Qt app... " >&6; }
+--- a/src/Plugins/Unix/unix_sys_utils.cpp
++++ b/src/Plugins/Unix/unix_sys_utils.cpp
+@@ -17,6 +17,7 @@
+ #include <spawn.h>
+ #include <unistd.h>
+ #include <sys/wait.h>
++#include <pthread.h>
+ 
+ // for thread safe strings
+ #include <string>
diff --git a/pkgs/applications/editors/texmacs/default.nix b/pkgs/applications/editors/texmacs/default.nix
index e51813459c6f..447e729d4f9b 100644
--- a/pkgs/applications/editors/texmacs/default.nix
+++ b/pkgs/applications/editors/texmacs/default.nix
@@ -1,41 +1,21 @@
-{stdenv, fetchurl, guile_1_8, qt4, zlib, xmodmap, which, makeWrapper, freetype,
- tex ? null,
- aspell ? null,
- ghostscriptX ? null,
- extraFonts ? false,
- chineseFonts ? false,
- japaneseFonts ? false,
- koreanFonts ? false }:
-
-let 
+{ stdenv, callPackage,
+  fetchurl, guile_1_8, qt4, zlib, xmodmap, which, makeWrapper, freetype,
+  tex ? null,
+  aspell ? null,
+  ghostscriptX ? null,
+  extraFonts ? false,
+  chineseFonts ? false,
+  japaneseFonts ? false,
+  koreanFonts ? false }:
+
+let
   pname = "TeXmacs";
   version = "1.99.2";
-  extraFontsSrc = fetchurl {
-    url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-extra-fonts-1.0-noarch.tar.gz";
-    sha256 = "0hylgjmd95y9yahbblmawkkw0i71vb145xxv2xqrmff81301n6k7";
-  };
-
-  fullFontsSrc = fetchurl {
-   url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-windows-fonts-1.0-noarch.tar.gz";
-   sha256 = "1yxzjpqpm7kvx0ly5jmfpzlfhsh41b0ibn1v84qv6xy73r2vis2f";
-  };
-
-  chineseFontsSrc = fetchurl {
-   url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-chinese-fonts.tar.gz";
-   sha256 = "0yprqjsx5mfsaxr525mcm3xqwcadzxp14njm38ir1325baada2fp";
-  };
-
-  japaneseFontsSrc = fetchurl {
-   url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-japanese-fonts.tar.gz";
-   sha256 = "1dn6zvsa7gk59d61xicwpbapab3rm6kz48rp5w1bhmihxixw21jn";
-  };
-
-  koreanFontsSrc = fetchurl {
-   url = "ftp://ftp.texmacs.org/pub/TeXmacs/fonts/TeXmacs-korean-fonts.tar.gz";
-   sha256 = "07axg57mqm3jbnm4lawx0h3r2h56xv9acwzjppryfklw4c27f5hh";
+  common = callPackage ./common.nix {
+    inherit tex extraFonts chineseFonts japaneseFonts koreanFonts;
   };
 in
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   name = "${pname}-${version}";
 
   src = fetchurl {
@@ -45,56 +25,21 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ guile_1_8 qt4 makeWrapper ghostscriptX freetype ];
 
-  patchPhase = (if tex == null then ''
-    gunzip < ${fullFontsSrc} | (cd TeXmacs && tar xvf -)
-   '' else if extraFonts then ''
-    gunzip < ${extraFontsSrc} | (cd TeXmacs && tar xvf -)
-   '' else "") +
-   (if chineseFonts then ''
-    gunzip < ${chineseFontsSrc} | (cd TeXmacs && tar xvf -)
-   '' else "") +
-   (if japaneseFonts then ''
-    gunzip < ${japaneseFontsSrc} | (cd TeXmacs && tar xvf -)
-   '' else "") +
-   (if koreanFonts then ''
-    gunzip < ${koreanFontsSrc} | (cd TeXmacs && tar xvf -)
-   '' else "");
-
   postInstall = "wrapProgram $out/bin/texmacs --suffix PATH : " +
         (if ghostscriptX == null then "" else "${ghostscriptX}/bin:") +
         (if aspell == null then "" else "${aspell}/bin:") +
         (if tex == null then "" else "${tex}/bin:") +
         "${xmodmap}/bin:${which}/bin";
 
+  inherit (common) postPatch;
+
   postFixup = ''
     bin="$out/libexec/TeXmacs/bin/texmacs.bin"
     rpath=$(patchelf --print-rpath "$bin")
     patchelf --set-rpath "$rpath:${zlib.out}/lib" "$bin"
   '';
 
-  meta = {
-    description = "WYSIWYW editing platform with special features for scientists";
-    longDescription =
-      '' GNU TeXmacs is a free wysiwyw (what you see is what you want)
-         editing platform with special features for scientists.  The software
-         aims to provide a unified and user friendly framework for editing
-         structured documents with different types of content (text,
-         graphics, mathematics, interactive content, etc.).  The rendering
-         engine uses high-quality typesetting algorithms so as to produce
-         professionally looking documents, which can either be printed out or
-         presented from a laptop.
-
-         The software includes a text editor with support for mathematical
-         formulas, a small technical picture editor and a tool for making
-         presentations from a laptop.  Moreover, TeXmacs can be used as an
-         interface for many external systems for computer algebra, numerical
-         analysis, statistics, etc.  New presentation styles can be written
-         by the user and new features can be added to the editor using the
-         Scheme extension language.  A native spreadsheet and tools for
-         collaborative authoring are planned for later.
-      '';
-    homepage = http://texmacs.org/;
-    license = stdenv.lib.licenses.gpl2Plus;
+  meta = common.meta // {
     maintainers = [ stdenv.lib.maintainers.roconnor ];
     platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
   };
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c4d153bd8b9a..ccbb43bf2b6b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5030,10 +5030,15 @@ with pkgs;
 
   tewisay = callPackage ../tools/misc/tewisay { };
 
-  texmacs = callPackage ../applications/editors/texmacs {
-    tex = texlive.combined.scheme-small;
-    extraFonts = true;
-  };
+  texmacs = if stdenv.isDarwin
+    then callPackage ../applications/editors/texmacs/darwin.nix {
+      inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
+      tex = texlive.combined.scheme-small;
+      extraFonts = true;
+    } else callPackage ../applications/editors/texmacs {
+      tex = texlive.combined.scheme-small;
+      extraFonts = true;
+    };
 
   texmaker = libsForQt5.callPackage ../applications/editors/texmaker { };