2018-05-06 02:41:54 +01:00
|
|
|
{ stdenv, fetchurl, dpkg, makeWrapper, gcc, libGLU_combined, xdg_utils,
|
2017-05-01 21:14:25 +01:00
|
|
|
dbus_tools, alsaLib, cups, fontconfig, glib, icu, libpng12,
|
2018-05-06 02:41:54 +01:00
|
|
|
xkeyboard_config, zlib, libxslt, libxml2, sqlite, orc,
|
2017-05-01 21:14:25 +01:00
|
|
|
libX11, libXcursor, libXrandr, libxcb, libXi, libSM, libICE,
|
|
|
|
libXrender, libXcomposite }:
|
|
|
|
|
2018-05-06 02:41:54 +01:00
|
|
|
let version = "2018SP2"; in
|
2017-05-01 21:14:25 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "draftsight-${version}";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ dpkg makeWrapper ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
mkdir $out/draftsight
|
|
|
|
dpkg -x $src $out/draftsight
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Both executables and bundled libraries need patching to find their
|
|
|
|
# dependencies. The makeWrapper & QT_XKB_CONFIG_ROOT is to
|
|
|
|
# alleviate "xkbcommon: ERROR: failed to add default include path
|
|
|
|
# /usr/share/X11/xkb" and "Qt: Failed to create XKB context!".
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out/bin
|
|
|
|
for exe in DraftSight dsHttpApiController dsHttpApiService FxCrashRptApp HelpGuide; do
|
|
|
|
echo "Patching $exe..."
|
|
|
|
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath $libPath:\$ORIGIN/../Libraries \
|
|
|
|
$out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe
|
|
|
|
makeWrapper $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe \
|
|
|
|
$out/bin/$exe \
|
|
|
|
--prefix "QT_XKB_CONFIG_ROOT" ":" "${xkeyboard_config}/share/X11/xkb"
|
|
|
|
done
|
2018-05-06 02:41:54 +01:00
|
|
|
for lib in $out/draftsight/opt/dassault-systemes/DraftSight/Libraries/*.so*; do
|
2017-05-01 21:14:25 +01:00
|
|
|
# DraftSight ships with broken symlinks for some reason
|
|
|
|
if [ -f $(readlink -f $lib) ]
|
|
|
|
then
|
|
|
|
echo "Patching $lib..."
|
|
|
|
patchelf --set-rpath $libPath:\$ORIGIN/../Libraries $lib
|
|
|
|
else
|
|
|
|
echo "Ignoring broken link $lib"
|
|
|
|
fi
|
|
|
|
done
|
2018-05-06 02:41:54 +01:00
|
|
|
for lib in $out/draftsight/opt/dassault-systemes/DraftSight/APISDK/lib/cpp/*.so*; do
|
|
|
|
if [ -f $(readlink $lib) ]
|
|
|
|
then
|
|
|
|
echo "Patching $lib..."
|
|
|
|
chmod u+w $lib
|
|
|
|
patchelf --set-rpath $libPath:\$ORIGIN/../Libraries $lib
|
|
|
|
else
|
|
|
|
echo "Ignoring broken link $lib"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
# These libraries shouldn't really be here anyway:
|
|
|
|
find $out/draftsight/opt/dassault-systemes/DraftSight/APISDK/Samples/C++ \
|
|
|
|
-type d -name _lib | xargs rm -r
|
2017-05-01 21:14:25 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# TODO: Figure out why HelpGuide segfaults at startup.
|
|
|
|
|
|
|
|
# This must be here for main window graphics to appear (without it
|
|
|
|
# it also gives the error: "QXcbIntegration: Cannot create platform
|
|
|
|
# OpenGL context, neither GLX nor EGL are enabled"). My guess is
|
|
|
|
# that it dlopen()'s libraries in paths removed by shrinking RPATH.
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
2018-05-06 02:41:54 +01:00
|
|
|
src = fetchurl {
|
2017-05-01 21:14:25 +01:00
|
|
|
name = "draftSight.deb";
|
2018-05-06 02:41:54 +01:00
|
|
|
url = "http://dl-ak.solidworks.com/nonsecure/draftsight/${version}/draftSight.deb";
|
|
|
|
sha256 = "05lrvml0zkzqg0sj6sj2h8h66hxdmsw5fg9fwz923r1y8j48qxdx";
|
2017-05-01 21:14:25 +01:00
|
|
|
};
|
|
|
|
|
2018-02-24 13:12:44 +00:00
|
|
|
libPath = stdenv.lib.makeLibraryPath [ gcc.cc libGLU_combined xdg_utils
|
2017-05-01 21:14:25 +01:00
|
|
|
dbus_tools alsaLib cups.lib fontconfig glib icu libpng12
|
2018-05-06 02:41:54 +01:00
|
|
|
xkeyboard_config zlib libxslt libxml2 sqlite orc libX11
|
2017-05-01 21:14:25 +01:00
|
|
|
libXcursor libXrandr libxcb libXi libSM libICE libXrender
|
|
|
|
libXcomposite ];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "2D design & drafting application, meant to be similar to AutoCAD";
|
|
|
|
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.";
|
|
|
|
homepage = https://www.3ds.com/products-services/draftsight-cad-software/;
|
|
|
|
license = stdenv.lib.licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ hodapp ];
|
2018-05-03 06:58:11 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2017-05-01 21:14:25 +01:00
|
|
|
};
|
|
|
|
}
|