Updating the recipes
Building a package with conda build involves creating a conda recipe. The recipe is a flat directory holding metadata and the scripts needed to build the package.
The files in a conda recipe are:
- meta.yaml (metadata file)
- build.sh (Unix build script which is executed using bash)
- bld.bat (Windows build script which is executed using cmd)
In our conda github repository, each folder contains the recipe for a particular software package. For example:
There could also be other optional files, like patches, scripts for testing, and to optionally execute after installation etc. See more details on the official conda guidelines page.
meta.yaml (more details here) contains all the metadata: the package name, version, source code repository, build number, dependencies, etc.
build.sh is a script used for building the binary, as specified in the
The details of writing a recipe are beyond the scope of these guidelines, here we only point out some rules of thumb for updating the recipes, especially those for building ROOT.
- Always increase the build number in
meta.yamlwhenever you change anything in the recipe and you plan on re-building and publishing a new conda package. If you do not update the build number, and publish your new package on the Anaconda Cloud, a user will not pickup your fresh binary. Conda will compare the build number of the user's installation with the one on the Anaconda Cloud, and conclude that there is no new release of your package to download.
- Keep the package name in
meta.yamlconsistent (aka don't change it). This is the name that will be used with
conda install <package-name>so it should typically not contain version information or anything else.
build.shcontains instructions like you would typically build a package/binary outside of the conda environment. For example, for ROOT, it contains:
cmake ../ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -Dbuiltin_llvm=ON \ -Dbuiltin-lzma=ON \ -Dbuiltin_zlib=ON \ -Dbuiltin_freetype=ON \ -Dcxx11=ON \ -Drpath=ON \ -Droofit=ON \ -Dopengl=OFF \ -Dgviz=OFF \ || return 1; make -j2 || return 1; make install || return 1; return 0;
If you want to enable or disable some module of ROOT, this is where you should do it.
$PREFIX is an environment variable available during building, and it is used for making the built packages relocatable for conda. Don't worry too much about it, simply look at it as a placeholder for the root (in the traditional sense, damnit, who thought ROOT was a good name to give to a scientific software!) directory where the user would install your conda package.
Python packages have a simpler
build.sh content, could amount to even one line:
$PYTHON setup.py install || return 1;
- Keep the conda package version number intact with the version of the software you are building.
Below are the most important parts of the ROOT recipe, what they mean, and how to change them: