From e35ddbec13a2b7d081fd83a2e4d1d286bd43ac41 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 23 Oct 2016 00:51:29 -0400 Subject: [PATCH 1/4] fltk: fix on darwin Compiling Fl_cocoa.mm... Fl_cocoa.mm:4079:30: error: use of undeclared identifier 'version'; did you mean 'Fl::version'? NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; ^~~~~~~ Fl::version ../FL/Fl.H:262:17: note: 'Fl::version' declared here static double version(); ^ Fl_cocoa.mm:4079:5: error: use of undeclared identifier 'NSOperatingSystemVersion' NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; ^ Fl_cocoa.mm:4080:9: error: use of undeclared identifier 'version' M = version.majorVersion; ^ Fl_cocoa.mm:4081:9: error: use of undeclared identifier 'version' m = version.minorVersion; ^ Fl_cocoa.mm:4082:9: error: use of undeclared identifier 'version' b = version.patchVersion; ^ 5 errors generated. --- pkgs/development/libraries/fltk/default.nix | 2 ++ pkgs/development/libraries/fltk/nsosv.patch | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/libraries/fltk/nsosv.patch diff --git a/pkgs/development/libraries/fltk/default.nix b/pkgs/development/libraries/fltk/default.nix index 99cb8aae3236..6f906d52502e 100644 --- a/pkgs/development/libraries/fltk/default.nix +++ b/pkgs/development/libraries/fltk/default.nix @@ -21,6 +21,8 @@ composableDerivation.composableDerivation {} { --replace 'class Fl_XFont_On_Demand' 'class FL_EXPORT Fl_XFont_On_Demand' ''; + patches = stdenv.lib.optionals stdenv.isDarwin [ ./nsosv.patch ]; + nativeBuildInputs = [ pkgconfig ]; propagatedBuildInputs = [ inputproto ] ++ (if stdenv.isDarwin diff --git a/pkgs/development/libraries/fltk/nsosv.patch b/pkgs/development/libraries/fltk/nsosv.patch new file mode 100644 index 000000000000..9e55b011b571 --- /dev/null +++ b/pkgs/development/libraries/fltk/nsosv.patch @@ -0,0 +1,20 @@ +diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm +index 6f5b8b1..2c7763d 100644 +--- a/src/Fl_cocoa.mm ++++ b/src/Fl_cocoa.mm +@@ -4074,15 +4074,6 @@ Window fl_xid(const Fl_Window* w) + static int calc_mac_os_version() { + int M, m, b = 0; + NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; +-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 +- if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { +- NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; +- M = version.majorVersion; +- m = version.minorVersion; +- b = version.patchVersion; +- } +- else +-#endif + { + NSDictionary * sv = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; + const char *s = [[sv objectForKey:@"ProductVersion"] UTF8String]; From a8eb57d953be65b86d1ba2cb583de513f4ac0a4b Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 23 Oct 2016 01:53:10 -0400 Subject: [PATCH 2/4] openblas: silence warnings on darwin Without this one gets a lot of build time warnings like: ld: warning: object file (/tmp/strip.2OzFn8) was built for newer OSX version (10.9) than being linked (10.7) --- pkgs/development/libraries/science/math/openblas/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 0cc79f6b44bc..3893875a2347 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -54,7 +54,7 @@ stdenv.mkDerivation { makeFlags = (if local then localFlags else genericFlags) ++ - optionals stdenv.isDarwin ["MACOSX_DEPLOYMENT_TARGET=10.9"] + optionals stdenv.isDarwin ["MACOSX_DEPLOYMENT_TARGET=10.7"] ++ [ "FC=gfortran" From f9b2f9bb92866511c456f3c70b342b0c4cdff621 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 23 Oct 2016 20:52:36 -0400 Subject: [PATCH 3/4] octave: use openblasCompat on darwin --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3d6a5631a274..c3a2100e4f76 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5477,7 +5477,7 @@ in glpk = null; suitesparse = null; jdk = null; - openblas = openblas; + openblas = if stdenv.isDarwin then openblasCompat else openblas; }; octaveFull = (lowPrio (callPackage ../development/interpreters/octave { qt = qt4; From 5994c12470205a265aa04280fa9f26465cb67590 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 23 Oct 2016 20:54:18 -0400 Subject: [PATCH 4/4] octave: mesa and libX11 are not used on darwin --- pkgs/development/interpreters/octave/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 3389620cdd94..df443cdc3e18 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -25,9 +25,9 @@ stdenv.mkDerivation rec { sha256 = "11y2w6jgngj4rxiy136mkcs02l52rxk60kapyfc4rgrxz5hli3ym"; }; - buildInputs = [ gfortran readline ncurses perl flex texinfo qhull libX11 - graphicsmagick pcre pkgconfig mesa fltk zlib curl openblas libsndfile - fftw fftwSinglePrec qrupdate arpack libwebp ] + buildInputs = [ gfortran readline ncurses perl flex texinfo qhull + graphicsmagick pcre pkgconfig fltk zlib curl openblas libsndfile fftw + fftwSinglePrec qrupdate arpack libwebp ] ++ (stdenv.lib.optional (qt != null) qt) ++ (stdenv.lib.optional (qscintilla != null) qscintilla) ++ (stdenv.lib.optional (ghostscript != null) ghostscript) @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { ++ (stdenv.lib.optional (jdk != null) jdk) ++ (stdenv.lib.optional (gnuplot != null) gnuplot) ++ (stdenv.lib.optional (python != null) python) - ++ (stdenv.lib.optionals (!stdenv.isDarwin) [mesa libX11]) + ++ (stdenv.lib.optionals (!stdenv.isDarwin) [ mesa libX11 ]) ; doCheck = !stdenv.isDarwin;