at release-16.03-start 64 lines 2.3 kB view raw
1{ stdenv, requireFile, p7zip, jre, libusb1, platformTools, gtk2, glib, libXtst }: 2 3assert stdenv.system == "i686-linux"; 4 5# TODO: 6# 7# The FlashTool and FlashToolConsole scripts are messy and should probably we 8# replaced entirely. All these scripts do is try to guess the environment in 9# which to run the Java binary (and they guess wrong on NixOS). 10# 11# The FlashTool scripts run 'chmod' on the binaries installed in the Nix 12# store. These commands fail, naturally, because the Nix story is (hopefully) 13# mounted read-only. This doesn't matter, though, because the build 14# instructions fix the executable bits already. 15 16stdenv.mkDerivation rec { 17 name = "flashtool-0.9.14.0"; 18 19 src = requireFile { 20 url = "http://dfiles.eu/files/n8c1c3pgc"; 21 name = "flashtool-0.9.14.0-linux.tar.7z"; 22 sha256 = "0mfjdjj7clz2dhkg7lzy1m8hk8ngla7zgcryf51aki1gnpbb2zc1"; 23 }; 24 25 buildInputs = [ p7zip jre ]; 26 27 unpackPhase = '' 28 7z e ${src} 29 tar xf ${name}-linux.tar 30 sourceRoot=FlashTool 31 ''; 32 33 buildPhase = '' 34 ln -s ${platformTools}/platform-tools/adb x10flasher_lib/adb.linux 35 ln -s ${platformTools}/platform-tools/fastboot x10flasher_lib/fastboot.linux 36 ln -s ${libusb1}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so 37 38 chmod +x x10flasher_lib/unyaffs.linux.x86 x10flasher_lib/bin2elf x10flasher_lib/bin2sin 39 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" x10flasher_lib/unyaffs.linux.x86 40 ln -sf unyaffs.linux.x86 x10flasher_lib/unyaffs.linux 41 42 ln -s swt32.jar x10flasher_lib/swtlin/swt.jar 43 44 sed -i \ 45 -e 's|$(uname -m)|i686|' \ 46 -e 's|export JAVA_HOME=.*|export JAVA_HOME=${jre}|' \ 47 -e 's|export LD_LIBRARY_PATH=.*|export LD_LIBRARY_PATH=${libXtst}/lib:${glib}/lib:${gtk2}/lib:./x10flasher_lib/linux/lib32|' \ 48 FlashTool FlashToolConsole 49 ''; 50 51 installPhase = '' 52 mkdir -p $out 53 mv * $out/ 54 ''; 55 56 meta = { 57 homepage = "http://www.flashtool.net/"; 58 description = "S1 flashing software for Sony phones from X10 to Xperia Z Ultra"; 59 license = stdenv.lib.licenses.unfreeRedistributableFirmware; 60 platforms = stdenv.lib.platforms.linux; 61 hydraPlatforms = stdenv.lib.platforms.none; 62 maintainers = [ stdenv.lib.maintainers.simons ]; 63 }; 64}