It's often useful to run shell commands to query environment conditions prior to the rendering a needs file:
{% if platform == 'ios' %}
{% set xcrun_platform = 'iphoneos' %}
{% elif platform == 'iossimulator' %}
{% set xcrun_platform = 'iphonesimulator' %}
{% elif platform == 'tvos' %}
{% set xcrun_platform = 'appletvos' %}
{% elif platform == 'tvossimulator' %}
{% set xcrun_platform = 'appletvsimulator' %}
{% endif %}
libraries:
openssl:
repository: git@github.com:openssl/openssl.git
commit: OpenSSL_1_0_1p
project:
build-steps:
{% set openssl_flags = ' --prefix={build_directory}' %}
{% if platform in ['ios', 'iossimulator', 'tvos', 'tvossimulator'] %}
- sh ./Configure iphoneos-cross {{openssl_flags}}
{% set cross_args = 'CROSS_TOP=$(xcrun --sdk ' + xcrun_platform + ' --show-sdk-platform-path)/Developer CROSS_SDK=$(basename $(xcrun --sdk ' + xcrun_platform + ' --show-sdk-path))' %}
{% elif platform == host_platform %}
- sh ./config {{openssl_flags}}
{% endif %}
- make depend
- sh -c 'make install {{cross_args}}'
However, the cacheability of this could be greatly improved if the output of those xcrun commands could be factored into the configuration hash. My proposal is to provide a jinja rule that executes an arbitrary shell command and includes the rendered output.
It's often useful to run shell commands to query environment conditions prior to the rendering a needs file:
However, the cacheability of this could be greatly improved if the output of those
xcrun
commands could be factored into the configuration hash. My proposal is to provide a jinja rule that executes an arbitrary shell command and includes the rendered output.