about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-07-31 15:12:27 +0100
committerGitHub <noreply@github.com>2018-07-31 15:12:27 +0100
commit9cff865230d65cbb650187ca0d1cb6034e37ecd6 (patch)
tree21b03ffb3fec628ffa63e9e292577012410ea155 /pkgs/applications/science
parente858b285c8a795814970b56f797a3729886b7385 (diff)
parent71b579f9d49e3df0e3e4a6e1478adfc4e52e6aad (diff)
downloadnixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar.gz
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar.bz2
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar.lz
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar.xz
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.tar.zst
nixlib-9cff865230d65cbb650187ca0d1cb6034e37ecd6.zip
Merge pull request #44122 from bgamari/kicad-0.5
kicad: 4.0.7 -> 5.0.0
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/electronics/kicad/default.nix107
1 files changed, 54 insertions, 53 deletions
diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix
index e3244ec339ea..3e783d2e177c 100644
--- a/pkgs/applications/science/electronics/kicad/default.nix
+++ b/pkgs/applications/science/electronics/kicad/default.nix
@@ -1,72 +1,73 @@
-{ stdenv, fetchurl, cmake, libGLU_combined, wxGTK, zlib, libX11, gettext, glew, cairo, curl, openssl, boost, pkgconfig, doxygen }:
+{ wxGTK, lib, stdenv, fetchurl, cmake, libGLU_combined, zlib
+, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig
+, doxygen, pcre, libpthreadstubs, libXdmcp
+, wrapGAppsHook
+, oceSupport ? true, opencascade
+, ngspiceSupport ? true, libngspice
+, swig, python, pythonPackages
+}:
 
+assert ngspiceSupport -> libngspice != null;
+
+with lib;
 stdenv.mkDerivation rec {
   name = "kicad-${version}";
-  series = "4.0";
-  version = "4.0.7";
-
-  srcs = [
-    (fetchurl {
-      url = "https://code.launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
-      sha256 = "1hgxan9321szgyqnkflb0q60yjf4yvbcc4cpwhm0yz89qrvlq1q9";
-    })
-
-    (fetchurl {
-      url = "http://downloads.kicad-pcb.org/libraries/kicad-library-${version}.tar.gz";
-      sha256 = "1azb7v1y3l6j329r9gg7f4zlg0wz8nh4s4i5i0l9s4yh9r6i9zmv";
-    })
+  series = "5.0";
+  version = "5.0.0";
 
-    (fetchurl {
-      url = "http://downloads.kicad-pcb.org/libraries/kicad-footprints-${version}.tar.gz";
-      sha256 = "08qrz5zzsb5127jlnv24j0sgiryd5nqwg3lfnwi8j9a25agqk13j";
-    })
-  ];
-
-  sourceRoot = "kicad-${version}";
+  src = fetchurl {
+    url = "https://launchpad.net/kicad/${series}/${version}/+download/kicad-${version}.tar.xz";
+    sha256 = "17nqjszyvd25wi6550j981whlnb1wxzmlanljdjihiki53j84x9p";
+  };
 
-  cmakeFlags = ''
-    -DKICAD_SKIP_BOOST=ON
-    -DKICAD_BUILD_VERSION=${version}
-    -DKICAD_REPO_NAME=stable
+  postPatch = ''
+    substituteInPlace CMakeModules/KiCadVersion.cmake \
+      --replace no-vcs-found ${version}
   '';
 
-  enableParallelBuilding = true; # often fails on Hydra: fatal error: pcb_plot_params_lexer.h: No such file or directory
+  cmakeFlags = [
+    "-DKICAD_SCRIPTING=ON"
+    "-DKICAD_SCRIPTING_MODULES=ON"
+    "-DKICAD_SCRIPTING_WXPYTHON=ON"
+    # nix installs wxPython headers in wxPython package, not in wxwidget
+    # as assumed. We explicitely set the header location.
+    "-DCMAKE_CXX_FLAGS=-I${pythonPackages.wxPython}/include/wx-3.0"
+  ] ++ optionals (oceSupport) [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ]
+    ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON";
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake libGLU_combined wxGTK zlib libX11 gettext glew cairo curl openssl boost doxygen ];
+  nativeBuildInputs = [
+    # https://www.mail-archive.com/kicad-developers@lists.launchpad.net/msg29840.html
+    (cmake.override {majorVersion = "3.10";})
+    doxygen
+    pkgconfig
+    wrapGAppsHook
+    pythonPackages.wrapPython
+  ];
+  pythonPath = [ pythonPackages.wxPython ];
+  propagatedBuildInputs = [ pythonPackages.wxPython ];
 
-  # They say they only support installs to /usr or /usr/local,
-  # so we have to handle this.
-  patchPhase = ''
-    sed -i -e 's,/usr/local/kicad,'$out,g common/gestfich.cpp
-  '';
+  buildInputs = [
+    libGLU_combined zlib libX11 wxGTK pcre libXdmcp gettext glew glm libpthreadstubs
+    cairo curl openssl boost
+    swig python
+  ] ++ optional (oceSupport) opencascade
+    ++ optional (ngspiceSupport) libngspice;
 
-  postUnpack = ''
-    pushd $(pwd)
-  '';
+  # this breaks other applications in kicad
+  dontWrapGApps = true;
 
-  postInstall = ''
-    popd
+  preFixup = ''
+    buildPythonPath "$out $pythonPath"
+    gappsWrapperArgs+=(--set PYTHONPATH "$program_PYTHONPATH")
 
-    pushd kicad-library-*
-    cmake -DCMAKE_INSTALL_PREFIX=$out
-    make $MAKE_FLAGS
-    make install
-    popd
-
-    pushd kicad-footprints-*
-    mkdir -p $out/share/kicad/modules
-    cp -R *.pretty $out/share/kicad/modules/
-    popd
+    wrapProgram "$out/bin/kicad" "''${gappsWrapperArgs[@]}"
   '';
 
-
   meta = {
     description = "Free Software EDA Suite";
     homepage = http://www.kicad-pcb.org/;
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
-    hydraPlatforms = []; # 'output limit exceeded' error on hydra
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ berce ];
+    platforms = with platforms; linux;
   };
 }