summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorLengyel Balázs <ikervagyok@gmail.com>2016-07-02 12:32:49 +0200
committerNikolay Amiantov <ab@fmap.me>2016-07-03 20:22:35 +0300
commit0e5c802120aee2f7c91e4dcac8a8fc32637f2516 (patch)
treea237a3d61835b7ad0499442dd007a33f8b56fd09 /pkgs
parent17d6abb771299dde0d0a84528be30d5f32af70bc (diff)
downloadnixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar.gz
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar.bz2
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar.lz
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar.xz
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.tar.zst
nixlib-0e5c802120aee2f7c91e4dcac8a8fc32637f2516.zip
[WIP] flashtool: 0.9.14.0 -> 0.9.23.3
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/mobile/flashtool/default.nix52
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 32 insertions, 22 deletions
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
-
-    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
+    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}
 
-    ln -s swt32.jar x10flasher_lib/swtlin/swt.jar
+    ln -s ${libusb1.out}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib${ARCH}/libusbx-1.0.so
 
-    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;
   };