summary refs log tree commit diff
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-02-02 16:53:24 +0100
committerJoachim F <joachifm@users.noreply.github.com>2017-02-03 19:51:54 +0100
commit1e835f23def71dc9b944f34e9370e873f699b152 (patch)
tree7868bd62aab90475b5a122efffd739315eb84b8d
parentf7d49037a48846e025dd3d8f2ecb47f499431ee8 (diff)
downloadnixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar.gz
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar.bz2
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar.lz
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar.xz
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.tar.zst
nixlib-1e835f23def71dc9b944f34e9370e873f699b152.zip
googleearth: 6.0.3.2197 -> 7.1.4.1529
-rw-r--r--pkgs/applications/misc/googleearth/default.nix96
1 files changed, 49 insertions, 47 deletions
diff --git a/pkgs/applications/misc/googleearth/default.nix b/pkgs/applications/misc/googleearth/default.nix
index 1e6caa93b2d3..df8cb71d6f9e 100644
--- a/pkgs/applications/misc/googleearth/default.nix
+++ b/pkgs/applications/misc/googleearth/default.nix
@@ -1,77 +1,79 @@
 { stdenv, fetchurl, glibc, mesa, freetype, glib, libSM, libICE, libXi, libXv
 , libXrender, libXrandr, libXfixes, libXcursor, libXinerama, libXext, libX11, qt4
-, zlib, fontconfig }:
+, zlib, fontconfig, dpkg }:
 
-/* I haven't found any x86_64 package from them */
-assert stdenv.system == "i686-linux";
-
-stdenv.mkDerivation {
-  name = "googleearth-6.0.3.2197";
-
-  src = fetchurl {
-    url = http://dl.google.com/earth/client/current/GoogleEarthLinux.bin;
-    sha256 = "0bcpmnlk03382x577qbnbw3i6y08hr3qmg85pqj35scnl6van74c";
-  };
-
-  nativeBuildInputs = [
+let
+  arch =
+    if stdenv.system == "x86_64-linux" then "amd64"
+    else if stdenv.system == "i686-linux" then "i386"
+    else abort "Unsupported architecture";
+  sha256 =
+    if arch == "amd64"
+    then "0dwnppn5snl5bwkdrgj4cyylnhngi0g66fn2k41j3dvis83x24k6"
+    else "0gndbxrj3kgc2dhjqwjifr3cl85hgpm695z0wi01wvwzhrjqs0l2";
+  fullPath = stdenv.lib.makeLibraryPath [
     glibc
     glib
     stdenv.cc.cc
-    libSM 
-    libICE 
-    libXi 
+    libSM
+    libICE
+    libXi
     libXv
     mesa
-    libXrender 
-    libXrandr 
-    libXfixes 
-    libXcursor 
-    libXinerama 
-    freetype 
-    libXext 
-    libX11 
+    libXrender
+    libXrandr
+    libXfixes
+    libXcursor
+    libXinerama
+    freetype
+    libXext
+    libX11
     qt4
     zlib
     fontconfig
   ];
+in
+stdenv.mkDerivation rec {
+  version = "7.1.4.1529";
+  name = "googleearth-${version}";
+
+  src = fetchurl {
+    url = "https://dl.google.com/earth/client/current/google-earth-stable_current_${arch}.deb";
+    inherit sha256;
+  };
 
   phases = "unpackPhase installPhase";
-  
+
+  buildInputs = [ dpkg ];
+
   unpackPhase = ''
-    bash $src --noexec --target unpacked
-    cd unpacked
+    dpkg-deb -x ${src} ./
   '';
-  
+
   installPhase =''
-    mkdir -p $out/{opt/googleearth/,bin};
-    tar xf googleearth-data.tar -C $out/opt/googleearth
-    tar xf googleearth-linux-x86.tar -C $out/opt/googleearth
-    cp bin/googleearth $out/opt/googleearth
-    cat > $out/bin/googleearth << EOF
-    #!/bin/sh
-    export GOOGLEEARTH_DATA_PATH=$out/opt/googleearth
-    exec $out/opt/googleearth/googleearth
-    EOF
-    chmod +x $out/bin/googleearth
+    mkdir $out
+    mv usr/* $out/
+    rmdir usr
+    mv * $out/
+    rm $out/bin/google-earth $out/opt/google/earth/free/google-earth
+    ln -s $out/opt/google/earth/free/googleearth $out/bin/google-earth
 
-    fullPath=
-    for i in $nativeBuildInputs; do
-      fullPath=$fullPath:$i/lib
-    done
-          
     patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-      --set-rpath $fullPath \
-      $out/opt/googleearth/googleearth-bin
+      --set-rpath "${fullPath}:\$ORIGIN" \
+      $out/opt/google/earth/free/googleearth-bin
 
-    for a in $out/opt/googleearth/*.so* ; do
-      patchelf --set-rpath $fullPath $a
+    for a in $out/opt/google/earth/free/*.so* ; do
+      patchelf --set-rpath "${fullPath}:\$ORIGIN" $a
     done
   '';
 
+  dontPatchELF = true;
+
   meta = {
     description = "A world sphere viewer";
     homepage = http://earth.google.com;
     license = stdenv.lib.licenses.unfree;
     maintainers = [ stdenv.lib.maintainers.viric ];
+    platforms = stdenv.lib.platforms.linux;
   };
 }