2013-04-16 16:23:20 +02:00
|
|
|
{stdenv, fetchurl, unzip, makeWrapper, python, jdk}:
|
2013-01-07 18:22:10 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2014-07-15 16:05:25 +02:00
|
|
|
name = "mobilesdk-3.2.3.GA";
|
2013-04-16 16:23:20 +02:00
|
|
|
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
|
2014-07-15 16:05:25 +02:00
|
|
|
url = http://builds.appcelerator.com/mobile/3.2.3/mobilesdk-3.2.3.GA-linux.zip;
|
|
|
|
sha1 = "303e6d19a0ca099d47f6862c00b261c6d0206cea";
|
2013-04-16 16:23:20 +02:00
|
|
|
}
|
|
|
|
else if stdenv.system == "x86_64-darwin" then fetchurl {
|
2014-07-15 16:05:25 +02:00
|
|
|
url = http://builds.appcelerator.com/mobile/3.2.3/mobilesdk-3.2.3.GA-osx.zip;
|
|
|
|
sha1 = "8c358cbd8624ffe3dfbd0283738105157067e0fb";
|
2013-04-16 16:23:20 +02:00
|
|
|
}
|
|
|
|
else throw "Platform: ${stdenv.system} not supported!";
|
2013-01-07 18:22:10 +01:00
|
|
|
|
|
|
|
buildInputs = [ unzip makeWrapper ];
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cd $out
|
2015-01-23 16:57:34 +01:00
|
|
|
unzip $src
|
2013-01-07 18:22:10 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2014-01-15 13:37:40 +01:00
|
|
|
# Rename ugly version number
|
|
|
|
cd mobilesdk/*
|
2014-07-15 16:05:25 +02:00
|
|
|
cd 3.2.3.GA
|
2014-01-15 13:37:40 +01:00
|
|
|
|
2013-01-07 18:22:10 +01:00
|
|
|
# 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 :-)
|
|
|
|
|
2014-01-15 13:37:40 +01:00
|
|
|
cd android
|
2013-01-07 18:22:10 +01:00
|
|
|
|
|
|
|
sed -i -f ${./fixtiverify.sed} builder.py
|
2013-04-16 14:08:37 +02:00
|
|
|
sed -i -f ${./fixtiprofiler.sed} builder.py
|
|
|
|
sed -i -f ${./fixso.sed} builder.py
|
2013-04-17 13:52:42 +02:00
|
|
|
sed -i -f ${./fixnativelibs.sed} builder.py
|
2013-01-07 18:22:10 +01:00
|
|
|
|
|
|
|
# Patch some executables
|
|
|
|
|
|
|
|
${if stdenv.system == "i686-linux" then
|
|
|
|
''
|
2014-12-17 19:11:30 +01:00
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 titanium_prep.linux32
|
2013-01-07 18:22:10 +01:00
|
|
|
''
|
|
|
|
else if stdenv.system == "x86_64-linux" then
|
|
|
|
''
|
2014-12-17 19:11:30 +01:00
|
|
|
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 titanium_prep.linux64
|
2013-01-07 18:22:10 +01:00
|
|
|
''
|
|
|
|
else ""}
|
|
|
|
|
|
|
|
# Wrap builder script
|
|
|
|
|
2014-01-15 13:37:40 +01:00
|
|
|
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)'
|
2015-01-02 00:49:20 +01:00
|
|
|
os.environ['JAVA_HOME'] = '${jdk.home}'
|
2014-01-15 13:37:40 +01:00
|
|
|
|
|
|
|
os.execv('$(pwd)/.builder.py', sys.argv)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x builder.py
|
|
|
|
|
2013-01-16 17:09:08 +01:00
|
|
|
'' + 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
|
2014-01-21 17:19:26 +01:00
|
|
|
|
|
|
|
sed -i -e "s|--xcode|--xcode '+process.env['NIX_TITANIUM_WORKAROUND']+'|" $out/mobilesdk/osx/*/iphone/cli/commands/_build.js
|
2013-01-07 18:22:10 +01:00
|
|
|
'';
|
|
|
|
}
|