mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
79 lines
2.6 KiB
Nix
79 lines
2.6 KiB
Nix
{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
|
|
'';
|
|
}
|