summary refs log tree commit diff
path: root/pkgs/applications/misc/survex
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2021-06-14 02:22:25 +0100
committermatthewcroughan <matt@croughan.sh>2021-06-14 02:22:25 +0100
commitfb41ef3aaf69dd35677463bff729b6961e0a904c (patch)
tree1d8c0984358308838dc7fabb8c4016f3a7509fc9 /pkgs/applications/misc/survex
parent05ed13f835e0b0f2c3117179791b08dd759b7ec7 (diff)
downloadnixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar.gz
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar.bz2
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar.lz
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar.xz
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.tar.zst
nixpkgs-fb41ef3aaf69dd35677463bff729b6961e0a904c.zip
survex: support Darwin build
Diffstat (limited to 'pkgs/applications/misc/survex')
-rw-r--r--pkgs/applications/misc/survex/default.nix31
1 files changed, 25 insertions, 6 deletions
diff --git a/pkgs/applications/misc/survex/default.nix b/pkgs/applications/misc/survex/default.nix
index e905e44e098..f6865f877d7 100644
--- a/pkgs/applications/misc/survex/default.nix
+++ b/pkgs/applications/misc/survex/default.nix
@@ -4,6 +4,7 @@
 , autoreconfHook
 , pkg-config
 , wxGTK30-gtk3
+, wxmac
 , ffmpeg
 , proj
 , perl532
@@ -14,13 +15,26 @@
 , xlibsWrapper
 , docbook2x
 , docbook5
+, Carbon
+, Cocoa
 }:
 
+let
+  perlenv = perl532.withPackages (perlPackages: with perlPackages; [ LocalePO ] );
+in
 stdenv.mkDerivation rec {
   pname = "survex";
   version = "1.2.44";
 
-  nativeBuildInputs = [ docbook5 x11 libGL libGLU docbook2x autoreconfHook pkg-config wxGTK30-gtk3 ffmpeg proj python (perl532.withPackages (perlPackages: with perlPackages; [ LocalePO ] )) ];
+  nativeBuildInputs = [ docbook5 docbook2x autoreconfHook pkg-config perlenv python ];
+
+  buildInputs = [
+    libGL libGLU ffmpeg proj
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    wxmac Carbon Cocoa
+  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
+    wxGTK30-gtk3 xlibsWrapper
+  ];
 
   src = fetchgit {
     url = "git://git.survex.com/survex";
@@ -28,20 +42,25 @@ stdenv.mkDerivation rec {
     sha256 = "11gaqmabrf3av665jy3mr0m8hg76fmvnd0g3rghzmyh8d8v6xk34";
   };
 
+  enableParallelBuilding = true;
+
   # Docs rely on sgmltools-lite, a package that would be quite complex to
   # provide as it is quite old. So this preConfigure hook effectively disables
   # the doc generation. An example of packaging sgmltools-lite from Gentoo can
   # be found here:
   # https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/sgmltools-lite/sgmltools-lite-3.0.3-r15.ebuild?id=0b8b716331049599ea3299981e3a9ea6e258c5e0
 
-  preConfigure = ''
+  postPatch = ''
+    patchShebangs .
     echo "" > doc/Makefile.am
-  '';
-
-  postConfigure = ''
     # substituteInPlace doc/Makefile --replace "docbook2man" "docbook2man --sgml" # Will be needed once sgmltools-lite is packaged.
+    for perltool in './extract-msgs.pl' './gettexttomsg.pl' '$(srcdir)/gdtconvert' '$(srcdir)/gen_img2aven'; do
+      substituteInPlace src/Makefile.am \
+        --replace "$perltool" "${perlenv}/bin/perl $perltool"
+    done
+    substituteInPlace lib/Makefile.am \
+      --replace '$(srcdir)/make-pixel-font' '${perlenv}/bin/perl $(srcdir)/make-pixel-font'
     substituteInPlace lib/make-pixel-font --replace /usr/share/unifont/unifont.hex ${unscii.extra}/share/fonts/misc/unifont.hex
-    patchShebangs .
   '';
 
   meta = with lib; {