about summary refs log tree commit diff
path: root/pkgs/development/mobile
diff options
context:
space:
mode:
authorSander van der Burg <svanderburg@gmail.com>2014-02-18 16:34:34 +0100
committerSander van der Burg <svanderburg@gmail.com>2014-02-18 16:34:34 +0100
commit70798243a221c4cf1e9a30135d5ea7f326a7c8b2 (patch)
tree588df63bf124151eb8be71be562a5cf809f2acac /pkgs/development/mobile
parente2bc0912137b6a1df991ec102cf2ce23e5405553 (diff)
downloadnixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar.gz
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar.bz2
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar.lz
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar.xz
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.tar.zst
nixlib-70798243a221c4cf1e9a30135d5ea7f326a7c8b2.zip
titaniumsdk: Add 3.2 SDK option
Diffstat (limited to 'pkgs/development/mobile')
-rw-r--r--pkgs/development/mobile/titaniumenv/build-app.nix11
-rw-r--r--pkgs/development/mobile/titaniumenv/default.nix15
-rw-r--r--pkgs/development/mobile/titaniumenv/examples/default.nix13
-rw-r--r--pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix8
-rw-r--r--pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix (renamed from pkgs/development/mobile/titaniumenv/titaniumsdk.nix)0
-rw-r--r--pkgs/development/mobile/titaniumenv/titaniumsdk-3.2.nix78
6 files changed, 109 insertions, 16 deletions
diff --git a/pkgs/development/mobile/titaniumenv/build-app.nix b/pkgs/development/mobile/titaniumenv/build-app.nix
index 55e9d63d727a..8c46033152f0 100644
--- a/pkgs/development/mobile/titaniumenv/build-app.nix
+++ b/pkgs/development/mobile/titaniumenv/build-app.nix
@@ -1,4 +1,4 @@
-{stdenv, androidsdk, titaniumsdk, titanium, xcodewrapper, jdk, python}:
+{stdenv, androidsdk, titaniumsdk, titanium, xcodewrapper, jdk, python, which}:
 { name, src, target, androidPlatformVersions ? [ "8" ], androidAbiVersions ? [ "armeabi" "armeabi-v7a" ], tiVersion ? null
 , release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
 , iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   name = stdenv.lib.replaceChars [" "] [""] name;
   inherit src;
   
-  buildInputs = [ titanium jdk python ] ++ stdenv.lib.optional (stdenv.system == "x86_64-darwin") xcodewrapper;
+  buildInputs = [ titanium jdk python which ] ++ stdenv.lib.optional (stdenv.system == "x86_64-darwin") xcodewrapper;
   
   buildPhase = ''
     export HOME=$TMPDIR
@@ -38,16 +38,21 @@ stdenv.mkDerivation {
     
     echo "{}" > $TMPDIR/config.json
     titanium --config-file $TMPDIR/config.json --no-colors config sdk.defaultInstallLocation ${titaniumsdk}
-
+    
+    titanium --config-file $TMPDIR/config.json --no-colors config paths.modules ${titaniumsdk}
+    
     mkdir -p $out
     
     ${if target == "android" then
         ''
+          cat $TMPDIR/config.json
+          
           titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdkComposition}/libexec/android-sdk-*
           
           ${if release then
             ''titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias ${androidKeyAlias} --password ${androidKeyStorePassword} --output-dir $out''
           else
+            # /run/current-system/sw/bin/strace -f -y 
             ''titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only --output $out''}
         ''
       else if target == "iphone" then
diff --git a/pkgs/development/mobile/titaniumenv/default.nix b/pkgs/development/mobile/titaniumenv/default.nix
index b77468a09536..6c80cdae3e26 100644
--- a/pkgs/development/mobile/titaniumenv/default.nix
+++ b/pkgs/development/mobile/titaniumenv/default.nix
@@ -1,4 +1,4 @@
-{pkgs, pkgs_i686, xcodeVersion ? "5.0"}:
+{pkgs, pkgs_i686, xcodeVersion ? "5.0", tiVersion ? "3.2.1.GA"}:
 
 let
   # We have to use Oracle's JDK. On Darwin, just simply expose the host system's
@@ -27,12 +27,17 @@ rec {
     version = xcodeVersion;
   } else null;
   
-  titaniumsdk = import ./titaniumsdk.nix {
-    inherit (pkgs) stdenv fetchurl unzip makeWrapper python jdk;
-  };
+  titaniumsdk = let
+    titaniumSdkFile = if tiVersion == "3.1.4.GA" then ./titaniumsdk-3.1.nix
+      else if tiVersion == "3.2.1.GA" then ./titaniumsdk-3.2.nix
+      else throw "Titanium version not supported: "+tiVersion;
+    in
+    import titaniumSdkFile {
+      inherit (pkgs) stdenv fetchurl unzip makeWrapper python jdk;
+    };
   
   buildApp = import ./build-app.nix {
-    inherit (pkgs) stdenv python;
+    inherit (pkgs) stdenv python which;
     jdk = if pkgs.stdenv.isLinux then pkgs.oraclejdk7
       else if pkgs.stdenv.isDarwin then jdkWrapper
       else throw "Platform not supported: ${pkgs.stdenv.system}";
diff --git a/pkgs/development/mobile/titaniumenv/examples/default.nix b/pkgs/development/mobile/titaniumenv/examples/default.nix
index e955a1d8865a..c9f32f8bb6b1 100644
--- a/pkgs/development/mobile/titaniumenv/examples/default.nix
+++ b/pkgs/development/mobile/titaniumenv/examples/default.nix
@@ -1,6 +1,7 @@
 { nixpkgs ? <nixpkgs>
 , systems ? [ "x86_64-linux" "x86_64-darwin" ]
 , xcodeVersion ? "5.0"
+, tiVersion ? "3.2.1.GA"
 , rename ? false
 , newBundleId ? "com.example.kitchensink", iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? "Example", iosCertificatePassword ? ""
 }:
@@ -15,7 +16,8 @@ rec {
   in
   import ./kitchensink {
     inherit (pkgs) fetchgit;
-    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
+    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion tiVersion; };
+    inherit tiVersion;
     target = "android";
   });
   
@@ -25,7 +27,8 @@ rec {
   in
   import ./kitchensink {
     inherit (pkgs) fetchgit;
-    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
+    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion tiVersion; };
+    inherit tiVersion;
     target = "android";
     release = true;
   });
@@ -55,7 +58,8 @@ rec {
   rec {
   kitchensink_ios_development = import ./kitchensink {
     inherit (pkgs) fetchgit;
-    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
+    titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion tiVersion; };
+    inherit tiVersion;
     target = "iphone";
   };
 
@@ -79,8 +83,9 @@ rec {
   {
     kitchensink_ipa = import ./kitchensink {
       inherit (pkgs) stdenv fetchgit;
-      titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; };
+      titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion tiVersion; };
       target = "iphone";
+      inherit tiVersion;
       release = true;
       rename = true;
       inherit newBundleId iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword;
diff --git a/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix b/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix
index a5cd156a8ffd..95dd09be30dc 100644
--- a/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix
+++ b/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix
@@ -1,4 +1,4 @@
-{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ], release ? false
+{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ], tiVersion ? "3.2.1.GA", release ? false
 , rename ? false, stdenv ? null, newBundleId ? null, iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? null, iosCertificatePassword ? null
 }:
 
@@ -7,8 +7,8 @@ assert rename -> (stdenv != null && newBundleId != null && iosMobileProvisioning
 let
   src = fetchgit {
     url = https://github.com/appcelerator/KitchenSink.git;
-    rev = "d9f39950c0137a1dd67c925ef9e8046a9f0644ff";
-    sha256 = "0aj42ac262hw9n9blzhfibg61kkbp3wky69rp2yhd11vwjlcq1qc";
+    rev = "0b8175f20f0aa71f93921025dec5d0f3299960ae";
+    sha256 = "0b2p4wbnlp46wpanqj5h3yfb2hdbh20nxbis8zscj4qlgrnyjdjz";
   };
   
   # Rename the bundle id to something else
@@ -28,7 +28,7 @@ in
 titaniumenv.buildApp {
   name = "KitchenSink-${target}-${if release then "release" else "debug"}";
   src = if rename then renamedSrc else src;
-  tiVersion = "3.1.4.GA";
+  inherit tiVersion;
   
   inherit target androidPlatformVersions release;
   
diff --git a/pkgs/development/mobile/titaniumenv/titaniumsdk.nix b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix
index fa01dadc7756..fa01dadc7756 100644
--- a/pkgs/development/mobile/titaniumenv/titaniumsdk.nix
+++ b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix
diff --git a/pkgs/development/mobile/titaniumenv/titaniumsdk-3.2.nix b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.2.nix
new file mode 100644
index 000000000000..96428f4a99bc
--- /dev/null
+++ b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.2.nix
@@ -0,0 +1,78 @@
+{stdenv, fetchurl, unzip, makeWrapper, python, jdk}:
+
+stdenv.mkDerivation {
+  name = "mobilesdk-3.2.1.v20140206170116";
+  src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
+    url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_2_X/mobilesdk-3.2.1.v20140206170116-linux.zip;
+    sha1 = "89955d31d48875aca64dd0131baac5ed82abcfc9";
+  }
+  else if stdenv.system == "x86_64-darwin" then fetchurl {
+    url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_2_X/mobilesdk-3.2.1.v20140206170116-osx.zip;
+    sha1 = "06d9338c619b787be83baf3c0d93748b0e430182";
+  }
+  else throw "Platform: ${stdenv.system} not supported!";
+  
+  buildInputs = [ unzip makeWrapper ];
+  
+  buildCommand = ''
+    mkdir -p $out
+    cd $out
+    yes y | unzip $src
+    
+    # Fix shebang header for python scripts
+    
+    find . -name \*.py | while read i
+    do
+        sed -i -e "s|#!/usr/bin/env python|#!${python}/bin/python|" $i
+    done
+   
+    # Rename ugly version number
+    cd mobilesdk/*
+    mv 3.2.1.v20140206170116 3.2.1.GA
+    cd 3.2.1.GA
+    
+    # Zip files do not support timestamps lower than 1980. We have to apply a few work-arounds to cope with that
+    # Yes, I know it's nasty :-)
+    
+    cd android
+    
+    sed -i -f ${./fixtiverify.sed} builder.py
+    sed -i -f ${./fixtiprofiler.sed} builder.py
+    sed -i -f ${./fixso.sed} builder.py
+    sed -i -f ${./fixnativelibs.sed} builder.py
+    
+    # Patch some executables
+    
+    ${if stdenv.system == "i686-linux" then
+      ''
+        patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-linux.so.2 titanium_prep.linux32
+      ''
+      else if stdenv.system == "x86_64-linux" then
+      ''
+        patchelf --set-interpreter ${stdenv.gcc.libc}/lib/ld-linux-x86-64.so.2 titanium_prep.linux64
+      ''
+      else ""}
+    
+    # Wrap builder script
+    
+    mv builder.py .builder.py
+    cat > builder.py <<EOF
+    #!${python}/bin/python
+    
+    import os, sys
+    
+    os.environ['PYTHONPATH'] = '$(echo ${python.modules.sqlite3}/lib/python*/site-packages)'
+    os.environ['JAVA_HOME'] = '${if stdenv.system == "x86_64-darwin" then jdk else "${jdk}/lib/openjdk"}'
+    
+    os.execv('$(pwd)/.builder.py', sys.argv)
+    EOF
+    
+    chmod +x builder.py
+    
+  '' + stdenv.lib.optionalString (stdenv.system == "x86_64-darwin") ''
+    # 'ditto' utility is needed to copy stuff to the Xcode organizer. Dirty, but this allows it to work.
+    sed -i -e "s|ditto|/usr/bin/ditto|g" $out/mobilesdk/osx/*/iphone/builder.py
+    
+    sed -i -e "s|--xcode|--xcode '+process.env['NIX_TITANIUM_WORKAROUND']+'|" $out/mobilesdk/osx/*/iphone/cli/commands/_build.js
+  '';
+}