titaniumenv: remove
This commit is contained in:
committed by
Valentin Gagarin
parent
d6108a545d
commit
b754b036e3
@@ -95,6 +95,5 @@ scheme.section.md
|
||||
swift.section.md
|
||||
tcl.section.md
|
||||
texlive.section.md
|
||||
titanium.section.md
|
||||
vim.section.md
|
||||
```
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
# Titanium {#titanium}
|
||||
|
||||
The Nixpkgs repository contains facilities to deploy a variety of versions of
|
||||
the [Titanium SDK](https://www.appcelerator.com) versions, a cross-platform
|
||||
mobile app development framework using JavaScript as an implementation language,
|
||||
and includes a function abstraction making it possible to build Titanium
|
||||
applications for Android and iOS devices from source code.
|
||||
|
||||
Not all Titanium features supported -- currently, it can only be used to build
|
||||
Android and iOS apps.
|
||||
|
||||
## Building a Titanium app {#building-a-titanium-app}
|
||||
|
||||
We can build a Titanium app from source for Android or iOS and for debugging or
|
||||
release purposes by invoking the `titaniumenv.buildApp {}` function:
|
||||
|
||||
```nix
|
||||
titaniumenv.buildApp {
|
||||
name = "myapp";
|
||||
src = ./myappsource;
|
||||
|
||||
preBuild = "";
|
||||
target = "android"; # or 'iphone'
|
||||
tiVersion = "7.1.0.GA";
|
||||
release = true;
|
||||
|
||||
androidsdkArgs = {
|
||||
platformVersions = [ "25" "26" ];
|
||||
};
|
||||
androidKeyStore = ./keystore;
|
||||
androidKeyAlias = "myfirstapp";
|
||||
androidKeyStorePassword = "secret";
|
||||
|
||||
xcodeBaseDir = "/Applications/Xcode.app";
|
||||
xcodewrapperArgs = {
|
||||
version = "9.3";
|
||||
};
|
||||
iosMobileProvisioningProfile = ./myprovisioning.profile;
|
||||
iosCertificateName = "My Company";
|
||||
iosCertificate = ./mycertificate.p12;
|
||||
iosCertificatePassword = "secret";
|
||||
iosVersion = "11.3";
|
||||
iosBuildStore = false;
|
||||
|
||||
enableWirelessDistribution = true;
|
||||
installURL = "/installipa.php";
|
||||
}
|
||||
```
|
||||
|
||||
The `titaniumenv.buildApp {}` function takes the following parameters:
|
||||
|
||||
* The `name` parameter refers to the name in the Nix store.
|
||||
* The `src` parameter refers to the source code location of the app that needs
|
||||
to be built.
|
||||
* `preRebuild` contains optional build instructions that are carried out before
|
||||
the build starts.
|
||||
* `target` indicates for which device the app must be built. Currently only
|
||||
'android' and 'iphone' (for iOS) are supported.
|
||||
* `tiVersion` can be used to optionally override the requested Titanium version
|
||||
in `tiapp.xml`. If not specified, it will use the version in `tiapp.xml`.
|
||||
* `release` should be set to true when building an app for submission to the
|
||||
Google Playstore or Apple Appstore. Otherwise, it should be false.
|
||||
|
||||
When the `target` has been set to `android`, we can configure the following
|
||||
parameters:
|
||||
|
||||
* The `androidSdkArgs` parameter refers to an attribute set that propagates all
|
||||
parameters to the `androidenv.composeAndroidPackages {}` function. This can
|
||||
be used to install all relevant Android plugins that may be needed to perform
|
||||
the Android build. If no parameters are given, it will deploy the platform
|
||||
SDKs for API-levels 25 and 26 by default.
|
||||
|
||||
When the `release` parameter has been set to true, you need to provide
|
||||
parameters to sign the app:
|
||||
|
||||
* `androidKeyStore` is the path to the keystore file
|
||||
* `androidKeyAlias` is the key alias
|
||||
* `androidKeyStorePassword` refers to the password to open the keystore file.
|
||||
|
||||
When the `target` has been set to `iphone`, we can configure the following
|
||||
parameters:
|
||||
|
||||
* The `xcodeBaseDir` parameter refers to the location where Xcode has been
|
||||
installed. When none value is given, the above value is the default.
|
||||
* The `xcodewrapperArgs` parameter passes arbitrary parameters to the
|
||||
`xcodeenv.composeXcodeWrapper {}` function. This can, for example, be used
|
||||
to adjust the default version of Xcode.
|
||||
|
||||
When `release` has been set to true, you also need to provide the following
|
||||
parameters:
|
||||
|
||||
* `iosMobileProvisioningProfile` refers to a mobile provisioning profile needed
|
||||
for signing.
|
||||
* `iosCertificateName` refers to the company name in the P12 certificate.
|
||||
* `iosCertificate` refers to the path to the P12 file.
|
||||
* `iosCertificatePassword` contains the password to open the P12 file.
|
||||
* `iosVersion` refers to the iOS SDK version to use. It defaults to the latest
|
||||
version.
|
||||
* `iosBuildStore` should be set to `true` when building for the Apple Appstore
|
||||
submission. For enterprise or ad-hoc builds it should be set to `false`.
|
||||
|
||||
When `enableWirelessDistribution` has been enabled, you must also provide the
|
||||
path of the PHP script (`installURL`) (that is included with the iOS build
|
||||
environment) to enable wireless ad-hoc installations.
|
||||
|
||||
## Emulating or simulating the app {#emulating-or-simulating-the-app}
|
||||
|
||||
It is also possible to simulate the correspond iOS simulator build by using
|
||||
`xcodeenv.simulateApp {}` and emulate an Android APK by using
|
||||
`androidenv.emulateApp {}`.
|
||||
@@ -3736,15 +3736,6 @@
|
||||
"sec-language-texlive-lualatex-font-cache": [
|
||||
"index.html#sec-language-texlive-lualatex-font-cache"
|
||||
],
|
||||
"titanium": [
|
||||
"index.html#titanium"
|
||||
],
|
||||
"building-a-titanium-app": [
|
||||
"index.html#building-a-titanium-app"
|
||||
],
|
||||
"emulating-or-simulating-the-app": [
|
||||
"index.html#emulating-or-simulating-the-app"
|
||||
],
|
||||
"vim": [
|
||||
"index.html#vim"
|
||||
],
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
{stdenv, lib, composeAndroidPackages, composeXcodeWrapper, titaniumsdk, titanium, alloy, jdk, python, nodejs, which, file}:
|
||||
{ name, src, preBuild ? "", target, tiVersion ? null
|
||||
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
|
||||
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "12.1", iosBuildStore ? false
|
||||
, enableWirelessDistribution ? false, installURL ? null
|
||||
, xcodeBaseDir ? "/Applications/Xcode.app"
|
||||
, androidsdkArgs ? {}
|
||||
, xcodewrapperArgs ? {}
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
|
||||
assert (release && target == "iphone") -> iosMobileProvisioningProfile != null && iosCertificateName != null && iosCertificate != null && iosCertificatePassword != null;
|
||||
assert enableWirelessDistribution -> installURL != null;
|
||||
|
||||
let
|
||||
realAndroidsdkArgs = {
|
||||
platformVersions = [ "28" ];
|
||||
} // androidsdkArgs;
|
||||
|
||||
androidsdk = (composeAndroidPackages realAndroidsdkArgs).androidsdk;
|
||||
|
||||
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||
|
||||
deleteKeychain = ''
|
||||
if [ -f $HOME/lock-keychain ]
|
||||
then
|
||||
security default-keychain -s login.keychain
|
||||
security delete-keychain $keychainName
|
||||
rm -f $HOME/lock-keychain
|
||||
fi
|
||||
'';
|
||||
|
||||
extraArgs = removeAttrs args [ "name" "preRebuild" "androidsdkArgs" "xcodewrapperArgs" ];
|
||||
in
|
||||
stdenv.mkDerivation ({
|
||||
name = lib.replaceStrings [" "] [""] name;
|
||||
|
||||
buildInputs = [ nodejs titanium alloy python which file jdk ];
|
||||
|
||||
buildPhase = ''
|
||||
${preBuild}
|
||||
|
||||
${lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
# Hack that provides a writable alloy package on macOS. Without it the build fails because of a file permission error.
|
||||
alloy=$(dirname $(type -p alloy))/..
|
||||
cp -rv $alloy/* alloy
|
||||
chmod -R u+w alloy
|
||||
export PATH=$(pwd)/alloy/bin:$PATH
|
||||
''}
|
||||
|
||||
export HOME=${if target == "iphone" then "/Users/$(whoami)" else "$TMPDIR"}
|
||||
|
||||
${lib.optionalString (tiVersion != null) ''
|
||||
# Replace titanium version by the provided one
|
||||
sed -i -e "s|<sdk-version>[0-9a-zA-Z\.]*</sdk-version>|<sdk-version>${tiVersion}</sdk-version>|" tiapp.xml
|
||||
''}
|
||||
|
||||
# Simulate a login
|
||||
mkdir -p $HOME/.titanium
|
||||
cat > $HOME/.titanium/auth_session.json <<EOF
|
||||
{ "loggedIn": true }
|
||||
EOF
|
||||
|
||||
# Configure the paths to the Titanium SDK and modules
|
||||
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 ''
|
||||
titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdk}/libexec/android-sdk
|
||||
|
||||
export PATH=${androidsdk}/libexec/android-sdk/tools:$(echo ${androidsdk}/libexec/android-sdk/build-tools/android-*):$PATH
|
||||
export GRADLE_USER_HOME=$TMPDIR/gradle
|
||||
|
||||
${if release then ''
|
||||
${lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
|
||||
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
|
||||
''}
|
||||
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias "${androidKeyAlias}" --store-password "${androidKeyStorePassword}" --output-dir $out
|
||||
'' else ''
|
||||
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only -B foo --output $out
|
||||
''}
|
||||
''
|
||||
else if target == "iphone" then ''
|
||||
# Be sure that the Xcode wrapper has priority over everything else.
|
||||
# When using buildInputs this does not seem to be the case.
|
||||
export PATH=${xcodewrapper}/bin:$PATH
|
||||
|
||||
# Configure the path to Xcode
|
||||
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
|
||||
|
||||
# Link the modules folder
|
||||
if [ ! -e modules ]
|
||||
then
|
||||
ln -s ${titaniumsdk}/modules modules
|
||||
createdModulesSymlink=1
|
||||
fi
|
||||
|
||||
${if release then ''
|
||||
# Create a keychain with the component hash name (should always be unique)
|
||||
export keychainName=$(basename $out)
|
||||
|
||||
security create-keychain -p "" $keychainName
|
||||
security default-keychain -s $keychainName
|
||||
security unlock-keychain -p "" $keychainName
|
||||
security import ${iosCertificate} -k $keychainName -P "${iosCertificatePassword}" -A
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
|
||||
provisioningId=$(grep UUID -A1 -a ${iosMobileProvisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
|
||||
|
||||
# Ensure that the requested provisioning profile can be found
|
||||
|
||||
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" ]
|
||||
then
|
||||
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
|
||||
fi
|
||||
|
||||
# Take precautions to prevent concurrent builds blocking the keychain
|
||||
while [ -f $HOME/lock-keychain ]
|
||||
do
|
||||
echo "Keychain locked, waiting for a couple of seconds, or remove $HOME/lock-keychain to unblock..."
|
||||
sleep 3
|
||||
done
|
||||
|
||||
touch $HOME/lock-keychain
|
||||
|
||||
security default-keychain -s $keychainName
|
||||
|
||||
# Do the actual build
|
||||
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target ${if iosBuildStore then "dist-appstore" else "dist-adhoc"} --pp-uuid $provisioningId --distribution-name "${iosCertificateName}" --keychain $HOME/Library/Keychains/$keychainName-db --device-family universal --ios-version ${iosVersion} --output-dir $out
|
||||
|
||||
# Remove our generated keychain
|
||||
${deleteKeychain}
|
||||
'' else ''
|
||||
# Copy all sources to the output store directory.
|
||||
# Why? Debug application include *.js files, which are symlinked into their
|
||||
# sources. If they are not copied, we have dangling references to the
|
||||
# temp folder.
|
||||
|
||||
cp -av * $out
|
||||
cd $out
|
||||
|
||||
# Execute the build
|
||||
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target simulator --build-only --device-family universal --ios-version ${iosVersion} --output-dir $out
|
||||
|
||||
# Remove the modules symlink
|
||||
if [ "$createdModulesSymlink" = "1" ]
|
||||
then
|
||||
rm $out/modules
|
||||
fi
|
||||
''}
|
||||
'' else throw "Target: ${target} is not supported!"}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
${if target == "android" then ''
|
||||
${lib.optionalString (!release) ''
|
||||
cp "$(ls build/android/bin/*.apk | grep -v '\-unsigned.apk')" $out
|
||||
''}
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
|
||||
''
|
||||
else if target == "iphone" then
|
||||
lib.optionalString release ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
|
||||
|
||||
${lib.optionalString enableWirelessDistribution ''
|
||||
appname="$(basename $out/*.ipa .ipa)"
|
||||
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
|
||||
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
|
||||
|
||||
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=$bundleId\&version=$version\&title=$appname|" ${../xcodeenv/install.html.template} > "$out/$appname.html"
|
||||
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
|
||||
''}
|
||||
''
|
||||
else throw "Target: ${target} is not supported!"}
|
||||
'';
|
||||
|
||||
failureHook = lib.optionalString (release && target == "iphone") deleteKeychain;
|
||||
} // extraArgs)
|
||||
@@ -1,20 +0,0 @@
|
||||
{pkgs, androidenv, xcodeenv, tiVersion ? "8.3.2.GA"}:
|
||||
|
||||
rec {
|
||||
titaniumsdk = let
|
||||
titaniumSdkFile = if tiVersion == "8.2.1.GA" then ./titaniumsdk-8.2.nix
|
||||
else if tiVersion == "8.3.2.GA" then ./titaniumsdk-8.3.nix
|
||||
else throw "Titanium version not supported: "+tiVersion;
|
||||
in
|
||||
import titaniumSdkFile {
|
||||
inherit (pkgs) stdenv lib fetchurl unzip makeWrapper;
|
||||
};
|
||||
|
||||
buildApp = import ./build-app.nix {
|
||||
inherit (pkgs) stdenv lib python which file jdk nodejs titanium;
|
||||
alloy = pkgs.titanium-alloy;
|
||||
inherit (androidenv) composeAndroidPackages;
|
||||
inherit (xcodeenv) composeXcodeWrapper;
|
||||
inherit titaniumsdk;
|
||||
};
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
{ stdenv, lib, fetchurl, unzip, makeWrapper }:
|
||||
|
||||
let
|
||||
# Gradle is a build system that bootstraps itself. This is what it actually
|
||||
# downloads in the bootstrap phase.
|
||||
gradleAllZip = fetchurl {
|
||||
url = "http://services.gradle.org/distributions/gradle-4.1-all.zip";
|
||||
sha256 = "1rcrh263vq7a0is800y5z36jj97p67c6zpqzzfcbr7r0qaxb61sw";
|
||||
};
|
||||
|
||||
# A Titanium-Android build requires proguard plugins. We create a fake
|
||||
# repository so that Gradle does not attempt to download them in the builder.
|
||||
# Since there are only 3 plugins required, this is still (sort of) manageable
|
||||
# without a generator.
|
||||
proguardVersion = "5.3.3";
|
||||
|
||||
proguardGradlePOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.pom";
|
||||
sha256 = "03v9zm3ykfkyb5cs5ald07ph103fh68d5c33rv070r29p71dwszj";
|
||||
};
|
||||
proguardGradleJAR = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.jar";
|
||||
sha256 = "0shhpsjfc5gam15jnv1hk718v5c7vi7dwdc3gvmnid6dc85kljzk";
|
||||
};
|
||||
proguardParentPOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-parent/${proguardVersion}/proguard-parent-${proguardVersion}.pom";
|
||||
sha256 = "0mv0zbwyw8xa4mkc5kw69y5xqashkz9gp123akfvh9f6152l3202";
|
||||
};
|
||||
proguardBasePOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.pom";
|
||||
sha256 = "1jnr6zsxfimb8wglqlwa6rrdc3g3nqf1dyw0k2dq9cj0q4pgn7p5";
|
||||
};
|
||||
proguardBaseJAR = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.jar";
|
||||
sha256 = "11nwdb9y84cghcx319nsjjf9m035s4s1184zrhzpvaxq2wvqhbhx";
|
||||
};
|
||||
|
||||
# Put the downloaded plugins in a fake Maven repository
|
||||
fakeMavenRepo = stdenv.mkDerivation {
|
||||
name = "fake-maven-repo";
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cd $out
|
||||
mkdir -p net/sf/proguard/proguard-gradle/${proguardVersion}
|
||||
cp ${proguardGradlePOM} net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.pom
|
||||
cp ${proguardGradleJAR} net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.jar
|
||||
mkdir -p net/sf/proguard/proguard-parent/${proguardVersion}
|
||||
cp ${proguardParentPOM} net/sf/proguard/proguard-parent/${proguardVersion}/proguard-parent-${proguardVersion}.pom
|
||||
mkdir -p net/sf/proguard/proguard-base/${proguardVersion}
|
||||
cp ${proguardBasePOM} net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.pom
|
||||
cp ${proguardBaseJAR} net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.jar
|
||||
'';
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "mobilesdk";
|
||||
version = "8.2.1.GA";
|
||||
|
||||
src =
|
||||
if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then
|
||||
fetchurl {
|
||||
url = "https://builds.appcelerator.com/mobile/8_2_X/mobilesdk-8.2.1.v20191025070136-linux.zip";
|
||||
sha256 = "1nvcmm6cby6bmwdiacq46n5y4zjpz9qlipakvglw27j3p4rbmkwl";
|
||||
}
|
||||
else if stdenv.system == "x86_64-darwin" then
|
||||
fetchurl {
|
||||
url = "https://builds.appcelerator.com/mobile/8_2_X/mobilesdk-8.2.1.v20191025070136-osx.zip";
|
||||
sha256 = "1nxwmyw3vqc5wghj38kpksisy0i808x0x3pa8w3p290w709g311l";
|
||||
}
|
||||
else throw "Platform: ${stdenv.system} not supported!";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper unzip ];
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cd $out
|
||||
(yes y | unzip $src) || true
|
||||
|
||||
# Rename ugly version number
|
||||
cd mobilesdk/*
|
||||
mv * 8.2.1.GA
|
||||
cd *
|
||||
|
||||
# Patch bundled gradle build infrastructure to make shebangs work
|
||||
patchShebangs android/templates/gradle
|
||||
|
||||
# Substitute the gradle-all zip URL by a local file to prevent downloads from happening while building an Android app
|
||||
sed -i -e "s|distributionUrl=|#distributionUrl=|" android/templates/gradle/gradle/wrapper/gradle-wrapper.properties
|
||||
cp ${gradleAllZip} android/templates/gradle/gradle/wrapper/gradle-4.1-all.zip
|
||||
echo "distributionUrl=gradle-4.1-all.zip" >> android/templates/gradle/gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
# Patch maven central repository with our own local directory. This prevents the builder from downloading Maven artifacts
|
||||
sed -i -e 's|mavenCentral()|maven { url "${fakeMavenRepo}" }|' android/templates/build/proguard.gradle
|
||||
|
||||
${lib.optionalString (stdenv.system == "x86_64-darwin") ''
|
||||
# Patch the strip frameworks script in the iPhone build template to not let
|
||||
# it skip the strip phase. This is caused by an assumption on the file
|
||||
# permissions in which Nix deviates from the standard.
|
||||
sed -i -e "s|-perm +111|-perm /111|" iphone/templates/build/strip-frameworks.sh
|
||||
''}
|
||||
|
||||
# Patch some executables
|
||||
|
||||
${if stdenv.system == "i686-linux" then
|
||||
''
|
||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
|
||||
''
|
||||
else lib.optionalString (stdenv.system == "x86_64-linux") ''
|
||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
{ stdenv, lib, fetchurl, unzip, makeWrapper }:
|
||||
|
||||
let
|
||||
# Gradle is a build system that bootstraps itself. This is what it actually
|
||||
# downloads in the bootstrap phase.
|
||||
gradleAllZip = fetchurl {
|
||||
url = "http://services.gradle.org/distributions/gradle-4.1-all.zip";
|
||||
sha256 = "1rcrh263vq7a0is800y5z36jj97p67c6zpqzzfcbr7r0qaxb61sw";
|
||||
};
|
||||
|
||||
# A Titanium-Android build requires proguard plugins. We create a fake
|
||||
# repository so that Gradle does not attempt to download them in the builder.
|
||||
# Since there are only 3 plugins required, this is still (sort of) manageable
|
||||
# without a generator.
|
||||
proguardVersion = "5.3.3";
|
||||
|
||||
proguardGradlePOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.pom";
|
||||
sha256 = "03v9zm3ykfkyb5cs5ald07ph103fh68d5c33rv070r29p71dwszj";
|
||||
};
|
||||
proguardGradleJAR = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.jar";
|
||||
sha256 = "0shhpsjfc5gam15jnv1hk718v5c7vi7dwdc3gvmnid6dc85kljzk";
|
||||
};
|
||||
proguardParentPOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-parent/${proguardVersion}/proguard-parent-${proguardVersion}.pom";
|
||||
sha256 = "0mv0zbwyw8xa4mkc5kw69y5xqashkz9gp123akfvh9f6152l3202";
|
||||
};
|
||||
proguardBasePOM = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.pom";
|
||||
sha256 = "1jnr6zsxfimb8wglqlwa6rrdc3g3nqf1dyw0k2dq9cj0q4pgn7p5";
|
||||
};
|
||||
proguardBaseJAR = fetchurl {
|
||||
url = "mirror://maven/net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.jar";
|
||||
sha256 = "11nwdb9y84cghcx319nsjjf9m035s4s1184zrhzpvaxq2wvqhbhx";
|
||||
};
|
||||
|
||||
# Put the downloaded plugins in a fake Maven repository
|
||||
fakeMavenRepo = stdenv.mkDerivation {
|
||||
name = "fake-maven-repo";
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cd $out
|
||||
mkdir -p net/sf/proguard/proguard-gradle/${proguardVersion}
|
||||
cp ${proguardGradlePOM} net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.pom
|
||||
cp ${proguardGradleJAR} net/sf/proguard/proguard-gradle/${proguardVersion}/proguard-gradle-${proguardVersion}.jar
|
||||
mkdir -p net/sf/proguard/proguard-parent/${proguardVersion}
|
||||
cp ${proguardParentPOM} net/sf/proguard/proguard-parent/${proguardVersion}/proguard-parent-${proguardVersion}.pom
|
||||
mkdir -p net/sf/proguard/proguard-base/${proguardVersion}
|
||||
cp ${proguardBasePOM} net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.pom
|
||||
cp ${proguardBaseJAR} net/sf/proguard/proguard-base/${proguardVersion}/proguard-base-${proguardVersion}.jar
|
||||
'';
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "mobilesdk";
|
||||
version = "8.3.2.GA";
|
||||
|
||||
src =
|
||||
if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then
|
||||
fetchurl {
|
||||
url = "https://builds.appcelerator.com/mobile/8_3_X/mobilesdk-8.3.2.v20200117111803-linux.zip";
|
||||
sha256 = "04pfw21jrx9w259lphynwykqjk4c9hm0zix4d40s7mf8mmh3xdx9";
|
||||
}
|
||||
else if stdenv.system == "x86_64-darwin" then
|
||||
fetchurl {
|
||||
url = "https://builds.appcelerator.com/mobile/8_3_X/mobilesdk-8.3.2.v20200117111803-osx.zip";
|
||||
sha256 = "1zflq5hc96lrriw71ya623kkskkisi9yayg8qs03zimi0gksizxw";
|
||||
}
|
||||
else throw "Platform: ${stdenv.system} not supported!";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper unzip ];
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cd $out
|
||||
unzip $src
|
||||
|
||||
# Rename ugly version number
|
||||
cd mobilesdk/*
|
||||
mv * 8.3.2.GA
|
||||
cd *
|
||||
|
||||
# Patch bundled gradle build infrastructure to make shebangs work
|
||||
patchShebangs android/templates/gradle
|
||||
|
||||
# Substitute the gradle-all zip URL by a local file to prevent downloads from happening while building an Android app
|
||||
sed -i -e "s|distributionUrl=|#distributionUrl=|" android/templates/gradle/gradle/wrapper/gradle-wrapper.properties
|
||||
cp ${gradleAllZip} android/templates/gradle/gradle/wrapper/gradle-4.1-all.zip
|
||||
echo "distributionUrl=gradle-4.1-all.zip" >> android/templates/gradle/gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
# Patch maven central repository with our own local directory. This prevents the builder from downloading Maven artifacts
|
||||
sed -i -e 's|mavenCentral()|maven { url "${fakeMavenRepo}" }|' android/templates/build/proguard.gradle
|
||||
|
||||
${lib.optionalString (stdenv.system == "x86_64-darwin") ''
|
||||
# Patch the strip frameworks script in the iPhone build template to not let
|
||||
# it skip the strip phase. This is caused by an assumption on the file
|
||||
# permissions in which Nix deviates from the standard.
|
||||
sed -i -e "s|-perm +111|-perm /111|" iphone/templates/build/strip-frameworks.sh
|
||||
''}
|
||||
'';
|
||||
}
|
||||
@@ -1911,8 +1911,6 @@ with pkgs;
|
||||
|
||||
gomobile = callPackage ../development/mobile/gomobile { };
|
||||
|
||||
titaniumenv = callPackage ../development/mobile/titaniumenv { };
|
||||
|
||||
adb-sync = callPackage ../development/mobile/adb-sync {
|
||||
inherit (androidenv.androidPkgs) platform-tools;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user