2016-05-26 16:45:45 +02:00
|
|
|
{ stdenv, lib, fetchurl, makeWrapper, fakeroot, file, getopt
|
2017-04-12 15:51:42 +02:00
|
|
|
, gtk2, gdk_pixbuf, glib, mesa_glu, postgresql, nss, nspr, udev
|
2016-05-26 16:45:45 +02:00
|
|
|
, alsaLib, GConf, cups, libcap, fontconfig, freetype, pango
|
|
|
|
, cairo, dbus, expat, zlib, libpng12, nodejs, gnutar, gcc, gcc_32bit
|
|
|
|
, libX11, libXcursor, libXdamage, libXfixes, libXrender, libXi
|
|
|
|
, libXcomposite, libXext, libXrandr, libXtst, libSM, libICE, libxcb
|
2016-09-11 23:24:51 +02:00
|
|
|
, mono, libgnomeui, gnome_vfs, gnome-sharp, gtk-sharp-2_0, chromium
|
2015-10-18 11:48:19 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2016-05-26 16:45:45 +02:00
|
|
|
libPath64 = lib.makeLibraryPath [
|
|
|
|
gcc.cc gtk2 gdk_pixbuf glib mesa_glu postgresql nss nspr
|
|
|
|
alsaLib GConf cups libcap fontconfig freetype pango
|
2017-04-12 15:51:42 +02:00
|
|
|
cairo dbus expat zlib libpng12 udev
|
2016-05-26 16:45:45 +02:00
|
|
|
libX11 libXcursor libXdamage libXfixes libXrender libXi
|
|
|
|
libXcomposite libXext libXrandr libXtst libSM libICE libxcb
|
2015-10-18 11:48:19 +02:00
|
|
|
];
|
2016-05-26 16:45:45 +02:00
|
|
|
libPath32 = lib.makeLibraryPath [ gcc_32bit.cc ];
|
|
|
|
binPath = lib.makeBinPath [ nodejs gnutar ];
|
|
|
|
developBinPath = lib.makeBinPath [ mono ];
|
|
|
|
developLibPath = lib.makeLibraryPath [
|
2016-09-11 23:24:51 +02:00
|
|
|
glib libgnomeui gnome_vfs gnome-sharp gtk-sharp-2_0 gtk-sharp-2_0.gtk
|
2016-05-26 16:45:45 +02:00
|
|
|
];
|
|
|
|
developDotnetPath = lib.concatStringsSep ":" [
|
2016-09-11 23:24:51 +02:00
|
|
|
gnome-sharp gtk-sharp-2_0
|
2016-05-26 16:45:45 +02:00
|
|
|
];
|
|
|
|
|
2017-04-12 15:51:42 +02:00
|
|
|
ver = "5.5.3";
|
2016-05-26 16:45:45 +02:00
|
|
|
build = "f1";
|
|
|
|
|
2015-10-18 11:48:19 +02:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "unity-editor-${version}";
|
2017-04-12 15:51:42 +02:00
|
|
|
version = "${ver}x${build}";
|
2015-10-18 11:48:19 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-04-12 15:51:42 +02:00
|
|
|
url = "http://beta.unity3d.com/download/a2454d41e248/unity-editor-installer-${version}Linux.sh";
|
|
|
|
sha256 = "1hvas4n1hm0qp0265gk1nh03kypd9690fnxvzg70f5ni9q97pvm0";
|
2015-10-18 11:48:19 +02:00
|
|
|
};
|
|
|
|
|
2016-05-26 16:45:45 +02:00
|
|
|
nosuidLib = ./unity-nosuid.c;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper fakeroot file getopt ];
|
|
|
|
|
2016-08-08 00:56:47 +02:00
|
|
|
outputs = [ "out" "monodevelop" ];
|
2015-10-18 11:48:19 +02:00
|
|
|
|
2017-04-12 15:51:42 +02:00
|
|
|
sourceRoot = "unity-editor-${version}Linux";
|
|
|
|
|
2015-10-18 11:48:19 +02:00
|
|
|
unpackPhase = ''
|
|
|
|
echo -e 'q\ny' | fakeroot sh $src
|
|
|
|
'';
|
|
|
|
|
2016-05-26 16:45:45 +02:00
|
|
|
buildPhase = ''
|
|
|
|
patchFile() {
|
|
|
|
ftype="$(file -b "$1")"
|
|
|
|
if [[ "$ftype" =~ LSB\ .*dynamically\ linked ]]; then
|
|
|
|
if [[ "$ftype" =~ 32-bit ]]; then
|
|
|
|
rpath="${libPath32}"
|
|
|
|
intp="$(cat $NIX_CC/nix-support/dynamic-linker-m32)"
|
|
|
|
else
|
|
|
|
rpath="${libPath64}"
|
|
|
|
intp="$(cat $NIX_CC/nix-support/dynamic-linker)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rpath="$(patchelf --print-rpath "$1"):$rpath"
|
|
|
|
if [[ "$ftype" =~ LSB\ shared ]]; then
|
|
|
|
patchelf \
|
|
|
|
--set-rpath "$rpath" \
|
|
|
|
"$1"
|
|
|
|
elif [[ "$ftype" =~ LSB\ executable ]]; then
|
|
|
|
patchelf \
|
|
|
|
--set-rpath "$rpath" \
|
|
|
|
--interpreter "$intp" \
|
|
|
|
"$1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cd Editor
|
|
|
|
|
|
|
|
$CC -fPIC -shared -o libunity-nosuid.so $nosuidLib -ldl
|
|
|
|
strip libunity-nosuid.so
|
|
|
|
|
|
|
|
# Exclude PlaybackEngines to build something that can be run on FHS-compliant Linuxes
|
|
|
|
find . -name PlaybackEngines -prune -o -executable -type f -print | while read path; do
|
|
|
|
patchFile "$path"
|
|
|
|
done
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
'';
|
|
|
|
|
2015-10-18 11:48:19 +02:00
|
|
|
installPhase = ''
|
2016-05-26 16:45:45 +02:00
|
|
|
unitydir="$out/opt/Unity/Editor"
|
2015-10-18 11:48:19 +02:00
|
|
|
mkdir -p $unitydir
|
2016-05-26 16:45:45 +02:00
|
|
|
mv Editor/* $unitydir
|
2017-01-29 11:11:01 +01:00
|
|
|
ln -sf /run/wrappers/bin/${chromium.sandboxExecutableName} $unitydir/chrome-sandbox
|
2015-10-18 11:48:19 +02:00
|
|
|
|
2016-05-26 16:45:45 +02:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
sed "/^Exec=/c\Exec=$out/bin/unity-editor" \
|
|
|
|
< unity-editor.desktop \
|
|
|
|
> $out/share/applications/unity-editor.desktop
|
|
|
|
|
|
|
|
install -D unity-editor-icon.png $out/share/icons/hicolor/256x256/apps/unity-editor-icon.png
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
makeWrapper $unitydir/Unity $out/bin/unity-editor \
|
|
|
|
--prefix LD_PRELOAD : "$unitydir/libunity-nosuid.so" \
|
|
|
|
--prefix PATH : "${binPath}"
|
|
|
|
|
|
|
|
developdir="$monodevelop/opt/Unity/MonoDevelop"
|
|
|
|
mkdir -p $developdir
|
|
|
|
mv MonoDevelop/* $developdir
|
|
|
|
|
|
|
|
mkdir -p $monodevelop/share/applications
|
|
|
|
sed "/^Exec=/c\Exec=$monodevelop/bin/unity-monodevelop" \
|
|
|
|
< unity-monodevelop.desktop \
|
|
|
|
> $monodevelop/share/applications/unity-monodevelop.desktop
|
|
|
|
|
|
|
|
mkdir -p $monodevelop/bin
|
|
|
|
makeWrapper $developdir/bin/monodevelop $monodevelop/bin/unity-monodevelop \
|
|
|
|
--prefix PATH : "${developBinPath}" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${developLibPath}" \
|
|
|
|
--prefix MONO_GAC_PREFIX : "${developDotnetPath}"
|
2015-10-18 11:48:19 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
2017-04-12 15:51:42 +02:00
|
|
|
dontPatchELF = true;
|
2015-10-18 11:48:19 +02:00
|
|
|
|
2016-05-26 16:45:45 +02:00
|
|
|
meta = with stdenv.lib; {
|
2015-10-18 11:48:19 +02:00
|
|
|
homepage = https://unity3d.com/;
|
|
|
|
description = "Game development tool";
|
|
|
|
longDescription = ''
|
|
|
|
Popular development platform for creating 2D and 3D multiplatform games
|
|
|
|
and interactive experiences.
|
|
|
|
'';
|
2016-05-26 16:45:45 +02:00
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ jb55 ];
|
2015-10-18 11:48:19 +02:00
|
|
|
};
|
|
|
|
}
|