Hi Christian,
thanks for your in-depth response.
> I'm not a big fan of mixing together various tools inside the same bin/
> folder, linux distribution do it when you install packages but packages are
> maintained for consistency. I'd prefer to rename "tools/avr" /
> "tools/g++_arm_none_eabi" to a more specific name like "avr-gcc-4.3.4" / "arm-
> gcc-none-eabi-4.4.1", put avrdude into a specific folder "avrdude-5.11" and so
> on. But this is not on the top priorities now.
Ok, that makes sense. However, wouldn't including the version number in
the folder make it harder for third-party platform.txt files to refer to
the right directory? Or were you thinking about using wildcards or
exposing some new magic variables to find these version numbers?
> Moreover adding to the environment PATH, as you suggest, implies also work for
> developers of 3rd party plugins based on platform.txt, that I will likely
> avoid.
Ah, good point.
> Instead, what about to reproduce Paul's check but on every tool not only
> avrgcc and avrdude? Just to be clear I'm thinking about an exec() method
> extension something like:
>
> void execOrFallbackToSystemPath(cmd) {
> if (cmd.exists()) {
> // go with the full path
> exec(cmd);
> } else {
> // exec without path, let the s.o. find the right one
> exec(cmd.baseName());
> }
> }
>
> This way we can remove getAvrBasePath() method and set compiler.path variable
> in avr/platform.txt accordingly (removing another "hidden" logic inside the
> IDE).
I considered this option, but didn't like reproducing what's essentially
the same thing the shell is already doing with $PATH. However, your
point about 3rd party tools makes sense, so this seems like the right
option to me now.
> > As for building without the toolchain, I'm not sure what the best
> > approach is here.
> [...]
> > Also, I've found that there are multiple toolchain-like things:
> > - The actual compilers (avr-gcc and arm-gcc)
> > - Uploader tools (avrdude, bossac and adk2tool)
> > - Native libraries (rxtx, libastylej)
>
> I want to back what the others said: Arduino will never distribute a core
> without the offical supported toolchain, so its not in the interest of Arduino
> making it conditional in the build.
Understood.
> Said that, if you really want to go this path, I don't see any concerns in
> improving the build process. I don't have any strong suggestion, probably is
> better if you start with a small piece, for example you can try to make the
> install AVR toolchain conditional, and put a PR with only that to see how it
> looks like.
>
> For the compilers/tools my little experience suggests that the less painful
> way is to use ant properties, but (unexpectedly) this requires a massive
> refactoring of build.xml because of the way conditionals are implemented in
> ant (or maybe I used ant internals in the wrong way...).
Thanks, I'll read up on ant and see if I can prepare something.
> About the native libraries its probably better to use maven or ivy,
> but this is another big topic.
That would require replacing the current ant setup altogether, right? I
guess that's not something for now, though perhaps making things a bit
more consistent could be done now.
> > I found some further inconsistencies that may be worth fixing at the
> > same time:
> > - The avr toolchain tarball is included in git, while the arm toolchain
> > is downloaded at build time. I guess this is because the arm
> > toolchain is just a regular gcc tarball, while the avr one has been
> > post-processed to contain the right pathnames etc.? Or perhaps the
> > difference is just historical?
>
> Most of the build.xml content is historical and was made before I even know
> about Arduino at all. Probably when the repository was under SVN storing
> binary files in it wasn't a big concern as it is with git.
So that suggests that keepin tarballs out of git is the preferred way of
doing things now?
> AFAIK archives are preprocessed to have the right root folder.
Right. To me, it seems more elegant to just use the original tarballs
published by upstream and do all the necessary pathname fidgeting during
the ant build process. That makes it more clear what changes are made to
the tarball and makes it easier to upgrade later on. Not sure if all the
tarballs are from some upstream, though, if they're custom builds for
Arduino then this point is a bit moot.
> > - Some files are downloaded from
downloads.arduino.cc and some from
> >
arduino.googlecode.com.
>
> that was before googlecode decided to close "downloads". Eventually all the
> download will be moved to the Arduino repository.
You mean stored inside git? Or downloaded from arduino.cc?
> > - The rxtx (native) library is contained in git, while the libastylej
> > (native) library is downloaded. Also, various jars are contained in
> > git as well.
>
> also this one was a recent addition.
Ok, so again, doing external downloads is the "new" and preferred way.
>
> > - git contains a jre.tgz, even though it is (fortunately) not used.
> > - The windows-dist target builds an "expert" version, which excludes
> > the "java" subdirectory, but I couldn't find what files are supposed
> > to be in there?
>
> it is used on windows build to provide a JRE. In the latest ide-1.5.x the
> archive is downloaded from Arduino repository (after an upgrade of the java
> runtime it was moved there).
Right.
>
> > - Most toolchain bits are in build/linux/dist, except the avr toolchain
> > and libastylej.
>
> another recent change.
In this case, I think that inside dist/ would be the preferred location,
right? So libastylej, even though it's a recent addition, is in the
wrong place? Or actually, libastylej is not even in the repo, it's just
downloaded and temporarily unpacked to build/linux, which probably isn't
very elegant. Perhaps something like build/linux/work/temp would be
better for that?
> > - linux32 and linux64 are different platforms, but share the
> > build/linux directory. Why not use build/linux32 and build/linux64
> > instead?
>
> I don't know the reason, probably at the time, linux64 was very similiar to
> linux32, so it seemed overkill to duplicate everything.
No need to duplicate everything, they can still have the same generial
dependencies. I might see what happens if you split these, it might make
the build.xml a bit more clear.
Gr.
Matthijs