summary refs log tree commit diff
path: root/pkgs/servers/x11
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-02-04 10:00:50 +0000
committerShea Levy <shea@shealevy.com>2015-02-04 10:00:50 +0000
commitdf430ab2ea31052a8b258fe533662e665b82d7fb (patch)
tree14d1852ac396c57082525cbd3b3764ca428d272c /pkgs/servers/x11
parentb611e3fb61a748e507e4cc4af7f4850cf33128a7 (diff)
downloadnixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar.gz
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar.bz2
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar.lz
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar.xz
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.tar.zst
nixpkgs-df430ab2ea31052a8b258fe533662e665b82d7fb.zip
Fix imake on darwin.
Taken from joelteon/nixpkgs@6b3f7e6fb06426e3535ddbcc3fce05c74a1c7588

Original author Mike Sperber <sperber@deinprogramm.de>
Diffstat (limited to 'pkgs/servers/x11')
-rw-r--r--pkgs/servers/x11/xorg/darwin-imake-setup-hook.sh1
-rw-r--r--pkgs/servers/x11/xorg/imake.patch22
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix6
3 files changed, 18 insertions, 11 deletions
diff --git a/pkgs/servers/x11/xorg/darwin-imake-setup-hook.sh b/pkgs/servers/x11/xorg/darwin-imake-setup-hook.sh
new file mode 100644
index 00000000000..6dbaf724092
--- /dev/null
+++ b/pkgs/servers/x11/xorg/darwin-imake-setup-hook.sh
@@ -0,0 +1 @@
+export IMAKECPP="@tradcpp@/bin/tradcpp"
diff --git a/pkgs/servers/x11/xorg/imake.patch b/pkgs/servers/x11/xorg/imake.patch
index 0426e448215..1d0ec88761d 100644
--- a/pkgs/servers/x11/xorg/imake.patch
+++ b/pkgs/servers/x11/xorg/imake.patch
@@ -1,15 +1,15 @@
-diff -ru -x '*~' imake-1.0.3-orig/imake.c imake-1.0.3/imake.c
---- imake-1.0.3-orig/imake.c	2009-10-16 23:45:43.000000000 +0200
-+++ imake-1.0.3/imake.c	2010-07-19 12:17:12.000000000 +0200
-@@ -1035,6 +1035,7 @@
+diff -Naur imake-1.0.7-orig/imake.c imake-1.0.7/imake.c
+--- imake-1.0.7-orig/imake.c	2013-08-17 10:11:50.000000000 +0000
++++ imake-1.0.7/imake.c	2015-02-04 09:41:59.000000000 +0000
+@@ -1045,6 +1045,7 @@
  static void
  get_distrib(FILE *inFile)
  {
 +#if 0
    struct stat sb;
  
-   static char* suse = "/etc/SuSE-release";
-@@ -1080,6 +1081,7 @@
+   static const char*   suse = "/etc/SuSE-release";
+@@ -1090,6 +1091,7 @@
       * at the content of /etc/debian_version */
      return;
    }
@@ -17,21 +17,21 @@ diff -ru -x '*~' imake-1.0.3-orig/imake.c imake-1.0.3/imake.c
    /* what's the definitive way to tell what any particular distribution is? */
  
    fprintf (inFile, "%s\n", "#define DefaultLinuxDistribution LinuxUnknown");
-@@ -1328,6 +1330,7 @@
+@@ -1337,6 +1339,7 @@
  static boolean
  get_gcc(char *cmd)
  {
 +#if 0
    struct stat sb;
-     static char* gcc_path[] = {
+     static const char* gcc_path[] = {
  #if defined(linux) || \
-@@ -1376,6 +1379,9 @@
+@@ -1385,6 +1388,9 @@
  	}
        }
      return FALSE;
 +#endif
-+    strcpy (cmd, "gcc");
++    strcpy (cmd, IMAKE_COMPILETIME_CPP);
 +    return TRUE;
  }
  
- #if defined CROSSCOMPILE || !defined __UNIXOS2__
+ #ifdef CROSSCOMPILE
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index 45122780cdd..eebb33fae63 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -49,6 +49,12 @@ in
     inherit (xorg) xorgcffiles;
     x11BuildHook = ./imake.sh;
     patches = [./imake.patch];
+    setupHook = if stdenv.isDarwin then ./darwin-imake-setup-hook.sh else null;
+    CFLAGS = [ "-DIMAKE_COMPILETIME_CPP=\\\"${if stdenv.isDarwin
+      then "${args.tradcpp}/bin/cpp"
+      else "gcc"}\\\""
+    ];
+    tradcpp = if stdenv.isDarwin then args.tradcpp else null;
   };
 
   mkfontdir = attrs: attrs // {