at 18.03-beta 76 lines 3.1 kB view raw
1{ stdenv, requireFile, dpkg, makeWrapper, gcc, libGLU_combined, xdg_utils, 2 dbus_tools, alsaLib, cups, fontconfig, glib, icu, libpng12, 3 xkeyboard_config, gstreamer, zlib, libxslt, libxml2, sqlite, orc, 4 libX11, libXcursor, libXrandr, libxcb, libXi, libSM, libICE, 5 libXrender, libXcomposite }: 6 7assert stdenv.system == "x86_64-linux"; 8 9let version = "2017-SP2"; in 10stdenv.mkDerivation { 11 name = "draftsight-${version}"; 12 13 nativeBuildInputs = [ dpkg makeWrapper ]; 14 15 unpackPhase = '' 16 mkdir $out 17 mkdir $out/draftsight 18 dpkg -x $src $out/draftsight 19 ''; 20 21 # Both executables and bundled libraries need patching to find their 22 # dependencies. The makeWrapper & QT_XKB_CONFIG_ROOT is to 23 # alleviate "xkbcommon: ERROR: failed to add default include path 24 # /usr/share/X11/xkb" and "Qt: Failed to create XKB context!". 25 installPhase = '' 26 mkdir $out/bin 27 for exe in DraftSight dsHttpApiController dsHttpApiService FxCrashRptApp HelpGuide; do 28 echo "Patching $exe..." 29 patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 30 --set-rpath $libPath:\$ORIGIN/../Libraries \ 31 $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe 32 makeWrapper $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe \ 33 $out/bin/$exe \ 34 --prefix "QT_XKB_CONFIG_ROOT" ":" "${xkeyboard_config}/share/X11/xkb" 35 done 36 for lib in $out/draftsight/opt/dassault-systemes/DraftSight/Libraries/*.so; do 37 # DraftSight ships with broken symlinks for some reason 38 if [ -f $(readlink -f $lib) ] 39 then 40 echo "Patching $lib..." 41 patchelf --set-rpath $libPath:\$ORIGIN/../Libraries $lib 42 else 43 echo "Ignoring broken link $lib" 44 fi 45 done 46 ''; 47 48 # TODO: Figure out why HelpGuide segfaults at startup. 49 50 # This must be here for main window graphics to appear (without it 51 # it also gives the error: "QXcbIntegration: Cannot create platform 52 # OpenGL context, neither GLX nor EGL are enabled"). My guess is 53 # that it dlopen()'s libraries in paths removed by shrinking RPATH. 54 dontPatchELF = true; 55 56 src = requireFile { 57 name = "draftSight.deb"; 58 url = "https://www.3ds.com/?eID=3ds_brand_download&uid=41&pidDown=13426&L=0"; 59 sha256 = "04i3dqza6y4p2059pqg5inp3qzr5jmiqplzzk7h1a6gh380v1rbr"; 60 }; 61 62 libPath = stdenv.lib.makeLibraryPath [ gcc.cc libGLU_combined xdg_utils 63 dbus_tools alsaLib cups.lib fontconfig glib icu libpng12 64 xkeyboard_config gstreamer zlib libxslt libxml2 sqlite orc libX11 65 libXcursor libXrandr libxcb libXi libSM libICE libXrender 66 libXcomposite ]; 67 68 meta = with stdenv.lib; { 69 description = "2D design & drafting application, meant to be similar to AutoCAD"; 70 longDescription = "Professional-grade 2D design and drafting solution from Dassault Systèmes that lets you create, edit, view and mark up any kind of 2D CAD drawing."; 71 homepage = https://www.3ds.com/products-services/draftsight-cad-software/; 72 license = stdenv.lib.licenses.unfree; 73 maintainers = with maintainers; [ hodapp ]; 74 platforms = platforms.linux; 75 }; 76}