From 70798243a221c4cf1e9a30135d5ea7f326a7c8b2 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Tue, 18 Feb 2014 16:34:34 +0100 Subject: titaniumsdk: Add 3.2 SDK option --- pkgs/development/mobile/titaniumenv/build-app.nix | 11 ++- pkgs/development/mobile/titaniumenv/default.nix | 15 +++-- .../mobile/titaniumenv/examples/default.nix | 13 ++-- .../titaniumenv/examples/kitchensink/default.nix | 8 +-- .../mobile/titaniumenv/titaniumsdk-3.1.nix | 78 ++++++++++++++++++++++ .../mobile/titaniumenv/titaniumsdk-3.2.nix | 78 ++++++++++++++++++++++ .../development/mobile/titaniumenv/titaniumsdk.nix | 78 ---------------------- 7 files changed, 187 insertions(+), 94 deletions(-) create mode 100644 pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix create mode 100644 pkgs/development/mobile/titaniumenv/titaniumsdk-3.2.nix delete mode 100644 pkgs/development/mobile/titaniumenv/titaniumsdk.nix (limited to 'pkgs/development/mobile') 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 ? , 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-3.1.nix b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix new file mode 100644 index 000000000000..fa01dadc7756 --- /dev/null +++ b/pkgs/development/mobile/titaniumenv/titaniumsdk-3.1.nix @@ -0,0 +1,78 @@ +{stdenv, fetchurl, unzip, makeWrapper, python, jdk}: + +stdenv.mkDerivation { + name = "mobilesdk-3.1.4.v20130926144546"; + src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl { + url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_1_X/mobilesdk-3.1.4.v20130926144546-linux.zip; + sha1 = "da4a03ced67f0e8f442d551bbd41ea01fceeee00"; + } + else if stdenv.system == "x86_64-darwin" then fetchurl { + url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_1_X/mobilesdk-3.1.4.v20130926144546-osx.zip; + sha1 = "55f604c8edb989ba214c8ed7538d1b416df0419e"; + } + 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.1.4.v20130926144546 3.1.4.GA + cd 3.1.4.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 < builder.py < builder.py <