diff --git a/pkgs/development/mobile/flashtool/default.nix b/pkgs/development/mobile/flashtool/default.nix index 1689b2f506fa..6c6e2b516298 100644 --- a/pkgs/development/mobile/flashtool/default.nix +++ b/pkgs/development/mobile/flashtool/default.nix @@ -1,6 +1,6 @@ -{ stdenv, requireFile, p7zip, jre, libusb1, platformTools, gtk2, glib, libXtst }: +{ stdenv, requireFile, p7zip, jre, libusb1, platformTools, gtk2, glib, libXtst, swt, makeWrapper, mono }: -assert stdenv.system == "i686-linux"; +assert stdenv.isLinux; # TODO: # @@ -13,39 +13,49 @@ assert stdenv.system == "i686-linux"; # mounted read-only. This doesn't matter, though, because the build # instructions fix the executable bits already. +let + + CP = "$(ls ./x10flasher_lib/*.jar|xargs|tr ' ' ':')"; + SWT = "${swt}/jars/swt.jar"; + + ARCH = if stdenv.system == "i686-linux" then "32" else "64"; + +in + stdenv.mkDerivation rec { - name = "flashtool-0.9.14.0"; + name = "flashtool"; + version = "0.9.22.3"; src = requireFile { - url = "http://dfiles.eu/files/n8c1c3pgc"; - name = "flashtool-0.9.14.0-linux.tar.7z"; - sha256 = "0mfjdjj7clz2dhkg7lzy1m8hk8ngla7zgcryf51aki1gnpbb2zc1"; + url = "http://uploaded.net/file/fyc683jo"; + name = "${name}-${version}-linux.tar.7z"; + sha256 = "00sncfxi32y745cjf2zhaazs9p6zhpwqcrm91byja7d7pksf29ca"; }; - buildInputs = [ p7zip jre ]; + buildInputs = [ p7zip jre swt makeWrapper mono ]; unpackPhase = '' 7z e ${src} - tar xf ${name}-linux.tar + tar xf ${name}-${version}-linux.tar sourceRoot=FlashTool ''; buildPhase = '' - ln -s ${platformTools}/platform-tools/adb x10flasher_lib/adb.linux - ln -s ${platformTools}/platform-tools/fastboot x10flasher_lib/fastboot.linux - ln -s ${libusb1.out}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so + rm x10flasher_lib/adb.linux.${ARCH} + rm x10flasher_lib/fastboot.linux.${ARCH} + ln -s ${platformTools}/platform-tools/adb x10flasher_lib/adb.linux.${ARCH} + ln -s ${platformTools}/platform-tools/fastboot x10flasher_lib/fastboot.linux.${ARCH} - chmod +x x10flasher_lib/unyaffs.linux.x86 x10flasher_lib/bin2elf x10flasher_lib/bin2sin - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" x10flasher_lib/unyaffs.linux.x86 - ln -sf unyaffs.linux.x86 x10flasher_lib/unyaffs.linux + ln -s ${libusb1.out}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib${ARCH}/libusbx-1.0.so - ln -s swt32.jar x10flasher_lib/swtlin/swt.jar - - sed -i \ - -e 's|$(uname -m)|i686|' \ - -e 's|export JAVA_HOME=.*|export JAVA_HOME=${jre}|' \ - -e 's|export LD_LIBRARY_PATH=.*|export LD_LIBRARY_PATH=${libXtst}/lib:${glib}/lib:${gtk2}/lib:./x10flasher_lib/linux/lib32|' \ - FlashTool FlashToolConsole + rm FlashTool + makeWrapper ${jre}/bin/java $out/FlashTool \ + --set JAVA_HOME "${jre}" \ + --set PATH "$out:$PATH" \ + --set LD_LIBRARY_PATH "${libXtst}/lib:${glib}/lib:${gtk2}/lib:${libusb1}/lib:${swt}/lib:x10flasher_lib/linux/lib${ARCH}:\$LD_LIBRARY_PATH" \ + --add-flags "-classpath $out/x10flasher.jar:${CP}:${SWT} -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -Djsse.enableSNIExtension=false gui.Main" + sed -i -e 's|Main.*$|Main|' $out/FlashTool + sed -i -e 's|./x10flasher_lib|$out/x10flasher_lib|' $out/FlashTool ''; installPhase = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2ec015293172..0d92e2b279c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1529,7 +1529,7 @@ in flamerobin = callPackage ../applications/misc/flamerobin { }; - flashtool = callPackage_i686 ../development/mobile/flashtool { + flashtool = callPackage ../development/mobile/flashtool { platformTools = androidenv.platformTools; };