7 ms·
Most of those tips are great, but dont use autotools! The points they give for choosing autotools are exactly the same as one would have read maybe a decade ago
by bjourne 14y ago
Most of those tips are great, but dont use autotools! The points they give for choosing autotools are exactly the same as one would have read maybe a decade ago when people said that CVS was "good enough" and that it "just works." Subversion, git and several others are much better alternatives and where developed because people weren't happy with CVS quirks and crappiness. One example is waf (http://docs.waf.googlecode.com/git/book_16/single.html http://docs.waf.googlecode.com/git/book_16/single.html), arguably just as well documented as autotools but without all the cruft and generated files madness autotools forces you to go through. CMake (http://www.cmake.org/ http://www.cmake.org/) is another, used by KDE 4. SCons (http://www.scons.org/ http://www.scons.org/) another nice build tool. These also have the advantage of working much better on Windows, a platform autotools is completely alien to.
- antirez 14y ago+1, also, don't use GPL but BSD-alike licenses...
- stefantalpalaru 14y agoIf you don't want to choose between extreme approaches take a look at the Mozilla Public License (MPL): http://www.mozilla.org/MPL/2.0/FAQ.html http://www.mozilla.org/MPL/2.0/FAQ.html "The MPL's 'file-level' copyleft is designed to encourage contributors to share modifications they make to your code, while still allowing them to combine your code with code under other licenses (open or proprietary) with minimal restrictions."
- JoshTriplett 14y agoBad idea to choose a GPL-incompatible license for a library, though. If you like the MPL, use it in a dual-license with the GPL or LGPL, like cairo does. Better yet, just use the LGPL or GPL.
- stefantalpalaru 14y agoMPL-2.0 is not (L)GPL incompatible. See http://www.mozilla.org/MPL/2.0/FAQ.html#mpl-and-lgpl http://www.mozilla.org/MPL/2.0/FAQ.html#mpl-and-lgpl With some software (Go code that is always statically linked by the official toolchain comes to mind) you are shooting yourself in the foot with GPL and even LGPL.
- ksherlock 14y agoLGPL code can be statically linked. However, you need to provide your other object files (so the LGPL part can be replaced and re-linked).
- stefantalpalaru 14y agoIt's complicated. To be able to modify, recompile and relink the LGPL part you would have to use the exact version of the go toolchain with which the commercial part was compiled with. Not to mention having to come up with a custom build process that puts the object files in the distributed archive...
- yorhel 14y agoPlease do use autotools! You only need two files: configure.ac and Makefile.am, both at the top-level of your project. The autogenerated stuff can be ignored, you don't have to learn M4 to use autoconf. And (if you are a bit careful, but that's not too hard) you'll have many nice features such as out-of-source builds, proper feature checking, amazing portability, 'make distcheck', and acceptable cross-compiling (still hard to get right, but the alternatives tend to be even harder). Don't switch to another build system purely based on the idea that it's "more elegant".
- i386 14y agoIf anyone could tell me a way todo what you describe without copying and checking in 'mystery meat' autofoo and m4 files into my project, I would.
- yorhel 14y agoStart with the Autotools Mythbuster: http://www.flameeyes.eu/autotools-mythbuster/ http://www.flameeyes.eu/autotools-mythbuster/ The autoconf & automake documentation is generally quite good as well.
- AngryParsley 14y agoI don't want to toot my own horn, but I only check in Makefile.am and configure.ac. Here's a simple example I made a while back: https://github.com/ggreer/fsevents-tools https://github.com/ggreer/fsevents-tools. To build it, just run autogen.sh. For a "real" project, https://github.com/ggreer/the_silver_searcher https://github.com/ggreer/the_silver_searcher, I have the same set-up: Makefile.am and configure.ac with no generated code in the repo. It works fine as long as you have pkg-config, and most people do. It builds and runs on Solaris, OS X, FreeBSD, and any Linux distro you like. Although I use autotools the "right way", I'm not a fan of it at all. There are multiple levels of generated files. Configure is generated from configure.in which is generated from configure.ac. Makefile is generated from configure and Makefile.in. Makefile.in is generated from Makefile.am. There are other files in the mix as well. Config.h, config.h.in, aclocal.m4, and various symlinks to autotools (compile, depcomp, install-sh, and missing) get generated. It's insane. There are other problems. Minor versions of autotools can behave completely differently. AM_SILENT_MAKE was removed between automake 1.10 and 1.11. Instead of printing out minimal text during a build, scripts using that macro crash. Another example: 1.9 requires AM_PROG_CC_C_O to compile anything useful but 1.10 doesn't. What's crazy is that 1.9 actually spits out an error message telling you to add AM_PROG_CC_C_O to your configure.ac. It makes no sense. A system this complicated can't be pruned without breaking backwards compatibility. For autotools, that's not feasible. There are too many projects that would need to be fixed. The next-best solution is to use something else for new projects and let autotools fade gently into history.
- pdw 14y agoAs someone who's done a bit of Debian development, I find autotools packages a lot easier to deal with than the alternatives. It might be a bit crufty, but if used properly it works very well.
- Nursie 14y agoYuck, SCons.... I know some folks like it in all it's python-y glory, but I found it opaque and horrible. Finding where things are done and how to change its behaviour was surprisingly hard work. Now this may have been at least partly due to the way the project was set up but... well just give me a nice Makefile any day.
- anonymouz 14y agoEh, if it's a C library, use autotools. Really, the original article says it best: - We are all used to autotools, it works, nobody cares. ... - And really, anything but autotools is realy an option. Just get over it. Everything else is an experiment, and it will come back to you sooner or later. Why? think cross compilation, installation/ uninstallation, build root integration, separate object trees, standard adherence, tarball handling, make distcheck, testing, portability between distros, ...
- Hoff 14y agoHave you ever tried to port a package that is using autotools to a platform that is not based on GNU/Linux? Among those of us that have attempted or have done that port, most will probably not look particularly favorably on autotools again. One of the easiest approaches here involves reverse-engineering the autotools product from a test run performed on a GNU/Linux box, and then translating and building a platform-specific script. From what I can tell of it, autotools makes substantial use of GNU/Linux features. Which is certainly fine for its intended platform and typical usage, but it's an approach that is Not Fun for porting that code.
- radarsat1 14y agoAre you kidding? Porting tools to other platforms is the main selling point of autotools. Why do you think it goes to such pains to avoid bash-isms in its output, sticking to raw POSIX shell code, even to the point of avoiding functions and loops? This is specifically to support weird esoteric * -nixes. Even on Windows, it works fairly well with MingW. Most porting pain comes from bad package management. Many POSIX-compatible libraries using autotools/libtool can be compiled on OS X without changes, and often MingW too. That isn't true for many other systems. More importantly, when you do need to make a change, it's a simple edit of shell code and some pretty straight-forward makefile variables. It could just be unfamiliarity, but I've tried customizing the output of CMake for some specific situations and the complexity of the its makefiles is pretty prohibitive. Trying to change the CMake source files for someone unfamiliar with its "language" and variable name conventions is annoying and error-prone.
- comex 14y agoI rather dislike autotools (every time I wait for a configure file to make a million compiler tests which could be stored in a global cache, it's wasting my time), but I wish some of the alternative build tools placed a higher priority on being compatible with it rather than inventing their own syntax. If I want to do something like cross compile or even just add custom cflags (ugh, cmake...), I know what configure option will do so, and it's not a particularly bad interface either. From a user's perspective, build systems are usually boring; a consistent user interface makes the world a little simpler.
- jahewson 14y agoCMake is a nightmare on OS X, especially if you have Homebrew installed. If you're wanting to go down this route, gyp is a much better choice, though still rather new.
- LukeShu 14y agoOK, there are a lot of autoconf scripts that are poorly written, and therefore don't get the benefits. I've never heard of waf. I've never had to fight with scons, but I've never used it for my project. But, for the love of all that is holy, do not CMake. It works fantastically... until you have to fix something. I tell you this as a distro packager. I've had to fight with build systems. Patching autoconf files, automake files, ant files, are all fairly comfortable for me. I dread the days when I have to figure out an issue with CMake.
- iambvk 14y agoI find autotools thousand times easier than CMake. Autotools just work. I can always ask it to get the hell out of my way! Doing complex dependencies in CMake is a pain where as with Autmake, I can just go back to Make in the same file.
- snogglethorpe 14y agoYeah, I concur. I've had miserable experiences with cmake. The autotools have a butt-ugly implementation, but generally work pretty well, and are fairly simple to use, within their domain. That's the issue, really ... each of these build systems (including the autotools) seems to have a sweet spot where it works pretty well, but can be a misery outside it. None of them (that I've encountered) are even close to being universally good. Pick your poison wisely...