Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Support $SNAPCRAFT_STAGE for parts #270
Merged
sergiusens
merged 1 commit into
snapcore:master
from
sergiusens:feature/1538688/support_a_stage_dir_env_in_snapcraft_yaml
Jan 28, 2016
Commits
Jump to file or symbol
Failed to load files and symbols.
| @@ -127,6 +127,25 @@ will be built after `libpipeline`. Especially if you need specific | ||
| functionality during a build or as part of checks during the `stage` phase, | ||
| this will be handy. | ||
| +If any part built using the `after` keyword needs to explicitly access | ||
| +assets in the stage directory with configuration flags (e.g.; `configure` | ||
sergiusens
Collaborator
|
||
| +in the case of autotools) it can use of the `SNAPCRAFT_STAGE` environment | ||
| +variable, like this: | ||
| + | ||
| +```yaml | ||
| +parts: | ||
| + my-part: | ||
| + plugin: autotools | ||
| + source: . | ||
| + configFlags: | ||
| + - --with-swig $SNAPCRAFT_STAGE/swig | ||
| + after: | ||
| + - swig | ||
| + swig: | ||
| + plugin: autotools | ||
| + source: ./swig | ||
| +``` | ||
| + | ||
| ### Re-using parts | ||
| With snapcraft we want to make it easy to learn from other app vendors and | ||
| @@ -0,0 +1,14 @@ | ||
| +cmake_minimum_required(VERSION 3.2) | ||
| +project(simple-cmake) | ||
| + | ||
| +IF(NOT DEFINED DEP_DIR) | ||
| + message(FATAL_ERROR "DEP_DIR is not defined.") | ||
| +ENDIF(NOT DEFINED DEP_DIR) | ||
| + | ||
| +# This is here to test $SNAPCRAFT_STAGE | ||
| +IF(NOT EXISTS "${DEP_DIR}/s") | ||
| + message(FATAL_ERROR "${DEP_DIR}/s does not exist.") | ||
| +ENDIF(NOT EXISTS "${DEP_DIR}/s") | ||
| + | ||
| +file(WRITE my-file "stub file") | ||
| +install(FILES my-file DESTINATION share) |
No changes.
| @@ -0,0 +1,19 @@ | ||
| +name: test-package | ||
| +version: 0.1 | ||
| +summary: try out $SNAPCRAFT_STAGE | ||
| +description: | | ||
| + The cmake-project expects to have a copied directory in the stage directory | ||
| + to consume during its build time. | ||
| + | ||
| +parts: | ||
| + cmake-project: | ||
| + plugin: cmake | ||
| + source: . | ||
| + configflags: | ||
| + - -DDEP_DIR=$SNAPCRAFT_STAGE/copied | ||
| + after: | ||
| + - copy | ||
| + copy: | ||
| + plugin: copy | ||
| + files: | ||
| + copied: copied |
I don't think the semicolon is necessary here.