From ee16dba6303b69c1915bb930924544ef4676540b Mon Sep 17 00:00:00 2001 From: Josef Kemetmueller Date: Sat, 30 Jul 2016 12:42:36 +0200 Subject: [PATCH 1/3] motif: Add darwin support --- .../motif/Add-X.Org-to-bindings-file.patch | 7 ++++++ .../motif/Do-not-compile-demos.patch | 11 ++++++++++ ...move-unsupported-weak-refs-on-darwin.patch | 12 ++++++++++ .../motif/Use-correct-header-for-malloc.patch | 19 ++++++++++++++++ pkgs/development/libraries/motif/default.nix | 22 +++++++++---------- 5 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 pkgs/development/libraries/motif/Add-X.Org-to-bindings-file.patch create mode 100644 pkgs/development/libraries/motif/Do-not-compile-demos.patch create mode 100644 pkgs/development/libraries/motif/Remove-unsupported-weak-refs-on-darwin.patch create mode 100644 pkgs/development/libraries/motif/Use-correct-header-for-malloc.patch 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 00000000000..84b62dcd4eb --- /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 00000000000..1b8df94d007 --- /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 00000000000..801310ba41c --- /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 00000000000..d91e43ba2d3 --- /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 +-#include ++#if defined(__cplusplus) || defined(__STDC__) || defined(__EXTENSIONS__) ++# include ++# if defined(HAVE_MALLOC_H) ++# include ++# elif defined(HAVE_SYS_MALLOC_H) ++# include ++# endif ++#endif + #include + #include "wsm.h" + #include "wsmDebug.h" + diff --git a/pkgs/development/libraries/motif/default.nix b/pkgs/development/libraries/motif/default.nix index 9d50fb3d3d1..08b59deff59 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; [ ]; }; From 3d3d607408fb2a6a134c5d3cfcb945b094fab71d Mon Sep 17 00:00:00 2001 From: Josef Kemetmueller Date: Sun, 31 Jul 2016 10:41:20 +0200 Subject: [PATCH 2/3] catclock: Add darwin support --- pkgs/applications/misc/catclock/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/catclock/default.nix b/pkgs/applications/misc/catclock/default.nix index 8df06980b47..75f5ab406fe 100644 --- a/pkgs/applications/misc/catclock/default.nix +++ b/pkgs/applications/misc/catclock/default.nix @@ -26,6 +26,6 @@ stdenv.mkDerivation rec { homepage = http://codefromabove.com/2014/05/catclock/; license = with licenses; mit; maintainers = with maintainers; [ ramkromberg ]; - platforms = with platforms; linux; + platforms = with platforms; linux ++ darwin; }; } From 3a910eed61a50267fffe8ce2ea0110959a93cbd7 Mon Sep 17 00:00:00 2001 From: Josef Kemetmueller Date: Sun, 31 Jul 2016 20:54:10 +0200 Subject: [PATCH 3/3] nedit: Add darwin support --- pkgs/applications/editors/nedit/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/editors/nedit/default.nix b/pkgs/applications/editors/nedit/default.nix index 14220956698..8a478b27593 100644 --- a/pkgs/applications/editors/nedit/default.nix +++ b/pkgs/applications/editors/nedit/default.nix @@ -1,7 +1,5 @@ { stdenv, fetchurl, xlibsWrapper, motif, libXpm }: -assert stdenv.isLinux; - stdenv.mkDerivation rec { name = "nedit-5.6a"; @@ -12,7 +10,9 @@ stdenv.mkDerivation rec { buildInputs = [ xlibsWrapper motif libXpm ]; - buildFlags = if stdenv.isLinux then "linux" else ""; + buildFlags = if stdenv.isLinux then "linux" else + # the linux config works fine on darwin too! + if stdenv.isDarwin then "linux" else ""; NIX_CFLAGS_COMPILE="-DBUILD_UNTESTED_NEDIT -L${motif}/lib"; @@ -21,7 +21,8 @@ stdenv.mkDerivation rec { cp -p source/nedit source/nc $out/bin ''; - meta = { + meta = with stdenv.lib; { homepage = http://www.nedit.org; + platforms = with platforms; linux ++ darwin; }; }