about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJosef Kemetmueller <josef.kemetmueller@aon.at>2016-07-30 12:42:36 +0200
committerJosef Kemetmueller <josef.kemetmueller@aon.at>2016-07-31 20:21:24 +0200
commitee16dba6303b69c1915bb930924544ef4676540b (patch)
tree13a84bb2a45a249879ee8bcf7855efb82378d103 /pkgs
parent2f32588a8fbd598bc5606857e055f94d388d3113 (diff)
downloadnixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar.gz
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar.bz2
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar.lz
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar.xz
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.tar.zst
nixlib-ee16dba6303b69c1915bb930924544ef4676540b.zip
motif: Add darwin support
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch7
-rw-r--r--pkgs/development/libraries/motif/Do-not-compile-demos.patch11
-rw-r--r--pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch12
-rw-r--r--pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch19
-rw-r--r--pkgs/development/libraries/motif/default.nix22
5 files changed, 60 insertions, 11 deletions
diff --git a/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch b/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch
new file mode 100644
index 000000000000..84b62dcd4eb0
--- /dev/null
+++ b/pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch
@@ -0,0 +1,7 @@
+--- a/bindings/xmbind.alias
++++ b/bindings/xmbind.alias
+@@ -62,3 +62,4 @@
+ "Sun Microsystems, Inc."				sun
+ ! "Sun Microsystems, Inc."				sun_at
+ "Tektronix, Inc."					tek
++"The X.Org Foundation"				tpc
diff --git a/pkgs/development/libraries/motif/Do-not-compile-demos.patch b/pkgs/development/libraries/motif/Do-not-compile-demos.patch
new file mode 100644
index 000000000000..1b8df94d0077
--- /dev/null
+++ b/pkgs/development/libraries/motif/Do-not-compile-demos.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -27,7 +27,6 @@ SUBDIRS   = bindings bitmaps \
+              include \
+              tools \
+              clients \
+-             doc \
+-             demos
++             doc
+ AUTOMAKE_OPTIONS = 1.4
+ ACLOCAL_AMFLAGS = -I .
diff --git a/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch b/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch
new file mode 100644
index 000000000000..801310ba41ce
--- /dev/null
+++ b/pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch
@@ -0,0 +1,12 @@
+--- a/lib/Xm/XmP.h
++++ b/lib/Xm/XmP.h
+@@ -1437,7 +1437,7 @@ extern void _XmDestroyParentCallback(
+ 
+ #endif /* NO_XM_1_2_BC */
+ 
+-#if __GNUC__
++#if __GNUC__ && ! __APPLE__
+ #  define XM_DEPRECATED  __attribute__((__deprecated__))
+ #  define XM_ALIAS(sym)  __attribute__((__weak__,alias(#sym)))
+ #else
+
diff --git a/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch b/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch
new file mode 100644
index 000000000000..d91e43ba2d3c
--- /dev/null
+++ b/pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch
@@ -0,0 +1,19 @@
+--- a/demos/programs/workspace/xrmLib.c
++++ b/demos/programs/workspace/xrmLib.c
+@@ -30,7 +30,14 @@ static char rcsid[] = "$XConsortium: xrmLib.c /main/6 1995/07/14 10:01:41 drk $"
+ #endif
+ 
+ #include <stdio.h>
+-#include <malloc.h>
++#if defined(__cplusplus) || defined(__STDC__) || defined(__EXTENSIONS__)
++#  include <stdlib.h>
++#  if defined(HAVE_MALLOC_H)
++#  include <malloc.h>
++#  elif defined(HAVE_SYS_MALLOC_H)
++#  include <sys/malloc.h>
++#  endif
++#endif
+ #include <Xm/Xm.h>
+ #include "wsm.h"
+ #include "wsmDebug.h"
+
diff --git a/pkgs/development/libraries/motif/default.nix b/pkgs/development/libraries/motif/default.nix
index 9d50fb3d3d19..08b59deff59d 100644
--- a/pkgs/development/libraries/motif/default.nix
+++ b/pkgs/development/libraries/motif/default.nix
@@ -17,29 +17,29 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    pkgconfig libtool
+    libtool
     xlibsWrapper xbitmaps libXrender libXmu libXt
     expat libjpeg libpng libiconv
-  ] ++ stdenv.lib.optionals (!demoSupport) [ autoconf automake ];
+  ];
 
-  nativeBuildInputs = [ flex ];
+  nativeBuildInputs = [ pkgconfig flex ] ++ stdenv.lib.optionals (!demoSupport) [ autoconf automake ];
 
   propagatedBuildInputs = [ libXp libXau ];
 
   makeFlags = [ "CFLAGS=-fno-strict-aliasing" ];
 
-  patchPhase = ''
-    rm lib/Xm/Xm.h
-    echo -e '"The X.Org Foundation"\t\t\t\t\tpc' >>bindings/xmbind.alias
-  '' + stdenv.lib.optionalString (!demoSupport)
-  ''
-    sed -i -e '/^SUBDIRS/{:x;/\\$/{N;bx;};s/[ \t\n\\]*demos//;}' Makefile.am
-  '';
+  prePatch = ''rm lib/Xm/Xm.h'';
+
+  patches = [ ./Remove-unsupported-weak-refs-on-darwin.patch
+              ./Use-correct-header-for-malloc.patch
+              ./Add-X.Org-to-bindings-file.patch
+            ]
+            ++ stdenv.lib.optional (!demoSupport) ./Do-not-compile-demos.patch;
 
   meta = with stdenv.lib; {
     homepage = http://motif.ics.com;
     description = "Unix standard widget-toolkit and window-manager";
-    platforms = with platforms; linux;
+    platforms = with platforms; linux ++ darwin;
     license = with licenses; [ lgpl21 ];
     maintainers = with maintainers; [ ];
   };