tinyos/tinyos-main — pull request #190 by bradjc (2013-05-07 04:16:06+00:00)
Title: Remove the Environment Variable Requirement from TinyOS Install

One strange step in the TinyOS install process is setting environment variables. In my experience this is very unusual and a barrier to entry for novice users (who have to complete an extra step to use TinyOS) and seasoned *nix users (who are used to the typical configure/make/make install processes). This pull request removes the need to set `$TOSDIR` `$TOSROOT` `$MAKERULES` and `$PYTHONPATH`. Instead, the Makefile in each application sets `$TOSROOT` and `Makerules` is included from Makefile.include in the root directory. This is more in line with what is done in other major projects (e.g. Contiki, Clang). This also should ease the packaging process, as setting environment variables is not permitted or supported by [debs](http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.9) or [rpms](http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/).

I removed all references to `$TOSROOT` and `$TOSDIR` from outside of the make build system. The biggest effect of this was removing the `-print-tosdir` option from `ncc`. Everything that depended on that now takes `TOSDIR` in as an argument and I changed all the calls to these scripts to supply this argument.

I also moved the Python code to `tools` instead of `support/sdk` so that it gets installed with the tools. This way scripts can just write

from tinyos import tos

instead of the complicated `try: except:` and add to `sys.path` method. Given that TinyOS already installs `ncc` and other tools, it seems reasonable to also install the tos Python libraries.

I could not figure out how to get `automake` to add the `tinyos.jar` file to some place in the Java search path. Therefore to use it one must still create the `$CLASSPATH` variable.

Out-of-tree builds still work by setting `$TOSMAKE_PATH` and redefining `$TOSROOT` from the Makefile.include in the other (not `tinyos-main`) TinyOS tree.

I've tested this system on a fresh VM install of Ubuntu and Fedora and it compiles and installs successfully.