Created
July 26, 2022 01:46
-
-
Save corpix/48e8f28ce129606f86311653ab48264b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {}, ... }: pkgs.libsForQt5.callPackage ({ pkgs ? import <nixpkgs> {} | |
, lib | |
, stdenv | |
, fetchFromGitHub | |
, fetchpatch | |
, cmake | |
, ninja | |
, netcdf | |
, coin3d | |
, eigen | |
, gfortran | |
, gts | |
, glew | |
, hdf5 | |
, libGLU | |
, libXmu | |
, libf2c | |
, libredwg | |
, libspnav | |
, medfile | |
, mpi | |
, ode | |
, opencascade-occt | |
, openmpi | |
, pkg-config | |
, swig | |
, vtk | |
, wrapGAppsHook | |
, xercesc | |
, zlib | |
, mkDerivation ? stdenv.mkDerivation | |
, python3Packages | |
, qtbase | |
, qttools | |
, qtwebengine | |
, qtx11extras | |
, qtxmlpatterns | |
, soqt | |
, spaceNavSupport ? stdenv.isLinux | |
, wrapQtAppsHook | |
}: let | |
inherit (python3Packages) | |
GitPython | |
boost | |
matplotlib | |
pivy | |
ply | |
pycollada | |
pyside2 | |
pyside2-tools | |
python | |
pyyaml | |
scipy | |
shiboken2 | |
; | |
in mkDerivation rec { | |
pname = "freecad-linkstage3"; | |
version = "d3895564b96aa0c2ed57bcd10034535f1043a396"; | |
src = fetchFromGitHub { | |
owner = "realthunder"; | |
repo = "FreeCAD"; | |
rev = version; | |
hash = "sha256-O1fU13CdOmkE6kGbtPiZEe31E3c1g5aG6BFHtmFdnkc="; | |
}; | |
nativeBuildInputs = [ | |
cmake | |
ninja | |
pkg-config | |
pyside2-tools | |
gfortran | |
wrapQtAppsHook | |
wrapGAppsHook | |
]; | |
buildInputs = [ | |
GitPython # for addon manager | |
boost | |
coin3d | |
netcdf | |
eigen | |
gts | |
glew | |
hdf5 | |
libGLU | |
libXmu | |
libf2c | |
matplotlib | |
medfile | |
mpi | |
ode | |
opencascade-occt | |
openmpi | |
pivy | |
ply # for openSCAD file support | |
pycollada | |
pyside2 | |
pyside2-tools | |
python | |
pyyaml # (at least for) PyrateWorkbench | |
qtbase | |
qttools | |
qtwebengine | |
qtxmlpatterns | |
scipy | |
shiboken2 | |
soqt | |
swig | |
vtk | |
xercesc | |
zlib | |
] ++ lib.optionals spaceNavSupport [ | |
libspnav | |
qtx11extras | |
]; | |
cmakeFlags = [ | |
"-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on | |
"-DBUILD_FLAT_MESH:BOOL=ON" | |
"-DBUILD_QT5=ON" | |
"-DSHIBOKEN_INCLUDE_DIR=${shiboken2}/include" | |
"-DSHIBOKEN_LIBRARY=Shiboken2::libshiboken" | |
("-DPYSIDE_INCLUDE_DIR=${pyside2}/include" | |
+ ";${pyside2}/include/PySide2/QtCore" | |
+ ";${pyside2}/include/PySide2/QtWidgets" | |
+ ";${pyside2}/include/PySide2/QtGui" | |
) | |
"-DFREECAD_USE_OCC_VARIANT='Official Version'" | |
"-DFREECAD_USE_EXTERNAL_PIVY=ON" | |
"-DFREECAD_USE_QT_FILEDIALOG=ON" | |
"-DPYSIDE_LIBRARY=PySide2::pyside2" | |
"-DPYTHON_EXECUTABLE=${python}/bin/python3" | |
]; | |
# This should work on both x86_64, and i686 linux | |
preBuild = '' | |
export NIX_LDFLAGS="-L${gfortran.cc}/lib64 -L${gfortran.cc}/lib $NIX_LDFLAGS"; | |
''; | |
# Their main() removes PYTHONPATH=, and we rely on it. | |
preConfigure = '' | |
sed '/putenv("PYTHONPATH/d' -i src/Main/MainGui.cpp | |
qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH") | |
''; | |
qtWrapperArgs = [ | |
"--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1" | |
"--prefix PATH : ${libredwg}/bin" | |
]; | |
postFixup = '' | |
mv $out/share/doc $out | |
ln -s $out/bin/FreeCAD $out/bin/freecad | |
ln -s $out/bin/FreeCADCmd $out/bin/freecadcmd | |
''; | |
}) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment