Using git for distribution with autotools

廉价感情. 提交于 2019-12-06 07:56:42

Many will insist that the autotools generated files should not be checked in. However, with git becoming so ubiquitous, I don't see the harm in doing so, provided you use the latest stable autotools to generate the files. In fact, I suggest you include them:

As you point out, this allows someone to simply checkout the project and configure it - otherwise, you need to provide .tar[.bz2] snapshots for people who don't understand the autotools... and nor should they. The whole idea of the autotools is putting the burden on the developer to minimise the requirements and efforts of the end user.

e.g., passing shell variables on the command line with ./configure ... and make [install] should be sufficient.

If someone really wants to rebuild the generated files, you should ensure that something like autoreconf -fvi is sufficient. If more complex steps are required, provide an autogen.sh script. Anyone performing this step must have the autotools installed, and presumably has a better understanding of how they work - e.g., a 'maintainer-mode' proficiency.

I wouldn't commit any of the autogenerated files. Just ask your users to run autoreconf --install before ./configure && make

You might have to mkdir m4 before all of that if any of the tools complain about the missing directory.

Should I put my autotools generated files in my repo?

You can do both.

Let the master branch have all the autotools generated files checked in so that people can just clone the repository and run ./configure && make && make install without having to run autoconf et al. Then you have another branch, say development, which is "clean" and does not have the files checked in.

This approach does imply that you end up with two branches that needs to be synchronized with merges which is a little maintenance overhead, but it should be almost impossible to get any merge conflicts since the difference will just be files that exists or not.

You should never put autotools generated files into the repo.

Instead, developers should run autoreconf -i after cloning out the repo. This will give them all the generated files which are appropriate and compatible with the versions of autoconf, automake, and libtool which they have installed on their development machine.

When it's time to generate a distribution, don't do it through github, instead do a make dist and you will get a distribution with all the intermediate files correctly created.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!