uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
150
pkgs/development/mobile/xcodeenv/build-app.nix
Normal file
150
pkgs/development/mobile/xcodeenv/build-app.nix
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
{stdenv, lib, composeXcodeWrapper}:
|
||||
{ name
|
||||
, src
|
||||
, sdkVersion ? "13.1"
|
||||
, target ? null
|
||||
, configuration ? null
|
||||
, scheme ? null
|
||||
, sdk ? null
|
||||
, xcodeFlags ? ""
|
||||
, release ? false
|
||||
, certificateFile ? null
|
||||
, certificatePassword ? null
|
||||
, provisioningProfile ? null
|
||||
, codeSignIdentity ? null
|
||||
, signMethod ? null
|
||||
, generateIPA ? false
|
||||
, generateXCArchive ? false
|
||||
, enableWirelessDistribution ? false
|
||||
, installURL ? null
|
||||
, bundleId ? null
|
||||
, appVersion ? null
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
assert release -> certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null && codeSignIdentity != null;
|
||||
assert enableWirelessDistribution -> installURL != null && bundleId != null && appVersion != null;
|
||||
|
||||
let
|
||||
# Set some default values here
|
||||
|
||||
_target = if target == null then name else target;
|
||||
|
||||
_configuration = if configuration == null
|
||||
then
|
||||
if release then "Release" else "Debug"
|
||||
else configuration;
|
||||
|
||||
_sdk = if sdk == null
|
||||
then
|
||||
if release then "iphoneos" + sdkVersion else "iphonesimulator" + sdkVersion
|
||||
else sdk;
|
||||
|
||||
# The following is to prevent repetition
|
||||
deleteKeychain = ''
|
||||
security default-keychain -s login.keychain
|
||||
security delete-keychain $keychainName
|
||||
'';
|
||||
|
||||
xcodewrapperFormalArgs = builtins.functionArgs composeXcodeWrapper;
|
||||
xcodewrapperArgs = builtins.intersectAttrs xcodewrapperFormalArgs args;
|
||||
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||
|
||||
extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);
|
||||
in
|
||||
stdenv.mkDerivation ({
|
||||
name = lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed
|
||||
buildPhase = ''
|
||||
# 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
|
||||
|
||||
${lib.optionalString release ''
|
||||
export HOME=/Users/$(whoami)
|
||||
keychainName="$(basename $out)"
|
||||
|
||||
# Create a keychain
|
||||
security create-keychain -p "" $keychainName
|
||||
security default-keychain -s $keychainName
|
||||
security unlock-keychain -p "" $keychainName
|
||||
|
||||
# Import the certificate into the keychain
|
||||
security import ${certificateFile} -k $keychainName -P "${certificatePassword}" -A
|
||||
|
||||
# Grant the codesign utility permissions to read from the keychain
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
|
||||
|
||||
# Determine provisioning ID
|
||||
PROVISIONING_PROFILE=$(grep UUID -A1 -a ${provisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
|
||||
|
||||
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision" ]
|
||||
then
|
||||
# Copy provisioning profile into the home directory
|
||||
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||
cp ${provisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision"
|
||||
fi
|
||||
|
||||
# Check whether the identity can be found
|
||||
security find-identity -p codesigning $keychainName
|
||||
''}
|
||||
|
||||
# Do the building
|
||||
export LD=/usr/bin/clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works
|
||||
|
||||
xcodebuild -target ${_target} -configuration ${_configuration} ${lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags}
|
||||
|
||||
${lib.optionalString release ''
|
||||
${lib.optionalString generateIPA ''
|
||||
# Create export plist file
|
||||
cat > "${name}.plist" <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>signingCertificate</key>
|
||||
<string>${codeSignIdentity}</string>
|
||||
<key>provisioningProfiles</key>
|
||||
<dict>
|
||||
<key>${bundleId}</key>
|
||||
<string>$PROVISIONING_PROFILE</string>
|
||||
</dict>
|
||||
<key>signingStyle</key>
|
||||
<string>manual</string>
|
||||
<key>method</key>
|
||||
<string>${signMethod}</string>
|
||||
${lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") ''
|
||||
<key>compileBitcode</key>
|
||||
<false/>
|
||||
''}
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Produce an IPA file
|
||||
xcodebuild -exportArchive -archivePath "${name}.xcarchive" -exportOptionsPlist "${name}.plist" -exportPath $out
|
||||
|
||||
# Add IPA to Hydra build products
|
||||
mkdir -p $out/nix-support
|
||||
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
|
||||
|
||||
${lib.optionalString enableWirelessDistribution ''
|
||||
# Add another hacky build product that enables wireless adhoc installations
|
||||
appname="$(basename "$(echo $out/*.ipa)" .ipa)"
|
||||
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&version=${appVersion}\&title=$appname|" ${./install.html.template} > $out/''${appname}.html
|
||||
echo "doc install \"$out/''${appname}.html\"" >> $out/nix-support/hydra-build-products
|
||||
''}
|
||||
''}
|
||||
${lib.optionalString generateXCArchive ''
|
||||
mkdir -p $out
|
||||
mv "${name}.xcarchive" $out
|
||||
''}
|
||||
|
||||
# Delete our temp keychain
|
||||
${deleteKeychain}
|
||||
''}
|
||||
'';
|
||||
|
||||
failureHook = lib.optionalString release deleteKeychain;
|
||||
|
||||
installPhase = "true";
|
||||
} // extraArgs)
|
||||
33
pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix
Normal file
33
pkgs/development/mobile/xcodeenv/compose-xcodewrapper.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{stdenv}:
|
||||
{version ? "11.1", xcodeBaseDir ? "/Applications/Xcode.app"}:
|
||||
|
||||
assert stdenv.isDarwin;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "xcode-wrapper-"+version;
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
cd $out/bin
|
||||
ln -s /usr/bin/xcode-select
|
||||
ln -s /usr/bin/security
|
||||
ln -s /usr/bin/codesign
|
||||
ln -s /usr/bin/xcrun
|
||||
ln -s /usr/bin/plutil
|
||||
ln -s /usr/bin/clang
|
||||
ln -s /usr/bin/lipo
|
||||
ln -s /usr/bin/file
|
||||
ln -s /usr/bin/rev
|
||||
ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"
|
||||
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"
|
||||
|
||||
cd ..
|
||||
ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"
|
||||
|
||||
# Check if we have the xcodebuild version that we want
|
||||
if [ -z "$($out/bin/xcodebuild -version | grep -x 'Xcode ${version}')" ]
|
||||
then
|
||||
echo "We require xcodebuild version: ${version}"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
15
pkgs/development/mobile/xcodeenv/default.nix
Normal file
15
pkgs/development/mobile/xcodeenv/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ stdenv, lib }:
|
||||
|
||||
rec {
|
||||
composeXcodeWrapper = import ./compose-xcodewrapper.nix {
|
||||
inherit stdenv;
|
||||
};
|
||||
|
||||
buildApp = import ./build-app.nix {
|
||||
inherit stdenv lib composeXcodeWrapper;
|
||||
};
|
||||
|
||||
simulateApp = import ./simulate-app.nix {
|
||||
inherit stdenv lib composeXcodeWrapper;
|
||||
};
|
||||
}
|
||||
25
pkgs/development/mobile/xcodeenv/install.html.template
Normal file
25
pkgs/development/mobile/xcodeenv/install.html.template
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Install IPA</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a id="forwardlink" href="@INSTALL_URL@">Go to the install page or wait a second</a>
|
||||
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {
|
||||
var link = document.getElementById('forwardlink');
|
||||
|
||||
if(document.createEvent) {
|
||||
var eventObj = document.createEvent('MouseEvents');
|
||||
eventObj.initEvent('click', true, false);
|
||||
link.dispatchEvent(eventObj);
|
||||
} else if(document.createEventObject) {
|
||||
link.fireEvent('onclick');
|
||||
}
|
||||
}, 1000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
56
pkgs/development/mobile/xcodeenv/simulate-app.nix
Normal file
56
pkgs/development/mobile/xcodeenv/simulate-app.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{stdenv, lib, composeXcodeWrapper}:
|
||||
{name, app ? null, bundleId ? null, ...}@args:
|
||||
|
||||
assert app != null -> bundleId != null;
|
||||
|
||||
let
|
||||
xcodewrapperArgs = builtins.intersectAttrs (builtins.functionArgs composeXcodeWrapper) args;
|
||||
|
||||
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = lib.replaceChars [" "] [""] name;
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/run-test-simulator << "EOF"
|
||||
#! ${stdenv.shell} -e
|
||||
|
||||
if [ "$1" = "" ]
|
||||
then
|
||||
# Show the user the possibile UDIDs and let him pick one, if none is provided as a command-line parameter
|
||||
xcrun simctl list
|
||||
|
||||
echo "Please provide a UDID of a simulator:"
|
||||
read udid
|
||||
else
|
||||
# If a parameter has been provided, consider that a device UDID and use that
|
||||
udid="$1"
|
||||
fi
|
||||
|
||||
# Open the simulator instance
|
||||
open -a "$(readlink "${xcodewrapper}/bin/Simulator")" --args -CurrentDeviceUDID $udid
|
||||
|
||||
${lib.optionalString (app != null) ''
|
||||
# Copy the app and restore the write permissions
|
||||
appTmpDir=$(mktemp -d -t appTmpDir)
|
||||
cp -r "$(echo ${app}/*.app)" "$appTmpDir"
|
||||
chmod -R 755 "$(echo $appTmpDir/*.app)"
|
||||
|
||||
# Wait for the simulator to start
|
||||
echo "Press enter when the simulator is started..."
|
||||
read
|
||||
|
||||
# Install the app
|
||||
xcrun simctl install "$udid" "$(echo $appTmpDir/*.app)"
|
||||
|
||||
# Remove the app tempdir
|
||||
rm -Rf $appTmpDir
|
||||
|
||||
# Launch the app in the simulator
|
||||
xcrun simctl launch $udid "${bundleId}"
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/run-test-simulator
|
||||
''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue