titaniumsdk: Added version 3.1 next to version 2.1, and make it configurable

This commit is contained in:
Sander van der Burg 2013-04-16 14:08:37 +02:00
parent c2389fcb9d
commit 1d255f9ab3
7 changed files with 98 additions and 14 deletions

View File

@ -1,11 +1,19 @@
{pkgs, pkgs_i686}:
{pkgs, pkgs_i686, version ? "3.1"}:
let
titaniumexpr = if version == "2.1" then
./titaniumsdk-2.1.nix
else if version == "3.1" then
./titaniumsdk.nix
else
throw "Unknown Titanium SDK version: ${version}";
in
rec {
androidenv = pkgs.androidenv;
xcodeenv = if pkgs.stdenv.system == "x86_64-darwin" then pkgs.xcodeenv else null;
titaniumsdk = import ./titaniumsdk.nix {
titaniumsdk = import titaniumexpr {
inherit (pkgs) stdenv fetchurl unzip makeWrapper python jdk;
};

View File

@ -1,19 +1,23 @@
{ nixpkgs ? <nixpkgs>
, system ? builtins.currentSystem
, version ? "3.1"
}:
let
pkgs = import nixpkgs { inherit system; };
pkgs_darwin_x86_64 = import nixpkgs { system = "x86_64-darwin"; };
versionString = pkgs.stdenv.lib.replaceChars [ "." ] [ "_" ] version;
in
rec {
kitchensink_android = import ./kitchensink {
inherit (pkgs) fetchgit titaniumenv;
inherit (pkgs) fetchgit;
titaniumenv = builtins.getAttr "titaniumenv_${versionString}" pkgs;
target = "android";
};
kitchensink_iphone = import ./kitchensink {
inherit (pkgs_darwin_x86_64) fetchgit titaniumenv;
inherit (pkgs_darwin_x86_64) fetchgit;
titaniumenv = builtins.getAttr "titaniumenv_${versionString}" pkgs_darwin_x86_64;
target = "iphone";
};

View File

@ -0,0 +1 @@
s|apk_zip.write(os.path.join(lib_source_dir, fname), lib_dest_dir + fname)|info = zipfile.ZipInfo(lib_dest_dir + fname)\n\t\t\t\tinfo.compress_type = zipfile.ZIP_DEFLATED\n\t\t\t\tinfo.create_system = 3\n\t\t\t\tf = open(os.path.join(lib_source_dir, fname))\n\t\t\t\tapk_zip.writestr(info, f.read())\n\t\t\t\tf.close()|

View File

@ -0,0 +1 @@
s|apk_zip.write(os.path.join(lib_source_dir, 'libtiprofiler.so'), lib_dest_dir + 'libtiprofiler.so')|info = zipfile.ZipInfo(lib_dest_dir + 'libtiprofiler.so')\n\t\t\tinfo.compress_type = zipfile.ZIP_DEFLATED\n\t\t\tinfo.create_system = 3\n\t\t\tf = open(os.path.join(lib_source_dir, 'libtiprofiler.so'))\n\t\t\tapk_zip.writestr(info, f.read())\n\t\t\tf.close()\n|

View File

@ -0,0 +1,62 @@
{stdenv, src ? null, fetchurl, unzip, makeWrapper, python, jdk}:
stdenv.mkDerivation {
name = "titanium-mobilesdk-2.1.4.v20121109124659";
src = if src == null then
if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_1_X/mobilesdk-2.1.4.v20121109124659-linux.zip;
sha1 = "381eb4b06b5a261ddf336c52d4714e5626142697";
}
else if stdenv.system == "x86_64-darwin" then fetchurl {
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_1_X/mobilesdk-2.1.4.v20121109124659-osx.zip;
sha1 = "1cef5803f0c7b7bb35feb88d3f91bbb191e3953e";
}
else throw "Platform: ${stdenv.system} not supported!"
else src;
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
# 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
sed -i -f ${./fixtiverify.sed} builder.py
sed -i -f ${./fixselfruntimev8.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
wrapProgram `pwd`/builder.py \
--prefix PYTHONPATH : ${python.modules.sqlite3}/lib/python*/site-packages \
--prefix PATH : ${jdk}/bin \
--prefix JAVA_HOME : ${jdk}
'' + 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
'';
}

View File

@ -1,15 +1,15 @@
{stdenv, src ? null, fetchurl, unzip, makeWrapper, python, jdk}:
stdenv.mkDerivation {
name = "titanium-mobilesdk-2.1.5.v20121112144658";
name = "titanium-mobilesdk-3.1.0.v20130415184552";
src = if src == null then
if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_1_X/mobilesdk-2.1.5.v20121112144658-linux.zip;
sha1 = "79f073d11ee893c508c5aa675a3126501dd385fd";
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_1_X/mobilesdk-3.1.0.v20130415184552-linux.zip;
sha1 = "7a8b34b92f6c3eff33eefb9a1b6b0d2e3670001d";
}
else if stdenv.system == "x86_64-darwin" then fetchurl {
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_1_X/mobilesdk-2.1.5.v20121112144658-osx.zip;
sha1 = "6a9a726882222d1615de332aa1ca608c15564e1c";
url = http://builds.appcelerator.com.s3.amazonaws.com/mobile/3_1_X/mobilesdk-3.1.0.v20130415184552-osx.zip;
sha1 = "e0ed7e399a104e0838e245550197bf787a66bf98";
}
else throw "Platform: ${stdenv.system} not supported!"
else src;
@ -34,8 +34,8 @@ stdenv.mkDerivation {
cd mobilesdk/*/*/android
sed -i -f ${./fixtiverify.sed} builder.py
sed -i -f ${./fixselfruntimev8.sed} builder.py
sed -i -f ${./fixnativelibs.sed} builder.py
sed -i -f ${./fixtiprofiler.sed} builder.py
sed -i -f ${./fixso.sed} builder.py
# Patch some executables

View File

@ -434,11 +434,19 @@ let
xcodeenv = callPackage ../development/mobile/xcodeenv { };
titaniumenv = import ../development/mobile/titaniumenv {
titaniumenv_2_1 = import ../development/mobile/titaniumenv {
inherit pkgs;
pkgs_i686 = pkgsi686Linux;
version = "2.1";
};
titaniumenv_3_1 = import ../development/mobile/titaniumenv {
inherit pkgs;
pkgs_i686 = pkgsi686Linux;
};
titaniumenv = titaniumenv_3_1;
inherit (androidenv) androidsdk_4_1;
aria = builderDefsPackage (import ../tools/networking/aria) { };