diff options
author | Evils <evils.devils@protonmail.com> | 2019-12-15 04:30:15 +0100 |
---|---|---|
committer | Evils <evils.devils@protonmail.com> | 2020-01-02 03:45:34 +0100 |
commit | 6119ca27bb65d55cd4fb798b9f24e8df721e6747 (patch) | |
tree | eb6577f1d6ddf54068b12d81401bb5186a748ac2 /pkgs/applications/science | |
parent | d96992a21b7e1df307c7f2d93ce795542a57bcf6 (diff) |
kicad: split wrapping and building
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r-- | pkgs/applications/science/electronics/kicad/base.nix | 11 | ||||
-rw-r--r-- | pkgs/applications/science/electronics/kicad/default.nix | 166 |
2 files changed, 62 insertions, 115 deletions
diff --git a/pkgs/applications/science/electronics/kicad/base.nix b/pkgs/applications/science/electronics/kicad/base.nix index adb2a418b6e5d..2d7cf9e1612e6 100644 --- a/pkgs/applications/science/electronics/kicad/base.nix +++ b/pkgs/applications/science/electronics/kicad/base.nix @@ -11,6 +11,7 @@ , ngspiceSupport ? true, libngspice , scriptingSupport ? true, swig, python, pythonPackages, wxPython , debug ? false, valgrind +, with3d ? true , withI18n ? true }: @@ -75,8 +76,10 @@ stdenv.mkDerivation rec { ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON" ++ optional (!withOCE) "-DKICAD_USE_OCE=OFF" ++ optional (!withOCC) "-DKICAD_USE_OCC=OFF" - ++ optionals (withOCE) - [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ] + ++ optionals (withOCE) [ + "-DKICAD_USE_OCE=ON" + "-DOCE_DIR=${opencascade}" + ] ++ optionals (withOCC) [ "-DKICAD_USE_OCC=ON" "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade" @@ -88,10 +91,6 @@ stdenv.mkDerivation rec { ] ; - pythonPath = - optionals (scriptingSupport) - [ wxPython pythonPackages.six ]; - nativeBuildInputs = [ cmake doxygen pkgconfig lndir ]; buildInputs = [ diff --git a/pkgs/applications/science/electronics/kicad/default.nix b/pkgs/applications/science/electronics/kicad/default.nix index 7164442d19c80..fb4edd1d21b95 100644 --- a/pkgs/applications/science/electronics/kicad/default.nix +++ b/pkgs/applications/science/electronics/kicad/default.nix @@ -1,22 +1,25 @@ -{ lib, stdenv, fetchFromGitLab, cmake, libGLU, libGL, zlib, wxGTK -, libX11, gettext, glew, glm, cairo, curl, openssl, boost, pkgconfig -, doxygen, pcre, libpthreadstubs, libXdmcp, makeWrapper, gnome3 -, gsettings-desktop-schemas, librsvg, hicolor-icon-theme, cups -, fetchpatch, lndir, callPackages +{ lib, stdenv, gnome3, pkgs, wxGTK30, wxGTK31 +, gsettings-desktop-schemas, hicolor-icon-theme +, callPackage, callPackages +, librsvg, cups , pname ? "kicad" , oceSupport ? false, opencascade , withOCCT ? true, opencascade-occt , ngspiceSupport ? true, libngspice -, scriptingSupport ? true, swig, python, pythonPackages, wxPython +, scriptingSupport ? true, swig, python3, python3Packages , debug ? false, valgrind , with3d ? true +, withI18n ? true }: assert ngspiceSupport -> libngspice != null; with lib; let + + stable = pname != "kicad-unstable"; + versions = { "kicad" = { kicadVersion = { @@ -36,10 +39,10 @@ let }; "kicad-unstable" = { kicadVersion = { - version = "2019-12-14"; + version = "2019-12-15"; src = { - rev = "74caf3b7cb89f5bff86ad470bed67d200f445ba5"; - sha256 = "083f79plfmxiwgbaldgqi1bqq01g2r153x3c4n7ipi2dn7m5f1lr"; + rev = "1abb198fb42c68ab8dd8ce6ff97d984df6688e10"; + sha256 = "1b7k05bl2w4by5bhk6sfb2iynddlg3gah8qma7l9am6q1j3lmx4p"; }; }; libVersion = { @@ -47,8 +50,8 @@ let libSources = { i18n.rev = "f1084526305005fa53e78000f7db2d67e8a0d423"; i18n.sha256 = "1yhc0m4psx0rz5msb1zqn5fz6l1ynwykrsk1443g4073lmjibv74"; - symbols.rev = "6dd82f11e4b2e60946dd07459e579cee0d42ca75"; - symbols.sha256 = "07mzaxn2isc6kj9zxl7syi013y4dfv5bvw9vlllbg8624mpwdibz"; + symbols.rev = "68176b08fdfd34673f4518ef6c331ad2ecf7a9a6"; + symbols.sha256 = "0kcn8pwdac5snd6vzmdw82k5x9q12nijpdss3nvi5my6g3ilwgjj"; templates.rev = "0c0490897f803ab8b7c3dad438b7eb1f80e0417c"; templates.sha256 = "0cs3bm3zb5ngw5ldn0lzw5bvqm4kvcidyrn76438alffwiz2b15g"; footprints.rev = "8cef00a34078c3dabe943a76f9cdf7d05ffc38fc"; @@ -59,104 +62,45 @@ let }; }; }; - versionConfig = versions.${pname}; + versionConfig = versions.${if (stable) then "kicad" else "kicad-unstable"}; + + wxGTK = if (stable) + # wxGTK3x may default to withGtk2 = false, see #73145 + then wxGTK30.override { withGtk2 = false; } + # wxGTK31 currently introduces an issue with opening the python interpreter in pcbnew + # but brings high DPI support? + else wxGTK31.override { withGtk2 = false; }; + + pythonPackages = python3Packages; + python = python3; + wxPython = python3Packages.wxPython_4_0; - # oce on aarch64 fails a test - withOCC = withOCCT || (stdenv.isAarch64 && oceSupport); - withOCE = oceSupport && !stdenv.isAarch64 && !withOCC; kicad-libraries = callPackages ./libraries.nix versionConfig.libVersion; + kicad-base = callPackage ./base.nix { + pname = if (stable) then "kicad" else "kicad-unstable"; + inherit versions stable; + inherit wxGTK python wxPython; + inherit debug with3d withI18n withOCCT oceSupport ngspiceSupport scriptingSupport; + }; + in stdenv.mkDerivation rec { inherit pname; - version = versions.${pname}.kicadVersion.version; - - src = fetchFromGitLab ({ - group = "kicad"; - owner = "code"; - repo = "kicad"; - rev = version; - } // versionConfig.kicadVersion.src); - - # quick fix for #72248 - # should be removed if a a more permanent fix is published - patches = [ - (fetchpatch { - url = "https://github.com/johnbeard/kicad/commit/dfb1318a3989e3d6f9f2ac33c924ca5030ea273b.patch"; - sha256 = "00ifd3fas8lid8svzh1w67xc8kyx89qidp7gm633r014j3kjkgcd"; - }) - ]; - - # tagged releases don't have "unknown" - postPatch = optional (pname == "kicad-unstable") - '' - substituteInPlace CMakeModules/KiCadVersion.cmake \ - --replace "unknown" ${version} - echo "replaced \"unknown\" with \"${version}\" in version name" - ''; - - makeFlags = optional (debug) [ "CFLAGS+=-Og" "CFLAGS+=-ggdb" ]; - - cmakeFlags = - optionals (scriptingSupport) [ - "-DKICAD_SCRIPTING=ON" - "-DKICAD_SCRIPTING_MODULES=ON" - "-DKICAD_SCRIPTING_PYTHON3=ON" - "-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON" - ] - ++ optional (!scriptingSupport) - "-DKICAD_SCRIPTING=OFF" - ++ optional (ngspiceSupport) "-DKICAD_SPICE=ON" - ++ optionals (withOCE) - [ "-DKICAD_USE_OCE=ON" "-DOCE_DIR=${opencascade}" ] - ++ optionals (withOCC) [ - "-DKICAD_USE_OCC=ON" - # this line is redundant on unstable... - # maybe may be removed on a later release - "-DKICAD_USE_OCE=OFF" - "-DOCC_INCLUDE_DIR=${opencascade-occt}/include/opencascade" - ] - ++ optionals (debug) [ - "-DCMAKE_BUILD_TYPE=Debug" - "-DKICAD_STDLIB_DEBUG=ON" - "-DKICAD_USE_VALGRIND=ON" - ] - ; - - pythonPath = - optionals (scriptingSupport) - [ wxPython pythonPackages.six ]; + version = versions.${if (stable) then "kicad" else "kicad-unstable"}.kicadVersion.version; - nativeBuildInputs = - [ cmake doxygen pkgconfig lndir ] - ++ optionals (scriptingSupport) - [ pythonPackages.wrapPython makeWrapper ] - ; - - buildInputs = [ - libGLU libGL zlib libX11 wxGTK pcre libXdmcp gettext - glew glm libpthreadstubs cairo curl openssl boost - ] - ++ optionals (scriptingSupport) [ swig python wxPython ] - ++ optional (ngspiceSupport) libngspice - ++ optional (withOCE) opencascade - ++ optional (withOCC) opencascade-occt - ++ optional (debug) valgrind - ; - - # debug builds fail all but the python test - # 5.1.x fails the eeschema test - doInstallCheck = !debug && (pname == "kicad-unstable"); - installCheckTarget = "test"; + src = kicad-base; - dontStrip = debug; + pythonPath = optionals (scriptingSupport) + [ wxPython pythonPackages.six ]; - postInstall = '' - mkdir -p $out/share - lndir ${kicad-libraries.i18n}/share $out/share - ''; + nativeBuildInputs = optionals (scriptingSupport) + [ pythonPackages.wrapPython ]; + # wrapGAppsHook added the equivalent to ${kicad-base}/share + # though i noticed no difference without it makeWrapperArgs = [ + "--prefix XDG_DATA_DIRS : ${kicad-base}/share" "--prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share" "--prefix XDG_DATA_DIRS : ${gnome3.defaultIconTheme}/share" "--prefix XDG_DATA_DIRS : ${wxGTK.gtk}/share/gsettings-schemas/${wxGTK.gtk.name}" @@ -178,36 +122,38 @@ stdenv.mkDerivation rec { ++ [ "--set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ] ; - # can't add $out stuff to makeWrapperArgs... - # wrapGAppsHook added the $out/share, though i noticed no difference without it - preFixup = + # dunno why i have to add $makeWrapperArgs manually... + # $out and $program_PYTHONPATH don't exist when makeWrapperArgs gets set? + # not sure if anything has to be done with the other stuff in kicad-base/bin + # dxf2idf, idf2vrml, idfcyl, idfrect, kicad2step, kicad-ogltest + installPhase = optionalString (scriptingSupport) '' buildPythonPath "$out $pythonPath" '' + - '' wrapProgram $out/bin/kicad $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/kicad $out/bin/kicad $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/pcbnew $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/pcbnew $out/bin/pcbnew $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/eeschema $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/eeschema $out/bin/eeschema $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/gerbview $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/gerbview $out/bin/gerbview $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/pcb_calculator $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/pcb_calculator $out/bin/pcb_calculator $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/pl_editor $makeWrapperArgs --prefix XDG_DATA_DIRS : $out/share '' + '' makeWrapper ${kicad-base}/bin/pl_editor $out/bin/pl_editor $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' + - '' wrapProgram $out/bin/bitmap2component $makeWrapperArgs '' + '' makeWrapper ${kicad-base}/bin/bitmap2component $out/bin/bitmap2component $makeWrapperArgs '' + optionalString (scriptingSupport) '' --set PYTHONPATH "$program_PYTHONPATH" '' ; meta = { - description = if (pname != "kicad-unstable") + description = if (stable) then "Open Source Electronics Design Automation Suite" else "Open Source EDA Suite, Development Build"; homepage = "https://www.kicad-pcb.org/"; @@ -216,7 +162,9 @@ stdenv.mkDerivation rec { The Programs handle Schematic Capture, and PCB Layout with Gerber output. ''; license = licenses.agpl3; + # berce seems inactive... maintainers = with maintainers; [ evils kiwi berce ]; + # kicad's cross-platform, not sure what to fill in here platforms = with platforms; linux; }; } |