titaniumsdk: Add 3.2 SDK option

This commit is contained in:
Sander van der Burg 2014-02-18 16:34:34 +01:00
parent e2bc091213
commit 70798243a2
8 changed files with 954 additions and 529 deletions

View File

@ -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

View File

@ -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}";

View File

@ -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;

View File

@ -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;

View File

@ -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
'';
}

File diff suppressed because it is too large Load Diff

View File

@ -114,6 +114,6 @@
, "rethinkdb"
, "bower2nix"
, "fetch-bower"
, { "titanium": "3.2.0" }
, { "titanium": "3.2.1" }
, "gh"
]