diff --git a/pkgs/development/mobile/titaniumenv/build-app.nix b/pkgs/development/mobile/titaniumenv/build-app.nix index 5dd114546610..83f66af18dad 100644 --- a/pkgs/development/mobile/titaniumenv/build-app.nix +++ b/pkgs/development/mobile/titaniumenv/build-app.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation { cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" fi - ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py distribute 6.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" $out universal "$HOME/Library/Keychains/$keychainName" + ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py distribute 7.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" $out universal "$HOME/Library/Keychains/$keychainName" # Remove our generated keychain @@ -84,7 +84,7 @@ stdenv.mkDerivation { cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" fi - ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py adhoc 6.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" universal "$HOME/Library/Keychains/$keychainName" + ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py adhoc 7.0 $(pwd) ${appId} "${_appName}" "$provisioningId" "${iosCertificateName}" universal "$HOME/Library/Keychains/$keychainName" # Remove our generated keychain @@ -99,7 +99,7 @@ stdenv.mkDerivation { cp -av * $out cd $out - ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py build 6.0 $(pwd) ${appId} "${_appName}" universal + ${titaniumsdk}/mobilesdk/*/*/iphone/builder.py build 7.0 $(pwd) ${appId} "${_appName}" universal '' else throw "Target: ${target} is not supported!"} diff --git a/pkgs/development/mobile/titaniumenv/examples/default.nix b/pkgs/development/mobile/titaniumenv/examples/default.nix index b82d7e0ee58e..e955a1d8865a 100644 --- a/pkgs/development/mobile/titaniumenv/examples/default.nix +++ b/pkgs/development/mobile/titaniumenv/examples/default.nix @@ -1,53 +1,90 @@ { nixpkgs ? , systems ? [ "x86_64-linux" "x86_64-darwin" ] , xcodeVersion ? "5.0" +, rename ? false +, newBundleId ? "com.example.kitchensink", iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? "Example", iosCertificatePassword ? "" }: let pkgs = import nixpkgs {}; in rec { - kitchensink_android = pkgs.lib.genAttrs systems (system: + kitchensink_android_debug = pkgs.lib.genAttrs systems (system: let pkgs = import nixpkgs { inherit system; }; in - import ./kitchensink { - inherit (pkgs) fetchgit; - titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; }; - target = "android"; - }); + import ./kitchensink { + inherit (pkgs) fetchgit; + titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; }; + target = "android"; + }); - emulate_kitchensink = pkgs.lib.genAttrs systems (system: + kitchensink_android_release = pkgs.lib.genAttrs systems (system: let pkgs = import nixpkgs { inherit system; }; in - import ./emulate-kitchensink { - inherit (pkgs) androidenv; - kitchensink = builtins.getAttr system kitchensink_android; - }); + import ./kitchensink { + inherit (pkgs) fetchgit; + titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; }; + target = "android"; + release = true; + }); + + emulate_kitchensink_debug = pkgs.lib.genAttrs systems (system: + let + pkgs = import nixpkgs { inherit system; }; + in + import ./emulate-kitchensink { + inherit (pkgs) androidenv; + kitchensink = builtins.getAttr system kitchensink_android_debug; + }); + + emulate_kitchensink_release = pkgs.lib.genAttrs systems (system: + let + pkgs = import nixpkgs { inherit system; }; + in + import ./emulate-kitchensink { + inherit (pkgs) androidenv; + kitchensink = builtins.getAttr system kitchensink_android_release; + }); } // (if builtins.elem "x86_64-darwin" systems then let pkgs = import nixpkgs { system = "x86_64-darwin"; }; in rec { - kitchensink_iphone = import ./kitchensink { - inherit (pkgs) fetchgit; + kitchensink_ios_development = import ./kitchensink { + inherit (pkgs) fetchgit; + titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; }; + target = "iphone"; + }; + + simulate_kitchensink_iphone = import ./simulate-kitchensink { + inherit (pkgs) stdenv; + xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; }; + kitchensink = kitchensink_ios_development; + device = "iPhone"; + }; + + simulate_kitchensink_ipad = import ./simulate-kitchensink { + inherit (pkgs) stdenv; + xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; }; + kitchensink = kitchensink_ios_development; + device = "iPad"; + }; +} else {}) // (if rename then + let + pkgs = import nixpkgs { system = "x86_64-darwin"; }; + in + { + kitchensink_ipa = import ./kitchensink { + inherit (pkgs) stdenv fetchgit; titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion; }; target = "iphone"; + release = true; + rename = true; + inherit newBundleId iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword; }; - - simulate_kitchensink_iphone = import ./simulate-kitchensink { - inherit (pkgs) stdenv; - xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; }; - kitchensink = kitchensink_iphone; - device = "iPhone"; - }; + } - simulate_kitchensink_ipad = import ./simulate-kitchensink { - inherit (pkgs) stdenv; - xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; }; - kitchensink = kitchensink_iphone; - device = "iPad"; - }; -} else {}) +else {}) diff --git a/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix b/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix index 17834c7fe585..001b91f551d2 100644 --- a/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix +++ b/pkgs/development/mobile/titaniumenv/examples/kitchensink/default.nix @@ -1,25 +1,41 @@ -{titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ]}: +{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "11" ], release ? false +, rename ? false, stdenv ? null, newBundleId ? null, iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? null, iosCertificatePassword ? null +}: -titaniumenv.buildApp { - name = "KitchenSink-${target}"; - appName = "KitchenSink"; - appId = "com.appcelerator.kitchensink"; +assert rename -> (stdenv != null && newBundleId != null && iosMobileProvisioningProfile != null && iosCertificate != null && iosCertificateName != null && iosCertificatePassword != null); + +let src = fetchgit { url = https://github.com/appcelerator/KitchenSink.git; rev = "d9f39950c0137a1dd67c925ef9e8046a9f0644ff"; sha256 = "0aj42ac262hw9n9blzhfibg61kkbp3wky69rp2yhd11vwjlcq1qc"; }; - inherit target androidPlatformVersions; + # Rename the bundle id to something else + renamedSrc = stdenv.mkDerivation { + name = "KitchenSink-renamedsrc"; + inherit src; + buildPhase = '' + sed -i -e "s|com.appcelerator.kitchensink|${newBundleId}|" tiapp.xml + sed -i -e "s|com.appcelerator.kitchensink|${newBundleId}|" manifest + ''; + installPhase = '' + mkdir -p $out + mv * $out + ''; + }; +in +titaniumenv.buildApp { + name = "KitchenSink-${target}-${if release then "release" else "debug"}"; + appName = "KitchenSink"; + appId = if rename then newBundleId else "com.appcelerator.kitchensink"; + src = if rename then renamedSrc else src; - /*release = true; - androidKeyStore = /home/sander/keystore; - androidKeyAlias = "sander"; - androidKeyStorePassword = "foobar";*/ + inherit target androidPlatformVersions release; - /*release = true; - iosMobileProvisioningProfile = /Users/sander/Downloads/profile.mobileprovision; - iosCertificateName = "My Company"; - iosCertificate = /Users/sander/Downloads/c.p12; - iosCertificatePassword = "";*/ + androidKeyStore = ./keystore; + androidKeyAlias = "myfirstapp"; + androidKeyStorePassword = "mykeystore"; + + inherit iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword; } diff --git a/pkgs/development/mobile/titaniumenv/examples/kitchensink/generatekeystore.sh b/pkgs/development/mobile/titaniumenv/examples/kitchensink/generatekeystore.sh new file mode 100755 index 000000000000..57451e8a5075 --- /dev/null +++ b/pkgs/development/mobile/titaniumenv/examples/kitchensink/generatekeystore.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e + +( echo "John Doe" + echo "My Company" + echo "My Organization" + echo "My City" + echo "My State" + echo "US" + echo "yes" +) | keytool --genkeypair --alias myfirstapp --keystore ./keystore --storepass mykeystore diff --git a/pkgs/development/mobile/titaniumenv/examples/kitchensink/keystore b/pkgs/development/mobile/titaniumenv/examples/kitchensink/keystore new file mode 100644 index 000000000000..ee0a9c7989ba Binary files /dev/null and b/pkgs/development/mobile/titaniumenv/examples/kitchensink/keystore differ diff --git a/pkgs/development/mobile/titaniumenv/titaniumsdk.nix b/pkgs/development/mobile/titaniumenv/titaniumsdk.nix index 276b442af0cf..520e93c828b9 100644 --- a/pkgs/development/mobile/titaniumenv/titaniumsdk.nix +++ b/pkgs/development/mobile/titaniumenv/titaniumsdk.nix @@ -26,10 +26,15 @@ stdenv.mkDerivation { 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 mobilesdk/*/*/android + cd android sed -i -f ${./fixtiverify.sed} builder.py sed -i -f ${./fixtiprofiler.sed} builder.py @@ -50,10 +55,20 @@ stdenv.mkDerivation { # Wrap builder script - wrapProgram `pwd`/builder.py \ - --prefix PYTHONPATH : ${python.modules.sqlite3}/lib/python*/site-packages \ - --prefix PATH : ${jdk}/bin \ - --prefix JAVA_HOME : ${jdk} + mv builder.py .builder.py + cat > builder.py <